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

Method nextEdgeNewRight

source/MRMesh/MRReducePath.cpp:382–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382void PathInPlanarTriangleStrip::nextEdgeNewRight( const Vector2f & pos )
383{
384 assert( !edges_.empty() );
385 PntId prev = edges_.back().right;
386 PntId curr{ points_.size() };
387 points_.push_back( pos );
388 previous_.push_back( {} );
389 next_.push_back( {} );
390
391 Edge e;
392 e.left = edges_.back().left;
393 e.right = curr;
394 edges_.push_back( e );
395
396 while ( prev != apex_ )
397 {
398 auto beforePrev = previous_[prev];
399 assert( beforePrev.valid() );
400 if ( cross( beforePrev, prev, curr ) < 0 )
401 {
402 previous_[curr] = prev;
403 next_[prev] = curr;
404 break;
405 }
406 prev = beforePrev;
407 }
408 if ( prev == apex_ )
409 {
410 while ( leftAfterApex_ && cross( curr, apex_, leftAfterApex_ ) > 0 )
411 {
412 apex_ = leftAfterApex_;
413 leftAfterApex_ = next_[leftAfterApex_];
414 }
415 rightAfterApex_ = curr;
416 previous_[curr] = apex_;
417 }
418}
419
420void PathInPlanarTriangleStrip::getLastEdge( Vector2f & l, Vector2f & r )
421{

Callers 1

nextEdgeMethod · 0.80

Calls 5

push_backMethod · 0.80
crossFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected