302 T minDistToConstraintEdge);
316 const TNearPointLocator& nearPtLocator,
318 T minDistToConstraintEdge);
332 typename TVertexIter,
333 typename TGetVertexCoordX,
334 typename TGetVertexCoordY>
338 TGetVertexCoordX getX,
339 TGetVertexCoordY getY);
344 void insertVertices(
const std::vector<
V2d<T> >& vertices);
376 typename TGetEdgeVertexStart,
377 typename TGetEdgeVertexEnd>
381 TGetEdgeVertexStart getStart,
382 TGetEdgeVertexEnd getEnd);
403 void insertEdges(
const std::vector<Edge>& edges);
435 typename TGetEdgeVertexStart,
436 typename TGetEdgeVertexEnd>
440 TGetEdgeVertexStart getStart,
441 TGetEdgeVertexEnd getEnd);
462 void conformToEdges(
const std::vector<Edge>& edges);
468 void eraseSuperTriangle();
470 void eraseOuterTriangles();
477 void eraseOuterTrianglesAndHoles();
482 void initializedWithCustomSuperGeometry();
489 bool isFinalized()
const;
504 std::vector<LayerDepth> calculateTriangleDepths()
const;
539 void removeTriangles(
const TriIndUSet& removedTriangles);
544 const TriIndVec& VertTrisInternal()
const;
549 void addSuperTriangle(
const Box2d<T>& box);
551 void insertVertex(
VertInd iVert);
553 void ensureDelaunayByEdgeFlips(
VertInd iV1, std::stack<TriInd>& triStack);
555 std::vector<Edge> insertVertex_FlipFixedEdges(
VertInd iV1);
558 typedef tuple<IndexSizeType, IndexSizeType, TriInd, TriInd, Index>
559 TriangulatePseudoPolygonTask;
577 std::vector<TriangulatePseudoPolygonTask>& tppIterations);
591 void insertEdgeIteration(
595 std::vector<TriangulatePseudoPolygonTask>& tppIterations);
598 typedef tuple<Edge, EdgeVec, BoundaryOverlapCount> ConformToEdgeTask;
615 BoundaryOverlapCount overlaps,
616 std::vector<ConformToEdgeTask>& remaining);
629 void conformToEdgeIteration(
632 BoundaryOverlapCount overlaps,
633 std::vector<ConformToEdgeTask>& remaining);
635 tuple<TriInd, VertInd, VertInd> intersectedTriangle(
639 T orientationTolerance = T(0))
const;
641 std::stack<TriInd> insertVertexInsideTriangle(
VertInd v,
TriInd iT);
644 array<TriInd, 2> trianglesAt(
const V2d<T>& pos)
const;
668 void triangulatePseudoPolygon(
669 const std::vector<VertInd>& poly,
670 unordered_map<Edge, TriInd>& outerTris,
673 std::vector<TriangulatePseudoPolygonTask>& iterations);
674 void triangulatePseudoPolygonIteration(
675 const std::vector<VertInd>& poly,
676 unordered_map<Edge, TriInd>& outerTris,
677 std::vector<TriangulatePseudoPolygonTask>& iterations);
678 IndexSizeType findDelaunayPoint(
679 const std::vector<VertInd>& poly,
681 IndexSizeType iB)
const;
689 void finalizeTriangulation(
const TriIndUSet& removedTriangles);
690 TriIndUSet growToBoundary(std::stack<TriInd> seeds)
const;
691 void fixEdge(
const Edge& edge);
692 void fixEdge(
const Edge& edge,
const Edge& originalEdge);
698 void splitFixedEdge(
const Edge& edge,
const VertInd iSplitVert);
731 void makeDummy(
TriInd iT);
753 unordered_map<TriInd, LayerDepth> peelLayer(
754 std::stack<TriInd> seeds,
756 std::vector<LayerDepth>& triDepths)
const;
758 void insertVertices_AsProvided(
VertInd superGeomVertCount);
759 void insertVertices_Randomized(
VertInd superGeomVertCount);
760 void insertVertices_KDTreeBFS(
764 std::pair<TriInd, TriInd> edgeTriangles(
VertInd a,
VertInd b)
const;
767 void pivotVertexTriangleCW(
VertInd v);
769 void tryAddVertexToLocator(
const VertInd v);
772 void tryInitNearestPointLocator();
774 std::vector<TriInd> m_dummyTris;
775 TNearPointLocator m_nearPtLocator;
776 IndexSizeType m_nTargetVerts;
780 T m_minDistToConstraintEdge;
844 const TVertexIter first,
845 const TVertexIter last,
846 TGetVertexCoordX getX,
847 TGetVertexCoordY getY)
852 const bool isFirstTime = vertices.empty();
853 const T max = std::numeric_limits<T>::max();
854 Box2d<T> box = {{max, max}, {-max, -max}};
858 addSuperTriangle(box);
860 tryInitNearestPointLocator();
862 const VertInd nExistingVerts =
static_cast<VertInd>(vertices.size());
864 static_cast<VertInd>(nExistingVerts + std::distance(first, last));
866 triangles.reserve(triangles.size() + 2 * nVerts);
867 vertices.reserve(nVerts);
868 m_vertTris.reserve(nVerts);
869 for(TVertexIter it = first; it != last; ++it)
870 addNewVertex(
V2d<T>::make(getX(*it), getY(*it)), noNeighbor);
872 switch(m_vertexInsertionOrder)
875 insertVertices_AsProvided(nExistingVerts);
878 isFirstTime ? insertVertices_KDTreeBFS(nExistingVerts, box.
min, box.
max)
879 : insertVertices_Randomized(nExistingVerts);