Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::AllIntersectionsVisitor Struct Reference
+ Collaboration diagram for Slic3r::AllIntersectionsVisitor:

Public Member Functions

 AllIntersectionsVisitor (const EdgeGrid::Grid &grid, std::vector< Intersection > &intersections)
 
 AllIntersectionsVisitor (const EdgeGrid::Grid &grid, std::vector< Intersection > &intersections, const Line &travel_line)
 
void reset ()
 
bool operator() (coord_t iy, coord_t ix)
 

Public Attributes

const EdgeGrid::Gridgrid
 
std::vector< Intersection > & intersections
 
Line travel_line
 
std::unordered_set< std::pair< size_t, size_t >, boost::hash< std::pair< size_t, size_t > > > intersection_set
 

Detailed Description

Constructor & Destructor Documentation

◆ AllIntersectionsVisitor() [1/2]

Slic3r::AllIntersectionsVisitor::AllIntersectionsVisitor ( const EdgeGrid::Grid grid,
std::vector< Intersection > &  intersections 
)
inline
57 {
58 intersection_set.reserve(intersections.capacity());
59 }
std::unordered_set< std::pair< size_t, size_t >, boost::hash< std::pair< size_t, size_t > > > intersection_set
Definition AvoidCrossingPerimeters.cpp:90
std::vector< Intersection > & intersections
Definition AvoidCrossingPerimeters.cpp:88
const EdgeGrid::Grid & grid
Definition AvoidCrossingPerimeters.cpp:87

References intersection_set, and intersections.

◆ AllIntersectionsVisitor() [2/2]

Slic3r::AllIntersectionsVisitor::AllIntersectionsVisitor ( const EdgeGrid::Grid grid,
std::vector< Intersection > &  intersections,
const Line travel_line 
)
inline
63 {
64 intersection_set.reserve(intersections.capacity());
65 }
Line travel_line
Definition AvoidCrossingPerimeters.cpp:89

References intersection_set, and intersections.

Member Function Documentation

◆ operator()()

bool Slic3r::AllIntersectionsVisitor::operator() ( coord_t  iy,
coord_t  ix 
)
inline
72 {
73 // Called with a row and column of the grid cell, which is intersected by a line.
74 auto cell_data_range = grid.cell_data_range(iy, ix);
75 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++it_contour_and_segment) {
76 Point intersection_point;
77 if (travel_line.intersection(grid.line(*it_contour_and_segment), &intersection_point) &&
78 intersection_set.find(*it_contour_and_segment) == intersection_set.end()) {
79 intersections.push_back({ it_contour_and_segment->first, it_contour_and_segment->second, intersection_point });
80 intersection_set.insert(*it_contour_and_segment);
81 }
82 }
83 // Continue traversing the grid along the edge.
84 return true;
85 }
std::pair< std::vector< std::pair< size_t, size_t > >::const_iterator, std::vector< std::pair< size_t, size_t > >::const_iterator > cell_data_range(coord_t row, coord_t col) const
Definition EdgeGrid.hpp:336
Line line(const std::pair< size_t, size_t > &contour_and_segment_idx) const
Definition EdgeGrid.hpp:351
bool intersection(const Line &line, Point *intersection) const
Definition Line.cpp:92
Kernel::Point_2 Point
Definition point_areas.cpp:20

References Slic3r::EdgeGrid::Grid::cell_data_range(), grid, Slic3r::Line::intersection(), intersection_set, intersections, Slic3r::EdgeGrid::Grid::line(), and travel_line.

+ Here is the call graph for this function:

◆ reset()

void Slic3r::AllIntersectionsVisitor::reset ( )
inline
67 {
68 intersection_set.clear();
69 }

References intersection_set.

Member Data Documentation

◆ grid

const EdgeGrid::Grid& Slic3r::AllIntersectionsVisitor::grid

Referenced by operator()().

◆ intersection_set

std::unordered_set<std::pair<size_t, size_t>, boost::hash<std::pair<size_t, size_t> > > Slic3r::AllIntersectionsVisitor::intersection_set

◆ intersections

std::vector<Intersection>& Slic3r::AllIntersectionsVisitor::intersections

◆ travel_line

Line Slic3r::AllIntersectionsVisitor::travel_line

Referenced by operator()().


The documentation for this struct was generated from the following file: