OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::FillLightning Namespace Reference

Classes

struct  GeneratorDeleter
class  Filler
class  DistanceField
class  Generator
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 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 inside (const Polygons &polygons, const Point &p)
bool lineSegmentPolygonsIntersection (const Point &a, const Point &b, const EdgeGrid::Grid &outline_locator, Point &result, const coord_t within_max_dist)
coord_t locator_cell_size ()
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

Typedef Documentation

◆ GeneratorPtr

◆ NodeSPtr

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

◆ SparseNodeGrid

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

Function Documentation

◆ build_generator()

GeneratorPtr Slic3r::FillLightning::build_generator ( const PrintObject & print_object,
const std::function< void()> & throw_on_cancel_callback )
54{
55 return GeneratorPtr(new Generator(print_object, throw_on_cancel_callback));
56}
Definition Generator.hpp:42
std::unique_ptr< Generator, GeneratorDeleter > GeneratorPtr
Definition FillLightning.hpp:22

Referenced by Slic3r::PrintObject::prepare_lightning_infill_data().

Here is the caller graph for this function:

◆ get_extents() [1/2]

BoundingBox Slic3r::FillLightning::get_extents ( const NodeSPtr & root_node)
inline
296{
297 BoundingBox bbox;
298 for (const NodeSPtr &children : root_node->m_children)
299 bbox.merge(get_extents(children));
300 bbox.merge(root_node->getLocation());
301 return bbox;
302}
void merge(const PointType &point)
Definition BoundingBox.cpp:75
Definition BoundingBox.hpp:212
const Point & getLocation() const
Definition TreeNode.hpp:67
std::vector< NodeSPtr > m_children
Definition TreeNode.hpp:279
BoundingBox get_extents(const NodeSPtr &root_node)
Definition TreeNode.hpp:295
std::shared_ptr< Node > NodeSPtr
Definition Layer.hpp:25

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

Here is the caller graph for this function:

◆ get_extents() [2/2]

BoundingBox Slic3r::FillLightning::get_extents ( const std::vector< NodeSPtr > & tree_roots)
inline
305{
306 BoundingBox bbox;
307 for (const NodeSPtr &root_node : tree_roots)
308 bbox.merge(get_extents(root_node));
309 return bbox;
310}

◆ inside()

bool Slic3r::FillLightning::inside ( const Polygons & polygons,
const Point & p )
161{
162 return contains(polygons, p, true);
163}
bool contains(const std::vector< T > &vector, const Point &point)
Definition Geometry.cpp:55

References Slic3r::Geometry::contains().

Referenced by Slic3r::FillLightning::Node::realign().

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

◆ lineSegmentPolygonsIntersection()

bool Slic3r::FillLightning::lineSegmentPolygonsIntersection ( const Point & a,
const Point & b,
const EdgeGrid::Grid & outline_locator,
Point & result,
const coord_t within_max_dist )
166{
167 struct Visitor {
168 bool operator()(coord_t iy, coord_t ix) {
169 // Called with a row and colum of the grid cell, which is intersected by a line.
170 auto cell_data_range = grid.cell_data_range(iy, ix);
171 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++it_contour_and_segment) {
172 // End points of the line segment and their vector.
173 auto segment = grid.segment(*it_contour_and_segment);
174 if (Vec2d ip; Geometry::segment_segment_intersection(segment.first.cast<double>(), segment.second.cast<double>(), this->line_a, this->line_b, ip))
175 if (double d = (this->intersection_pt - this->line_b).squaredNorm(); d < d2min) {
176 this->d2min = d;
177 this->intersection_pt = ip;
178 }
179 }
180 // Continue traversing the grid along the edge.
181 return true;
182 }
183
184 const EdgeGrid::Grid& grid;
185 Vec2d line_a;
186 Vec2d line_b;
187 Vec2d intersection_pt;
188 double d2min { std::numeric_limits<double>::max() };
189 } visitor { outline_locator, a.cast<double>(), b.cast<double>() };
190
191 outline_locator.visit_cells_intersecting_line(a, b, visitor);
192 if (visitor.d2min < double(within_max_dist) * double(within_max_dist)) {
193 result = Point(visitor.intersection_pt);
194 return true;
195 }
196 return false;
197}
void visit_cells_intersecting_line(Slic3r::Point p1, Slic3r::Point p2, VISITOR &visitor) const
Definition EdgeGrid.hpp:184
int64_t coord_t
Definition libslic3r.h:48
bool segment_segment_intersection(const Vec2d &p1, const Vec2d &v1, const Vec2d &p2, const Vec2d &v2, Vec2d &res)
Definition Geometry.hpp:103
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
std::vector< ArithmeticOnly< T > > grid(const T &start, const T &stop, const T &stride)
A set of equidistant values starting from 'start' (inclusive), ending in the closest multiple of 'str...
Definition MTUtils.hpp:127
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67

