OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
anonymous_namespace{IntersectionPoints.cpp} Namespace Reference

Functions

IntersectionsLines compute_intersections (const Lines &lines)

Function Documentation

◆ compute_intersections()

IntersectionsLines anonymous_namespace{IntersectionPoints.cpp}::compute_intersections ( const Lines & lines)
15{
16 if (lines.size() < 3)
17 return {};
18
20 IntersectionsLines result;
21 for (uint32_t li = 0; li < lines.size()-1; ++li) {
22 const Line &l = lines[li];
23 auto intersections = AABBTreeLines::get_intersections_with_line<false, Point, Line>(lines, tree, l);
24 for (const auto &[p, node_index] : intersections) {
25 if (node_index - 1 <= li)
26 continue;
27 if (const Line &l_ = lines[node_index];
28 l_.a == l.a ||
29 l_.a == l.b ||
30 l_.b == l.a ||
31 l_.b == l.b )
32 // it is duplicit point not intersection
33 continue;
34
35 // NOTE: fix AABBTree to compute intersection with double preccission!!
36 Vec2d intersection_point = p.cast<double>();
37
38 result.push_back(IntersectionLines{li, static_cast<uint32_t>(node_index), intersection_point});
39 }
40 }
41 return result;
42}
std::vector< std::pair< VectorType, size_t > > get_intersections_with_line(const std::vector< LineType > &lines, const TreeType &tree, const LineType &line)
Definition AABBTreeLines.hpp:276
AABBTreeIndirect::Tree< LineType::Dim, typename LineType::Scalar > build_aabb_tree_over_indexed_lines(const std::vector< LineType > &lines)
Definition AABBTreeLines.hpp:172
std::vector< IntersectionLines > IntersectionsLines
Definition IntersectionPoints.hpp:18
std::vector< IntersectionLine > IntersectionLines
Definition TriangleMeshSlicer.cpp:160
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67

References Slic3r::Line::a, Slic3r::Line::b, Slic3r::AABBTreeLines::build_aabb_tree_over_indexed_lines(), and Slic3r::AABBTreeLines::get_intersections_with_line().

Here is the call graph for this function: