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

Method find

source/MRMesh/MRReducePath.cpp:426–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426void PathInPlanarTriangleStrip::find( const Vector2f & end, std::function< void(float) > edgeCrossPosition )
427{
428 nextEdgeNewLeft( end );
429
430 auto curr = edges_.back().left;
431 auto prev = previous_[curr];
432 for ( int i = (int)edges_.size() - 2; i >= 0; --i )
433 {
434 if ( edges_[i].left == prev )
435 {
436 edgeCrossPosition( 0 );
437 curr = prev;
438 prev = previous_[prev];
439 }
440 else if ( edges_[i].right == prev )
441 {
442 edgeCrossPosition( 1 );
443 curr = prev;
444 prev = previous_[prev];
445 }
446 else if ( edges_[i].left == curr )
447 {
448 edgeCrossPosition( 0 );
449 }
450 else if ( edges_[i].right == curr )
451 {
452 edgeCrossPosition( 1 );
453 }
454 else
455 {
456 float lc = cross( prev, edges_[i].left, curr );
457 float rc = cross( prev, edges_[i].right, curr );
458 if ( lc - rc != 0 )
459 {
460 edgeCrossPosition( std::clamp( lc / ( lc - rc ), 0.0f, 1.0f ) );
461 }
462 else
463 {
464 // prev-point and curr-point are on the same line with edges_[i], return something
465 edgeCrossPosition( 0.5f );
466 }
467 }
468 }
469}
470
471class TriangleStripUnfolder
472{

Callers 1

reducePathFunction · 0.45

Calls 9

clampFunction · 0.85
unfoldOnPlaneFunction · 0.85
triPointMethod · 0.80
getLastEdgeMethod · 0.80
crossFunction · 0.70
emptyFunction · 0.70
sizeMethod · 0.45
orgPntMethod · 0.45
destPntMethod · 0.45

Tested by

no test coverage detected