References Slic3r::grid(), Slic3r::Geometry::segment_segment_intersection(), 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:

◆ locator_cell_size()

coord_t Slic3r::FillLightning::locator_cell_size ( )
inline
29{ return scaled<coord_t>(4.); }
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284

References Slic3r::scaled().

Referenced by Slic3r::FillLightning::Generator::generateTrees(), Slic3r::FillLightning::Generator::generateTreesforSupport(), Slic3r::FillLightning::Layer::getBestGroundingLocation(), and to_grid_point().

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

◆ polygonCollidesWithLineSegment()

bool Slic3r::FillLightning::polygonCollidesWithLineSegment ( const Point & from,
const Point & to,
const EdgeGrid::Grid & loc_to_line )
static
103{
104 struct Visitor {
105 explicit Visitor(const EdgeGrid::Grid &grid, const Line &line) : grid(grid), line(line) {}
106
107 bool operator()(coord_t iy, coord_t ix) {
108 // Called with a row and colum of the grid cell, which is intersected by a line.
109 auto cell_data_range = grid.cell_data_range(iy, ix);
110 for (auto it_contour_and_segment = cell_data_range.first; it_contour_and_segment != cell_data_range.second; ++ it_contour_and_segment) {
111 // End points of the line segment and their vector.
112 auto segment = grid.segment(*it_contour_and_segment);
113 if (Geometry::segments_intersect(segment.first, segment.second, line.a, line.b)) {
114 this->intersect = true;
115 return false;
116 }
117 }
118 // Continue traversing the grid along the edge.
119 return true;
120 }
121
122 const EdgeGrid::Grid& grid;
123 Line line;
124 bool intersect = false;
125 } visitor(loc_to_line, {from, to});
126
127 loc_to_line.visit_cells_intersecting_line(from, to, visitor);
128 return visitor.intersect;
129}
Definition EdgeGrid.hpp:104
Definition Line.hpp:156
bool segments_intersect(const Slic3r::Point &ip1, const Slic3r::Point &ip2, const Slic3r::Point &jp1, const Slic3r::Point &jp2)
Definition Geometry.hpp:134
void intersect(CGALMesh &A, CGALMesh &B)
Definition MeshBoolean.cpp:477

References Slic3r::Line::a, Slic3r::Line::b, Slic3r::grid(), Slic3r::Geometry::segments_intersect(), and Slic3r::EdgeGrid::Grid::visit_cells_intersecting_line().

Here is the call graph for this function:

◆ to_grid_point()

Point Slic3r::FillLightning::to_grid_point ( const Point & point,
const BoundingBox & bbox )
inlinestatic
45{
46 return (point - bbox.min) / locator_cell_size();
47}
PointType min
Definition BoundingBox.hpp:20
coord_t locator_cell_size()
Definition TreeNode.hpp:29

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 call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ radius_per_cell_size

coord_t Slic3r::FillLightning::radius_per_cell_size = 6
constexpr