| 474 | |
| 475 | template <typename T, typename TNearPointLocator> |
| 476 | void Triangulation<T, TNearPointLocator>::insertEdgeIteration( |
| 477 | const Edge edge, |
| 478 | const Edge originalEdge, |
| 479 | EdgeVec& remaining, |
| 480 | std::vector<TriangulatePseudoPolygonTask>& tppIterations) |
| 481 | { |
| 482 | const VertInd iA = edge.v1(); |
| 483 | VertInd iB = edge.v2(); |
| 484 | if(iA == iB) // edge connects a vertex to itself |
| 485 | return; |
| 486 | |
| 487 | if(hasEdge(iA, iB)) |
| 488 | { |
| 489 | fixEdge(edge, originalEdge); |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | const V2d<T>& a = vertices[iA]; |
| 494 | const V2d<T>& b = vertices[iB]; |
| 495 | const T distanceTolerance = |
| 496 | m_minDistToConstraintEdge == T(0) |
| 497 | ? T(0) |
| 498 | : m_minDistToConstraintEdge * distance(a, b); |
| 499 | |
| 500 | TriInd iT; |
| 501 | // Note: 'L' is left and 'R' is right of the inserted constraint edge |
| 502 | VertInd iVL, iVR; |
| 503 | tie(iT, iVL, iVR) = intersectedTriangle(iA, a, b, distanceTolerance); |
| 504 | // if one of the triangle vertices is on the edge, move edge start |
| 505 | if(iT == noNeighbor) |
| 506 | { |
| 507 | const Edge edgePart(iA, iVL); |
| 508 | fixEdge(edgePart, originalEdge); |
| 509 | remaining.push_back(Edge(iVL, iB)); |
| 510 | return; |
| 511 | } |
| 512 | Triangle t = triangles[iT]; |
| 513 | std::vector<TriInd> intersected(1, iT); |
| 514 | std::vector<VertInd> polyL, polyR; |
| 515 | polyL.reserve(2); |
| 516 | polyL.push_back(iA); |
| 517 | polyL.push_back(iVL); |
| 518 | polyR.reserve(2); |
| 519 | polyR.push_back(iA); |
| 520 | polyR.push_back(iVR); |
| 521 | unordered_map<Edge, TriInd> outerTris; |
| 522 | outerTris[Edge(iA, iVL)] = edgeNeighbor(t, iA, iVL); |
| 523 | outerTris[Edge(iA, iVR)] = edgeNeighbor(t, iA, iVR); |
| 524 | VertInd iV = iA; |
| 525 | |
| 526 | while(!t.containsVertex(iB)) |
| 527 | { |
| 528 | const TriInd iTopo = opposedTriangle(t, iV); |
| 529 | const Triangle& tOpo = triangles[iTopo]; |
| 530 | const VertInd iVopo = opposedVertex(tOpo, iT); |
| 531 | |
| 532 | switch(m_intersectingEdgesStrategy) |
| 533 | { |
nothing calls this directly
no test coverage detected