OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::MinDistanceVisitor Struct Reference
Collaboration diagram for Slic3r::MinDistanceVisitor:

Public Member Functions

 MinDistanceVisitor (const EdgeGrid::Grid &grid, const Point &center, double max_distance_squared)
void init ()
bool operator() (coord_t iy, coord_t ix)

Public Attributes

const EdgeGrid::Grid & grid
const Slic3r::Point center
std::vector< ClosestLine > closest_lines
std::unordered_set< std::pair< size_t, size_t >, boost::hash< std::pair< size_t, size_t > > > closest_lines_set
double max_distance_squared = std::numeric_limits<double>::max()

Detailed Description

Constructor & Destructor Documentation

◆ MinDistanceVisitor()

Slic3r::MinDistanceVisitor::MinDistanceVisitor ( const EdgeGrid::Grid & grid,
const Point & center,
double max_distance_squared )
inlineexplicit
148 {}
const EdgeGrid::Grid & grid
Definition AvoidCrossingPerimeters.cpp:174
double max_distance_squared
Definition AvoidCrossingPerimeters.cpp:178
const Slic3r::Point center
Definition AvoidCrossingPerimeters.cpp:175

References center, grid, and max_distance_squared.

Member Function Documentation

◆ init()

void Slic3r::MinDistanceVisitor::init ( )
inline
151 {
152 this->closest_lines.clear();
153 this->closest_lines_set.clear();
154 }
std::unordered_set< std::pair< size_t, size_t >, boost::hash< std::pair< size_t, size_t > > > closest_lines_set
Definition AvoidCrossingPerimeters.cpp:177
std::vector< ClosestLine > closest_lines
Definition AvoidCrossingPerimeters.cpp:176

References closest_lines, and closest_lines_set.

◆ operator()()

bool Slic3r::MinDistanceVisitor::operator() ( coord_t iy,
coord_t ix )
inline
157 {
158 // Called with a row and column of the grid cell, which is inside a bounding box.
159 auto cell_data_range = grid.cell_data_range(iy, ix);
160 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++it_contour_and_segment) {
161 // End points of the line segment and their vector.
162 auto segment = grid.segment(*it_contour_and_segment);
163 Point closest_point;
164 if (closest_lines_set.find(*it_contour_and_segment) == closest_lines_set.end() &&
165 line_alg::distance_to_squared(Line(segment.first, segment.second), center, &closest_point) <= this->max_distance_squared) {
166 closest_lines.push_back({it_contour_and_segment->first, it_contour_and_segment->second, closest_point});
167 closest_lines_set.insert(*it_contour_and_segment);
168 }
169 }
170 // Continue traversing the grid along the edge.
171 return true;
172 }
void segment(CGALMesh &src, std::vector< CGALMesh > &dst, double smoothing_alpha=0.5, int segment_number=5)
Definition MeshBoolean.cpp:480
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
double distance_to_squared(const L &line, const Vec< Dim< L >, Scalar< L > > &point, Vec< Dim< L >, Scalar< L > > *nearest_point)
Definition Line.hpp:46

References center, closest_lines, closest_lines_set, Slic3r::line_alg::distance_to_squared(), and grid.

Here is the call graph for this function:

Member Data Documentation

◆ center

const Slic3r::Point Slic3r::MinDistanceVisitor::center

Referenced by MinDistanceVisitor(), and operator()().

◆ closest_lines

std::vector<ClosestLine> Slic3r::MinDistanceVisitor::closest_lines

◆ closest_lines_set

std::unordered_set<std::pair<size_t, size_t>, boost::hash<std::pair<size_t, size_t> > > Slic3r::MinDistanceVisitor::closest_lines_set

Referenced by init(), and operator()().

◆ grid

const EdgeGrid::Grid& Slic3r::MinDistanceVisitor::grid

Referenced by MinDistanceVisitor(), and operator()().

◆ max_distance_squared

double Slic3r::MinDistanceVisitor::max_distance_squared = std::numeric_limits<double>::max()

Referenced by MinDistanceVisitor().


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