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

Function meshPathCurvePoints

source/MRMesh/MRAlignContoursToMesh.cpp:303–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303CurvePoints meshPathCurvePoints( const Mesh& mesh, const GeodesicPath& path )
304{
305 MR_TIMER;
306 CurvePoints cp;
307 cp.reserve( path.numVertices() );
308 if (path.start.valid() )
309 cp.push_back( { .pos = mesh.triPoint( path.start ), .snorm = mesh.normal( path.start ) } );
310 for ( const auto & ep : path.mids )
311 cp.push_back( { .pos = mesh.triPoint( ep ), .snorm = mesh.normal( ep ) } );
312 if ( path.end.valid() )
313 cp.push_back( { .pos = mesh.triPoint( path.end ), .snorm = mesh.normal( path.end ) } );
314 assert( cp.size() == path.numVertices() );
315
316 if ( cp.size() < 2 )
317 {
318 assert( false );
319 return {};
320 }
321 cp[0].dir = ( cp[1].pos - cp[0].pos ).normalized();
322 for ( int i = 1; i + 1 < cp.size(); ++i )
323 cp[i].dir = ( cp[i + 1].pos - cp[i - 1].pos ).normalized();
324 cp.back().dir = ( cp[cp.size() - 1].pos - cp[cp.size() - 2].pos ).normalized();
325 return cp;
326}
327
328CurvePoints meshPathCurvePoints( const Mesh& mesh, const SurfacePath& path )
329{

Callers 2

bendTextAlongSurfacePathFunction · 0.85

Calls 8

numVerticesMethod · 0.80
push_backMethod · 0.80
triPointMethod · 0.80
normalMethod · 0.80
reserveMethod · 0.45
validMethod · 0.45
sizeMethod · 0.45
normalizedMethod · 0.45

Tested by

no test coverage detected