MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / pack

Method pack

source/MRMesh/MRPointCloud.cpp:173–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173bool PointCloud::pack( VertMap * outNew2Old )
174{
175 MR_TIMER;
176 const auto newSz = validPoints.count();
177 if ( points.size() == newSz )
178 {
179 assert( normals.empty() || normals.size() == newSz );
180 assert( validPoints.size() == newSz );
181 return false;
182 }
183
184 if ( outNew2Old )
185 {
186 outNew2Old->clear();
187 outNew2Old->reserve( newSz );
188 }
189
190 VertCoords packedPoints;
191 packedPoints.reserve( newSz );
192 VertNormals packedNormals;
193 if ( !normals.empty() )
194 packedNormals.reserve( newSz );
195
196 for ( auto v : validPoints )
197 {
198 packedPoints.push_back( points[v] );
199 if ( !normals.empty() )
200 packedNormals.push_back( normals[v] );
201 if ( outNew2Old )
202 outNew2Old->push_back( v );
203 }
204
205 assert( packedPoints.size() == newSz );
206 assert( packedNormals.empty() || packedNormals.size() == newSz );
207 points = std::move( packedPoints );
208 normals = std::move( packedNormals );
209 validPoints.clear();
210 validPoints.resize( newSz, true );
211
212 invalidateCaches();
213 return true;
214}
215
216std::vector<VertId> PointCloud::getLexicographicalOrder() const
217{

Callers

nothing calls this directly

Calls 12

ParallelForFunction · 0.85
countMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45
reserveMethod · 0.45
resizeMethod · 0.45
testMethod · 0.45
endIdMethod · 0.45
updateMethod · 0.45
getLeafOrderAndResetMethod · 0.45

Tested by

no test coverage detected