Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::FillLightning Namespace Reference

Classes

class  DistanceField
 
class  Filler
 
class  Generator
 
struct  GeneratorDeleter
 
struct  GroundingLocation
 
class  Layer
 
class  Node
 

Typedefs

using GeneratorPtr = std::unique_ptr< Generator, GeneratorDeleter >
 
using NodeSPtr = std::shared_ptr< Node >
 
using SparseNodeGrid = std::unordered_multimap< Point, std::weak_ptr< Node >, PointHash >
 

Functions

GeneratorPtr build_generator (const PrintObject &print_object, const coordf_t fill_density, const std::function< void()> &throw_on_cancel_callback)
 
static Point to_grid_point (const Point &point, const BoundingBox &bbox)
 
static bool polygonCollidesWithLineSegment (const Point &from, const Point &to, const EdgeGrid::Grid &loc_to_line)
 
bool lineSegmentPolygonsIntersection (const Point &a, const Point &b, const EdgeGrid::Grid &outline_locator, Point &result, const coord_t within_max_dist)
 
bool inside (const Polygons &polygons, const Point &p)
 
BoundingBox get_extents (const NodeSPtr &root_node)
 
BoundingBox get_extents (const std::vector< NodeSPtr > &tree_roots)
 

Variables

constexpr coord_t radius_per_cell_size = 6
 
constexpr auto locator_cell_size = scaled<coord_t>(4.)
 

Typedef Documentation

◆ GeneratorPtr

◆ NodeSPtr

typedef std::shared_ptr< Node > Slic3r::FillLightning::NodeSPtr

◆ SparseNodeGrid

using Slic3r::FillLightning::SparseNodeGrid = typedef std::unordered_multimap<Point, std::weak_ptr<Node>, PointHash>

Function Documentation

◆ build_generator()

GeneratorPtr Slic3r::FillLightning::build_generator ( const PrintObject print_object,
const coordf_t  fill_density,
const std::function< void()> &  throw_on_cancel_callback 
)
30{
31 return GeneratorPtr(new Generator(print_object, fill_density, throw_on_cancel_callback));
32}
Definition Generator.hpp:38
std::unique_ptr< Generator, GeneratorDeleter > GeneratorPtr
Definition FillLightning.hpp:15

References Slic3r::fill_density().

+ Here is the call graph for this function:

◆ get_extents() [1/2]

BoundingBox Slic3r::FillLightning::get_extents ( const NodeSPtr root_node)
inline
285{
286 BoundingBox bbox;
287 for (const NodeSPtr &children : root_node->m_children)
288 bbox.merge(get_extents(children));
289 bbox.merge(root_node->getLocation());
290 return bbox;
291}
void merge(const PointType &point)
Definition BoundingBox.cpp:62
Definition BoundingBox.hpp:181
std::shared_ptr< Node > NodeSPtr
Definition Layer.hpp:20
BoundingBox get_extents(const ExPolygon &expolygon)
Definition ExPolygon.cpp:352

Referenced by Slic3r::FillLightning::DistanceField::DistanceField(), and Slic3r::FillLightning::Generator::generateTrees().

+ Here is the caller graph for this function:

◆ get_extents() [2/2]

BoundingBox Slic3r::FillLightning::get_extents ( const std::vector< NodeSPtr > &  tree_roots)
inline
294{
295 BoundingBox bbox;
296 for (const NodeSPtr &root_node : tree_roots)
297 bbox.merge(get_extents(root_node));
298 return bbox;
299}

◆ inside()

bool Slic3r::FillLightning::inside ( const Polygons polygons,
const Point p 
)

◆ lineSegmentPolygonsIntersection()

