Fixed another crash in Lightning infill.
This commit is contained in:
parent
4bde35cae3
commit
1582d019fb
@ -125,6 +125,8 @@ void Generator::generateTrees(const PrintObject &print_object, const std::functi
|
|||||||
if (const BoundingBox &outlines_locator_bbox = outlines_locator.bbox(); outlines_locator_bbox.defined)
|
if (const BoundingBox &outlines_locator_bbox = outlines_locator.bbox(); outlines_locator_bbox.defined)
|
||||||
below_outlines_bbox.merge(outlines_locator_bbox);
|
below_outlines_bbox.merge(outlines_locator_bbox);
|
||||||
|
|
||||||
|
below_outlines_bbox.merge(get_extents(current_lightning_layer.tree_roots).inflated(SCALED_EPSILON));
|
||||||
|
|
||||||
outlines_locator.set_bbox(below_outlines_bbox);
|
outlines_locator.set_bbox(below_outlines_bbox);
|
||||||
outlines_locator.create(below_outlines, locator_cell_size);
|
outlines_locator.create(below_outlines, locator_cell_size);
|
||||||
|
|
||||||
|
@ -269,6 +269,9 @@ protected:
|
|||||||
|
|
||||||
std::optional<Point> m_last_grounding_location; //<! The last known grounding location, see 'getLastGroundingLocation()'.
|
std::optional<Point> m_last_grounding_location; //<! The last known grounding location, see 'getLastGroundingLocation()'.
|
||||||
|
|
||||||
|
friend BoundingBox get_extents(const NodeSPtr &root_node);
|
||||||
|
friend BoundingBox get_extents(const std::vector<NodeSPtr> &tree_roots);
|
||||||
|
|
||||||
#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT
|
#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT
|
||||||
friend void export_to_svg(const NodeSPtr &root_node, Slic3r::SVG &svg);
|
friend void export_to_svg(const NodeSPtr &root_node, Slic3r::SVG &svg);
|
||||||
friend void export_to_svg(const std::string &path, const Polygons &contour, const std::vector<NodeSPtr> &root_nodes);
|
friend void export_to_svg(const std::string &path, const Polygons &contour, const std::vector<NodeSPtr> &root_nodes);
|
||||||
@ -278,6 +281,23 @@ protected:
|
|||||||
bool inside(const Polygons &polygons, const Point &p);
|
bool inside(const Polygons &polygons, const Point &p);
|
||||||
bool lineSegmentPolygonsIntersection(const Point& a, const Point& b, const EdgeGrid::Grid& outline_locator, Point& result, coord_t within_max_dist);
|
bool lineSegmentPolygonsIntersection(const Point& a, const Point& b, const EdgeGrid::Grid& outline_locator, Point& result, coord_t within_max_dist);
|
||||||
|
|
||||||
|
inline BoundingBox get_extents(const NodeSPtr &root_node)
|
||||||
|
{
|
||||||
|
BoundingBox bbox;
|
||||||
|
for (const NodeSPtr &children : root_node->m_children)
|
||||||
|
bbox.merge(get_extents(children));
|
||||||
|
bbox.merge(root_node->getLocation());
|
||||||
|
return bbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline BoundingBox get_extents(const std::vector<NodeSPtr> &tree_roots)
|
||||||
|
{
|
||||||
|
BoundingBox bbox;
|
||||||
|
for (const NodeSPtr &root_node : tree_roots)
|
||||||
|
bbox.merge(get_extents(root_node));
|
||||||
|
return bbox;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT
|
#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT
|
||||||
void export_to_svg(const NodeSPtr &root_node, SVG &svg);
|
void export_to_svg(const NodeSPtr &root_node, SVG &svg);
|
||||||
void export_to_svg(const std::string &path, const Polygons &contour, const std::vector<NodeSPtr> &root_nodes);
|
void export_to_svg(const std::string &path, const Polygons &contour, const std::vector<NodeSPtr> &root_nodes);
|
||||||
|
Loading…
Reference in New Issue
Block a user