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

Function fillContours2D

source/MRMesh/MRFillContours2D.cpp:178–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178Expected<void> fillContours2D( Mesh& mesh, const std::vector<EdgeId>& holeRepresentativeEdges )
179{
180 MR_TIMER;
181
182 auto projInput = projectHoles( mesh, holeRepresentativeEdges );
183 if ( !projInput.has_value() )
184 return unexpected( std::move( projInput.error() ) );
185
186 auto fillRes = fillProjected( mesh.topology, *projInput );
187 if ( !fillRes.has_value() )
188 return unexpected( std::move( fillRes.error() ) );
189
190 // move patch surface border points to original position (according original mesh)
191 auto& patchMeshPoints = fillRes->mesh.points;
192 auto& patchMeshTopology = fillRes->mesh.topology;
193 auto& meshPoints = mesh.points;
194 auto& meshTopology = mesh.topology;
195 for ( int i = 0; i < projInput->paths.size(); ++i )
196 {
197 auto& path = projInput->paths[i];
198 auto& newPath = fillRes->paths[i];
199 for ( int j = 0; j < path.size(); ++j )
200 patchMeshPoints[patchMeshTopology.org( newPath[j] )] = meshPoints[meshTopology.org( path[j] )];
201 }
202
203 // add patch surface to original mesh
204 mesh.addMeshPart( fillRes->mesh, false, projInput->paths, fillRes->paths );
205 return {};
206}
207
208Expected<HoleFillPlan> fillContours2DPlan( const Mesh& mesh, EdgeId holeEdgeId )
209{

Callers 2

TESTFunction · 0.85
fillPlanarHoleFunction · 0.85

Calls 7

projectHolesFunction · 0.85
fillProjectedFunction · 0.85
errorMethod · 0.80
addMeshPartMethod · 0.80
unexpectedFunction · 0.70
sizeMethod · 0.45
orgMethod · 0.45

Tested by 1

TESTFunction · 0.68