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

Method nextEdgeNewLeft

source/MRMesh/MRReducePath.cpp:344–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344void PathInPlanarTriangleStrip::nextEdgeNewLeft( const Vector2f & pos )
345{
346 assert( !edges_.empty() );
347 PntId prev = edges_.back().left;
348 PntId curr{ points_.size() };
349 points_.push_back( pos );
350 previous_.push_back( {} );
351 next_.push_back( {} );
352
353 Edge e;
354 e.left = curr;
355 e.right = edges_.back().right;
356 edges_.push_back( e );
357
358 while ( prev != apex_ )
359 {
360 auto beforePrev = previous_[prev];
361 assert( beforePrev.valid() );
362 if ( cross( beforePrev, prev, curr ) > 0 )
363 {
364 previous_[curr] = prev;
365 next_[prev] = curr;
366 break;
367 }
368 prev = beforePrev;
369 }
370 if ( prev == apex_ )
371 {
372 while ( rightAfterApex_ && cross( curr, apex_, rightAfterApex_ ) < 0 )
373 {
374 apex_ = rightAfterApex_;
375 rightAfterApex_ = next_[rightAfterApex_];
376 }
377 leftAfterApex_ = curr;
378 previous_[curr] = apex_;
379 }
380}
381
382void PathInPlanarTriangleStrip::nextEdgeNewRight( const Vector2f & pos )
383{

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