76 void Compute(
const std::vector<Point>& polyLine);
92 std::ranges::sort(intersections,
93 [](
const T& first,
const T& second)
94 {
return first.polylineDistance < second.polylineDistance; });
96 std::erase_if(intersections, [](
const T& v)
97 {
return v.polylineDistance < 0; });
110 std::tuple<UInt, UInt> GetIntersectionSeed(
const Mesh2D& mesh,
111 const std::vector<Point>& polyLine,
112 const UInt polygonIndexStart,
113 const bool checkOnlyBoundarySegments,
114 const std::vector<BoundingBox>& polyLineBoundingBoxes,
115 const std::vector<bool>& vistedEdges)
const;
119 std::tuple<bool, UInt, UInt, double, double, double> GetNextEdgeIntersection(
const std::vector<Point>& polyLine,
120 const std::vector<BoundingBox>& polyLineBoundingBoxes,
124 Direction direction)
const;
127 void IntersectFaceEdges(
const std::vector<Point>& polyLine,
128 const std::vector<BoundingBox>& polyLineBoundingBoxes,
129 const std::vector<double>& cumulativeLength,
130 UInt currentCrossingEdge,
131 UInt currentFaceIndex,
133 std::vector<bool>& vistedEdges,
134 std::vector<bool>& vistedFace,
135 std::queue<std::array<UInt, 2>>& crossingEdges);
138 static void updateEdgeIntersections(
const UInt segmentIndex,
139 const UInt edgeIndex,
141 const std::vector<double>& cumulativeLength,
142 const double crossProductValue,
143 const double adimensionalEdgeDistance,
144 const double adimensionalPolylineSegmentDistance,
145 std::vector<EdgeMeshPolyLineIntersection>& intersections)
147 const auto [edgeFirstNode, edgeSecondNode] = edge;
149 intersections[edgeIndex].polylineSegmentIndex =
static_cast<int>(segmentIndex);
150 intersections[edgeIndex].polylineDistance = cumulativeLength[segmentIndex] +
151 adimensionalPolylineSegmentDistance * (cumulativeLength[segmentIndex + 1] - cumulativeLength[segmentIndex]);
152 intersections[edgeIndex].adimensionalPolylineSegmentDistance = adimensionalPolylineSegmentDistance;
153 intersections[edgeIndex].edgeFirstNode = crossProductValue < 0 ? edgeSecondNode : edgeFirstNode;
154 intersections[edgeIndex].edgeSecondNode = crossProductValue < 0 ? edgeFirstNode : edgeSecondNode;
155 intersections[edgeIndex].edgeDistance = adimensionalEdgeDistance;
156 intersections[edgeIndex].edgeIndex = edgeIndex;
160 static void updateFaceIntersections(
const UInt faceIndex,
161 const UInt edgeIndex,
162 std::vector<FaceMeshPolyLineIntersection>& intersections)
164 intersections[faceIndex].faceIndex = faceIndex;
165 intersections[faceIndex].edgeIndices.emplace_back(edgeIndex);
169 std::vector<EdgeMeshPolyLineIntersection> m_edgesIntersectionsCache;
170 std::vector<FaceMeshPolyLineIntersection> m_facesIntersectionsCache;
171 std::vector<EdgeMeshPolyLineIntersection> m_edgesIntersections;
172 std::vector<FaceMeshPolyLineIntersection> m_faceIntersections;
173 BoundingBox m_meshBoundingBox;
174 std::vector<BoundingBox> m_meshEdgesBoundingBoxes;
175 static constexpr UInt maxSearchSegments = 1000;