bool Slic3r::FillLightning::lineSegmentPolygonsIntersection ( const Point a,
const Point b,
const EdgeGrid::Grid outline_locator,
Point result,
const coord_t  within_max_dist 
)
145{
146 struct Visitor {
147 bool operator()(coord_t iy, coord_t ix) {
148 // Called with a row and colum of the grid cell, which is intersected by a line.
149 auto cell_data_range = grid.cell_data_range(iy, ix);
150 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++it_contour_and_segment) {
151 // End points of the line segment and their vector.
152 auto segment = grid.segment(*it_contour_and_segment);
153 if (Vec2d ip; Geometry::segment_segment_intersection(segment.first.cast<double>(), segment.second.cast<double>(), this->line_a, this->line_b, ip))
154 if (double d = (this->intersection_pt - this->line_b).squaredNorm(); d < d2min) {
155 this->d2min = d;
156 this->intersection_pt = ip;
157 }
158 }
159 // Continue traversing the grid along the edge.
160 return true;
161 }
162
163 const EdgeGrid::Grid& grid;
164 Vec2d line_a;
165 Vec2d line_b;
166 Vec2d intersection_pt;
167 double d2min { std::numeric_limits<double>::max() };
168 } visitor { outline_locator, a.cast<double>(), b.cast<double>() };
169
170 outline_locator.visit_cells_intersecting_line(a, b, visitor);
171 if (visitor.d2min < double(within_max_dist) * double(within_max_dist)) {
172 result = Point(visitor.intersection_pt);
173 return true;
174 }
175 return false;
176}
EIGEN_DEVICE_FUNC SegmentReturnType segment(Index start, Index n)
This is the const version of segment(Index,Index).
Definition BlockMethods.h:888
void visit_cells_intersecting_line(Slic3r::Point p1, Slic3r::Point p2, VISITOR &visitor) const
Definition EdgeGrid.hpp:172
int32_t coord_t
Definition libslic3r.h:39
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:51
IGL_INLINE void grid(const Eigen::MatrixBase< Derivedres > &res, Eigen::PlainObjectBase< DerivedGV > &GV)
Definition grid.cpp:13
Kernel::Point_2 Point
Definition point_areas.cpp:20

References segment(), and Slic3r::EdgeGrid::Grid::visit_cells_intersecting_line().

Referenced by Slic3r::FillLightning::Layer::reconnectRoots().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ polygonCollidesWithLineSegment()

static bool Slic3r::FillLightning::polygonCollidesWithLineSegment ( const Point from,
const Point to,
const EdgeGrid::Grid loc_to_line 
)
static
89{
90 struct Visitor {
91 explicit Visitor(const EdgeGrid::Grid &grid, const Line &line) : grid(grid), line(line) {}
92
93 bool operator()(coord_t iy, coord_t ix) {
94 // Called with a row and colum of the grid cell, which is intersected by a line.
95 auto cell_data_range = grid.cell_data_range(iy, ix);
96 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++ it_contour_and_segment) {
97 // End points of the line segment and their vector.
98 auto segment = grid.segment(*it_contour_and_segment);
99 if (Geometry::segments_intersect(segment.first, segment.second, line.a, line.b)) {
100 this->intersect = true;
101 return false;
102 }
103 }
104 // Continue traversing the grid along the edge.
105 return true;
106 }
107
108 const EdgeGrid::Grid& grid;
109 Line line;
110 bool intersect = false;
111 } visitor(loc_to_line, {from, to});
112
113 loc_to_line.visit_cells_intersecting_line(from, to, visitor);
114 return visitor.intersect;
115}
Definition EdgeGrid.hpp:92
Definition Line.hpp:155
IGL_INLINE void intersect(const M &A, const M &B, M &C)
Definition intersect.cpp:10

References Slic3r::Line::a, Slic3r::Line::b, segment(), and Slic3r::EdgeGrid::Grid::visit_cells_intersecting_line().

+ Here is the call graph for this function:

◆ to_grid_point()

static Point Slic3r::FillLightning::to_grid_point ( const Point point,
const BoundingBox bbox 
)
inlinestatic
31{
32 return (point - bbox.min) / locator_cell_size;
33}
PointType min
Definition BoundingBox.hpp:16
constexpr auto locator_cell_size
Definition TreeNode.hpp:21

References locator_cell_size, and Slic3r::BoundingBoxBase< PointType, APointsType >::min.

Referenced by Slic3r::FillLightning::Layer::fillLocator(), Slic3r::FillLightning::Layer::generateNewTrees(), Slic3r::FillLightning::Layer::getBestGroundingLocation(), and Slic3r::FillLightning::Layer::reconnectRoots().

+ Here is the caller graph for this function:

Variable Documentation

◆ locator_cell_size

constexpr auto Slic3r::FillLightning::locator_cell_size = scaled<coord_t>(4.)
constexpr

◆ radius_per_cell_size

constexpr coord_t Slic3r::FillLightning::radius_per_cell_size = 6
constexpr