| 342 | } |
| 343 | |
| 344 | void 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 | |
| 382 | void PathInPlanarTriangleStrip::nextEdgeNewRight( const Vector2f & pos ) |
| 383 | { |