OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ExPolygon Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/ExPolygon.hpp>

Collaboration diagram for Slic3r::ExPolygon:

Public Member Functions

 ExPolygon ()=default
 ExPolygon (const ExPolygon &other)=default
 ExPolygon (ExPolygon &&other)=default
 ExPolygon (const Polygon &contour)
 ExPolygon (Polygon &&contour)
 ExPolygon (const Points &contour)
 ExPolygon (Points &&contour)
 ExPolygon (const Polygon &contour, const Polygon &hole)
 ExPolygon (Polygon &&contour, Polygon &&hole)
 ExPolygon (const Points &contour, const Points &hole)
 ExPolygon (Points &&contour, Polygon &&hole)
 ExPolygon (std::initializer_list< Point > contour)
 ExPolygon (std::initializer_list< Point > contour, std::initializer_list< Point > hole)
ExPolygon & operator= (const ExPolygon &other)=default
ExPolygon & operator= (ExPolygon &&other)=default
void clear ()
void scale (double factor)
void scale (double factor_x, double factor_y)
void translate (double x, double y)
void translate (const Point &vector)
void rotate (double angle)
void rotate (double angle, const Point &center)
double area () const
bool empty () const
bool is_valid () const
void douglas_peucker (double tolerance)
bool contains (const Line &line) const
bool contains (const Polyline &polyline) const
bool contains (const Polylines &polylines) const
bool contains (const Point &point, bool border_result=true) const
bool on_boundary (const Point &point, double eps) const
Point point_projection (const Point &point) const
void symmetric_y (const coord_t &y_axis)
bool overlaps (const ExPolygon &other) const
void simplify_p (double tolerance, Polygons *polygons) const
Polygons simplify_p (double tolerance) const
ExPolygons simplify (double tolerance) const
void simplify (double tolerance, ExPolygons *expolygons) const
void medial_axis (double min_width, double max_width, ThickPolylines *polylines) const
void medial_axis (double min_width, double max_width, Polylines *polylines) const
Polylines medial_axis (double min_width, double max_width) const
Lines lines () const
size_t num_contours () const
Polygon & contour_or_hole (size_t idx)
const Polygon & contour_or_hole (size_t idx) const

Public Attributes

Polygon contour
Polygons holes

Detailed Description

Constructor & Destructor Documentation

◆ ExPolygon() [1/13]

Slic3r::ExPolygon::ExPolygon ( )
default

Referenced by ExPolygon(), ExPolygon(), operator=(), operator=(), and overlaps().

Here is the caller graph for this function:

◆ ExPolygon() [2/13]

Slic3r::ExPolygon::ExPolygon ( const ExPolygon & other)
default

References ExPolygon().

Here is the call graph for this function:

◆ ExPolygon() [3/13]

Slic3r::ExPolygon::ExPolygon ( ExPolygon && other)
default

References ExPolygon().

Here is the call graph for this function:

◆ ExPolygon() [4/13]

Slic3r::ExPolygon::ExPolygon ( const Polygon & contour)
inlineexplicit
28: contour(contour) {}
Polygon contour
Definition ExPolygon.hpp:42

References contour.

◆ ExPolygon() [5/13]

Slic3r::ExPolygon::ExPolygon ( Polygon && contour)
inlineexplicit
29: contour(std::move(contour)) {}

References contour.

◆ ExPolygon() [6/13]

Slic3r::ExPolygon::ExPolygon ( const Points & contour)
inlineexplicit
30: contour(contour) {}

References contour.

◆ ExPolygon() [7/13]

Slic3r::ExPolygon::ExPolygon ( Points && contour)
inlineexplicit
31: contour(std::move(contour)) {}

References contour.

◆ ExPolygon() [8/13]

Slic3r::ExPolygon::ExPolygon ( const Polygon & contour,
const Polygon & hole )
inlineexplicit
32: contour(contour) { holes.emplace_back(hole); }
Polygons holes
Definition ExPolygon.hpp:43

References contour, and holes.

◆ ExPolygon() [9/13]

Slic3r::ExPolygon::ExPolygon ( Polygon && contour,
Polygon && hole )
inlineexplicit
33: contour(std::move(contour)) { holes.emplace_back(std::move(hole)); }

References contour, and holes.

◆ ExPolygon() [10/13]

Slic3r::ExPolygon::ExPolygon ( const Points & contour,
const Points & hole )
inlineexplicit
34: contour(contour) { holes.emplace_back(hole); }

References contour, and holes.

◆ ExPolygon() [11/13]

Slic3r::ExPolygon::ExPolygon ( Points && contour,
Polygon && hole )
inlineexplicit
35: contour(std::move(contour)) { holes.emplace_back(std::move(hole)); }

References contour, and holes.

◆ ExPolygon() [12/13]

Slic3r::ExPolygon::ExPolygon ( std::initializer_list< Point > contour)
inline
36: contour(contour) {}

References contour.

◆ ExPolygon() [13/13]

Slic3r::ExPolygon::ExPolygon ( std::initializer_list< Point > contour,
std::initializer_list< Point > hole )
inline
37: contour(contour), holes({ hole }) {}

References contour, and holes.

Member Function Documentation

◆ area()

double Slic3r::ExPolygon::area ( ) const
59{
60 double a = this->contour.area();
61 for (const Polygon &hole : holes)
62 a -= - hole.area(); // holes have negative area
63 return a;
64}

References contour, and holes.

Referenced by Slic3r::Surface::area(), Slic3r::detect_overhangs(), Slic3r::elephant_foot_compensation(), and Slic3r::tree_supports_generate_paths().

Here is the caller graph for this function:

◆ clear()

void Slic3r::ExPolygon::clear ( )
inline
45{ contour.points.clear(); holes.clear(); }

References contour, and holes.

◆ contains() [1/4]

bool Slic3r::ExPolygon::contains ( const Line & line) const
83{
84 return this->contains(Polyline(line.a, line.b));
85}
bool contains(const Line &line) const
Definition ExPolygon.cpp:82

References Slic3r::Line::a, Slic3r::Line::b, and contains().

Referenced by Slic3r::FillLine::_fill_surface_single(), contains(), Slic3r::generate_spiral_insets(), Slic3r::is_inside_ex(), Slic3r::GUI::MeshClipper::is_projection_inside_cut(), Slic3r::GCode::needs_retraction(), and overlaps().

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

◆ contains() [2/4]

bool Slic3r::ExPolygon::contains ( const Point & point,
bool border_result = true ) const
116{
117 if (! Slic3r::contains(contour, point, border_result))
118 // Outside the outer contour, not on the contour boundary.
119 return false;
120 for (const Polygon &hole : this->holes)
121 if (Slic3r::contains(hole, point, ! border_result))
122 // Inside a hole, not on the hole boundary.
123 return false;
124 return true;
125}
bool contains(const std::vector< T > &vector, const Point &point)
Definition Geometry.cpp:55

References Slic3r::Geometry::contains(), contour, and holes.

Here is the call graph for this function:

◆ contains() [3/4]

bool Slic3r::ExPolygon::contains ( const Polyline & polyline) const
88{
89 BoundingBox bbox1 = get_extents(*this);
90 BoundingBox bbox2 = get_extents(polyline);
91 bbox2.inflated(1);
92 if (!bbox1.overlap(bbox2))
93 return false;
94
95 return diff_pl(polyline, *this).empty();
96}
Slic3r::Polylines diff_pl(const Slic3r::Polyline &subject, const Slic3r::Polygons &clip)
Definition ClipperUtils.cpp:1099
BoundingBox get_extents(const ExPolygonsWithIds &e)
Definition Emboss.cpp:1374

References Slic3r::diff_pl(), Slic3r::get_extents(), Slic3r::BoundingBox::inflated(), and Slic3r::BoundingBoxBase< PointType, APointsType >::overlap().

Here is the call graph for this function:

◆ contains() [4/4]

bool Slic3r::ExPolygon::contains ( const Polylines & polylines) const
99{
100 #if 0
101 BoundingBox bbox = get_extents(polylines);
102 bbox.merge(get_extents(*this));
103 SVG svg(debug_out_path("ExPolygon_contains.svg"), bbox);
104 svg.draw(*this);
105 svg.draw_outline(*this);
106 svg.draw(polylines, "blue");
107 #endif
108 Polylines pl_out = diff_pl(polylines, *this);
109 #if 0
110 svg.draw(pl_out, "red");
111 #endif
112 return pl_out.empty();
113}
std::string debug_out_path(const char *name,...)
Definition utils.cpp:382
std::vector< Polyline > Polylines
Definition Polyline.hpp:22

References Slic3r::debug_out_path(), Slic3r::diff_pl(), Slic3r::SVG::draw(), Slic3r::SVG::draw_outline(), Slic3r::get_extents(), and Slic3r::BoundingBoxBase< PointType, APointsType >::merge().

Here is the call graph for this function:

◆ contour_or_hole() [1/2]

Polygon & Slic3r::ExPolygon::contour_or_hole ( size_t idx)
inline
88{ return (idx == 0) ? this->contour : this->holes[idx - 1]; }

Referenced by Slic3r::Algorithm::expolygons_to_zpaths_expanded_opened(), point_projection(), and Slic3r::tree_supports_generate_paths().

Here is the caller graph for this function:

◆ contour_or_hole() [2/2]

const Polygon & Slic3r::ExPolygon::contour_or_hole ( size_t idx) const
inline
89{ return (idx == 0) ? this->contour : this->holes[idx - 1]; }

◆ douglas_peucker()

void Slic3r::ExPolygon::douglas_peucker ( double tolerance)
76{
77 this->contour.douglas_peucker(tolerance);
78 for (Polygon &poly : this->holes)
79 poly.douglas_peucker(tolerance);
80}
void poly(std::vector< std::pair< Vec2d, Vec2d > > &out, std::initializer_list< Vec2d > p)
Definition DesignSketchTool.cpp:7751

References contour, and holes.

Referenced by Slic3r::applyNegtiveVolumes().

Here is the caller graph for this function:

◆ empty()

bool Slic3r::ExPolygon::empty ( ) const
inline
53{ return contour.points.empty(); }

References contour.

Referenced by Slic3r::sla::anonymous_namespace{Pad.cpp}::add_cavity(), Slic3r::avoid_object_remove_extra_small_parts(), Slic3r::sla::anonymous_namespace{Pad.cpp}::create_outer_pad_geometry(), and overlaps().

Here is the caller graph for this function:

◆ is_valid()

bool Slic3r::ExPolygon::is_valid ( ) const
67{
68 if (!this->contour.is_valid() || !this->contour.is_counter_clockwise()) return false;
69 for (Polygons::const_iterator it = this->holes.begin(); it != this->holes.end(); ++it) {
70 if (!(*it).is_valid() || (*it).is_counter_clockwise()) return false;
71 }
72 return true;
73}

References contour, and holes.

◆ lines()

Lines Slic3r::ExPolygon::lines ( ) const
389{
390 Lines lines = this->contour.lines();
391 for (Polygons::const_iterator h = this->holes.begin(); h != this->holes.end(); ++h) {
392 Lines hole_lines = h->lines();
393 lines.insert(lines.end(), hole_lines.begin(), hole_lines.end());
394 }
395 return lines;
396}
Lines lines() const
Definition ExPolygon.cpp:388
std::vector< Line > Lines
Definition Line.hpp:20

References contour, holes, and lines().

Referenced by Slic3r::LayerRegion::export_region_slices_to_svg(), and lines().

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

◆ medial_axis() [1/3]

Polylines Slic3r::ExPolygon::medial_axis ( double min_width,
double max_width ) const
inline
83 { Polylines out; this->medial_axis(min_width, max_width, &out); return out; }
void medial_axis(double min_width, double max_width, ThickPolylines *polylines) const
Definition ExPolygon.cpp:269

References medial_axis().

Here is the call graph for this function:

◆ medial_axis() [2/3]

void Slic3r::ExPolygon::medial_axis ( double min_width,
double max_width,
Polylines * polylines ) const
380{
382 this->medial_axis(min_width, max_width, &tp);
383 polylines->reserve(polylines->size() + tp.size());
384 for (auto &pl : tp)
385 polylines->emplace_back(pl.points);
386}
std::vector< ThickPolyline > ThickPolylines
Definition Polyline.hpp:23

References medial_axis().

Here is the call graph for this function:

◆ medial_axis() [3/3]

void Slic3r::ExPolygon::medial_axis ( double min_width,
double max_width,
ThickPolylines * polylines ) const
270{
271 // init helper object
272 Slic3r::Geometry::MedialAxis ma(min_width, max_width, *this);
273
274 // compute the Voronoi diagram and extract medial axis polylines
276 ma.build(&pp);
277
278 /*
279 SVG svg("medial_axis.svg");
280 svg.draw(*this);
281 svg.draw(pp);
282 svg.Close();
283 */
284
285 /* Find the maximum width returned; we're going to use this for validating and
286 filtering the output segments. */
287 double max_w = 0;
288 for (ThickPolylines::const_iterator it = pp.begin(); it != pp.end(); ++it)
289 max_w = fmaxf(max_w, *std::max_element(it->width.begin(), it->width.end()));
290
291 /* Loop through all returned polylines in order to extend their endpoints to the
292 expolygon boundaries */
293 bool removed = false;
294 for (size_t i = 0; i < pp.size(); ++i) {
295 ThickPolyline& polyline = pp[i];
296
297 // extend initial and final segments of each polyline if they're actual endpoints
298 /* We assign new endpoints to temporary variables because in case of a single-line
299 polyline, after we extend the start point it will be caught by the intersection()
300 call, so we keep the inner point until we perform the second intersection() as well */
301 Point new_front = polyline.points.front();
302 Point new_back = polyline.points.back();
303 if (polyline.endpoints.first && !this->on_boundary(new_front, SCALED_EPSILON)) {
304 Vec2d p1 = polyline.points.front().cast<double>();
305 Vec2d p2 = polyline.points[1].cast<double>();
306 // prevent the line from touching on the other side, otherwise intersection() might return that solution
307 if (polyline.points.size() == 2)
308 p2 = (p1 + p2) * 0.5;
309 // Extend the start of the segment.
310 p1 -= (p2 - p1).normalized() * max_width;
311 this->contour.intersection(Line(p1.cast<coord_t>(), p2.cast<coord_t>()), &new_front);
312 }
313 if (polyline.endpoints.second && !this->on_boundary(new_back, SCALED_EPSILON)) {
314 Vec2d p1 = (polyline.points.end() - 2)->cast<double>();
315 Vec2d p2 = polyline.points.back().cast<double>();
316 // prevent the line from touching on the other side, otherwise intersection() might return that solution
317 if (polyline.points.size() == 2)
318 p1 = (p1 + p2) * 0.5;
319 // Extend the start of the segment.
320 p2 += (p2 - p1).normalized() * max_width;
321 this->contour.intersection(Line(p1.cast<coord_t>(), p2.cast<coord_t>()), &new_back);
322 }
323 polyline.points.front() = new_front;
324 polyline.points.back() = new_back;
325
326 /* remove too short polylines
327 (we can't do this check before endpoints extension and clipping because we don't
328 know how long will the endpoints be extended since it depends on polygon thickness
329 which is variable - extension will be <= max_width/2 on each side) */
330 if ((polyline.endpoints.first || polyline.endpoints.second)
331 && polyline.length() < max_w*2) {
332 pp.erase(pp.begin() + i);
333 --i;
334 removed = true;
335 continue;
336 }
337 }
338
339 /* If we removed any short polylines we now try to connect consecutive polylines
340 in order to allow loop detection. Note that this algorithm is greedier than
341 MedialAxis::process_edge_neighbors() as it will connect random pairs of
342 polylines even when more than two start from the same point. This has no
343 drawbacks since we optimize later using nearest-neighbor which would do the
344 same, but should we use a more sophisticated optimization algorithm we should
345 not connect polylines when more than two meet. */
346 if (removed) {
347 for (size_t i = 0; i < pp.size(); ++i) {
348 ThickPolyline& polyline = pp[i];
349 if (polyline.endpoints.first && polyline.endpoints.second) continue; // optimization
350
351 // find another polyline starting here
352 for (size_t j = i+1; j < pp.size(); ++j) {
353 ThickPolyline& other = pp[j];
354 if (polyline.last_point() == other.last_point()) {
355 other.reverse();
356 } else if (polyline.first_point() == other.last_point()) {
357 polyline.reverse();
358 other.reverse();
359 } else if (polyline.first_point() == other.first_point()) {
360 polyline.reverse();
361 } else if (polyline.last_point() != other.first_point()) {
362 continue;
363 }
364
365 polyline.points.insert(polyline.points.end(), other.points.begin() + 1, other.points.end());
366 polyline.width.insert(polyline.width.end(), other.width.begin(), other.width.end());
367 polyline.endpoints.second = other.endpoints.second;
368 assert(polyline.width.size() == polyline.points.size()*2 - 2);
369
370 pp.erase(pp.begin() + j);
371 j = i; // restart search from i+1
372 }
373 }
374 }
375
376 polylines->insert(polylines->end(), pp.begin(), pp.end());
377}
#define SCALED_EPSILON
Definition libslic3r.h:109
int64_t coord_t
Definition libslic3r.h:48
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67

References Slic3r::Geometry::MedialAxis::build(), contour, Slic3r::ThickPolyline::endpoints, Slic3r::MultiPoint::first_point(), Slic3r::Polyline::last_point(), Slic3r::MultiPoint::length(), Slic3r::MultiPoint::points, Slic3r::ThickPolyline::reverse(), SCALED_EPSILON, and Slic3r::ThickPolyline::width.

Referenced by medial_axis(), and medial_axis().

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

◆ num_contours()

size_t Slic3r::ExPolygon::num_contours ( ) const
inline
87{ return this->holes.size() + 1; }

Referenced by Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox(), Slic3r::Algorithm::expolygons_to_zpaths_expanded_opened(), point_projection(), and Slic3r::tree_supports_generate_paths().

Here is the caller graph for this function:

◆ on_boundary()

bool Slic3r::ExPolygon::on_boundary ( const Point & point,
double eps ) const
128{
129 if (this->contour.on_boundary(point, eps))
130 return true;
131 for (const Polygon &hole : this->holes)
132 if (hole.on_boundary(point, eps))
133 return true;
134 return false;
135}

References contour, and holes.

◆ operator=() [1/2]

ExPolygon & Slic3r::ExPolygon::operator= ( const ExPolygon & other)
default

References ExPolygon().

Here is the call graph for this function:

◆ operator=() [2/2]

ExPolygon & Slic3r::ExPolygon::operator= ( ExPolygon && other)
default

References ExPolygon().

Here is the call graph for this function:

◆ overlaps()

bool Slic3r::ExPolygon::overlaps ( const ExPolygon & other) const
165{
166 if (this->empty() || other.empty())
167 return false;
168
169 #if 0
170 BoundingBox bbox = get_extents(other);
171 bbox.merge(get_extents(*this));
172 static int iRun = 0;
173 SVG svg(debug_out_path("ExPolygon_overlaps-%d.svg", iRun ++), bbox);
174 svg.draw(*this);
175 svg.draw_outline(*this);
176 svg.draw_outline(other, "blue");
177 #endif
178
179 Polylines pl_out = intersection_pl(to_polylines(other), *this);
180
181 #if 0
182 svg.draw(pl_out, "red");
183 #endif
184
185 // See unit test SCENARIO("Clipper diff with polyline", "[Clipper]")
186 // for in which case the intersection_pl produces any intersection.
187 return ! pl_out.empty() ||
188 // If *this is completely inside other, then pl_out is empty, but the expolygons overlap. Test for that situation.
189 other.contains(this->contour.points.front());
190}
bool empty() const
Definition ExPolygon.hpp:53
Polylines to_polylines(const ExPolygon &src)
Definition ExPolygon.hpp:235
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip)
Definition ClipperUtils.cpp:1111

References ExPolygon(), contains(), contour, Slic3r::debug_out_path(), Slic3r::SVG::draw(), Slic3r::SVG::draw_outline(), empty(), Slic3r::get_extents(), Slic3r::intersection_pl(), Slic3r::BoundingBoxBase< PointType, APointsType >::merge(), and Slic3r::to_polylines().

Referenced by Slic3r::sla::SupportPointGenerator::Structure::overlaps().

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

◆ point_projection()

Point Slic3r::ExPolygon::point_projection ( const Point & point) const
139{
140 if (this->holes.empty()) {
141 return this->contour.point_projection(point);
142 } else {
143 double dist_min2 = std::numeric_limits<double>::max();
144 Point closest_pt_min;
145 for (size_t i = 0; i < this->num_contours(); ++ i) {
146 Point closest_pt = this->contour_or_hole(i).point_projection(point);
147 double d2 = (closest_pt - point).cast<double>().squaredNorm();
148 if (d2 < dist_min2) {
149 dist_min2 = d2;
150 closest_pt_min = closest_pt;
151 }
152 }
153 return closest_pt_min;
154 }
155}
size_t num_contours() const
Definition ExPolygon.hpp:87
Polygon & contour_or_hole(size_t idx)
Definition ExPolygon.hpp:88
Point point_projection(const Point &point) const
Definition Polygon.cpp:334
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299

References Slic3r::cast(), contour, contour_or_hole(), holes, num_contours(), and Slic3r::Polygon::point_projection().

Here is the call graph for this function:

◆ rotate() [1/2]

void Slic3r::ExPolygon::rotate ( double angle)
45{
46 contour.rotate(angle);
47 for (Polygon &hole : holes)
48 hole.rotate(angle);
49}
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

References Slic3r::angle(), contour, and holes.

Referenced by Slic3r::Fill3DHoneycomb::_fill_surface_single(), Slic3r::FillCrossHatch::_fill_surface_single(), Slic3r::FillGyroid::_fill_surface_single(), Slic3r::FillLine::_fill_surface_single(), Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::FillTpmsD::_fill_surface_single(), Slic3r::FillTpmsFK::_fill_surface_single(), Slic3r::FillRectilinear::fill_surface_trapezoidal(), and Slic3r::arrangement::ArrangePolygon::transformed_poly().

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

◆ rotate() [2/2]

void Slic3r::ExPolygon::rotate ( double angle,
const Point & center )
52{
53 contour.rotate(angle, center);
54 for (Polygon &hole : holes)
55 hole.rotate(angle, center);
56}
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382

References Slic3r::angle(), Slic3r::center(), contour, and holes.

Here is the call graph for this function:

◆ scale() [1/2]

void Slic3r::ExPolygon::scale ( double factor)
24{
25 contour.scale(factor);
26 for (Polygon &hole : holes)
27 hole.scale(factor);
28}

References contour, and holes.

Referenced by Slic3r::GUI::MeshClipper::recalculate_triangles().

Here is the caller graph for this function:

◆ scale() [2/2]

void Slic3r::ExPolygon::scale ( double factor_x,
double factor_y )
31{
32 contour.scale(factor_x, factor_y);
33 for (Polygon &hole : holes)
34 hole.scale(factor_x, factor_y);
35}

References contour, and holes.

◆ simplify() [1/2]

ExPolygons Slic3r::ExPolygon::simplify ( double tolerance) const
260{
261 return union_ex(this->simplify_p(tolerance));
262}
void simplify_p(double tolerance, Polygons *polygons) const
Definition ExPolygon.cpp:231
Slic3r::ExPolygons union_ex(const Slic3r::Polygons &subject, PolyFillType fill_type)
Definition ClipperUtils.cpp:1011

References simplify_p(), and Slic3r::union_ex().

Referenced by Slic3r::elephant_foot_compensation(), and simplify().

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

◆ simplify() [2/2]

void Slic3r::ExPolygon::simplify ( double tolerance,
ExPolygons * expolygons ) const
265{
266 append(*expolygons, this->simplify(tolerance));
267}
ExPolygons simplify(double tolerance) const
Definition ExPolygon.cpp:259
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157

References Slic3r::append(), and simplify().

Here is the call graph for this function:

◆ simplify_p() [1/2]

Polygons Slic3r::ExPolygon::simplify_p ( double tolerance) const
238{
239 Polygons pp;
240 pp.reserve(this->holes.size() + 1);
241 // contour
242 {
243 Polygon p = this->contour;
244 p.points.push_back(p.points.front());
245 p.points = MultiPoint::_douglas_peucker(p.points, tolerance);
246 p.points.pop_back();
247 pp.emplace_back(std::move(p));
248 }
249 // holes
250 for (Polygon p : this->holes) {
251 p.points.push_back(p.points.front());
252 p.points = MultiPoint::_douglas_peucker(p.points, tolerance);
253 p.points.pop_back();
254 pp.emplace_back(std::move(p));
255 }
256 return simplify_polygons(pp);
257}
static Points _douglas_peucker(const Points &points, const double tolerance)
Definition MultiPoint.cpp:175
Polygons simplify_polygons(const Polygons &subject)
Definition ClipperUtils.cpp:1303
std::vector< Polygon, PointsAllocator< Polygon > > Polygons
Definition Polygon.hpp:22
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References Slic3r::MultiPoint::_douglas_peucker(), contour, holes, Slic3r::MultiPoint::points, and Slic3r::simplify_polygons().

Here is the call graph for this function:

◆ simplify_p() [2/2]

void Slic3r::ExPolygon::simplify_p ( double tolerance,
Polygons * polygons ) const
232{
233 Polygons pp = this->simplify_p(tolerance);
234 polygons->insert(polygons->end(), pp.begin(), pp.end());
235}

References simplify_p().

Referenced by Slic3r::PerimeterGenerator::process_classic(), simplify(), and simplify_p().

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

◆ symmetric_y()

void Slic3r::ExPolygon::symmetric_y ( const coord_t & y_axis)
158{
159 this->contour.symmetric_y(y_axis);
160 for (Polygon &hole : holes)
161 hole.symmetric_y(y_axis);
162}

References contour, and holes.

Referenced by Slic3r::Layer::make_fills().

Here is the caller graph for this function:

◆ translate() [1/2]

void Slic3r::ExPolygon::translate ( const Point & vector)
38{
39 contour.translate(p);
40 for (Polygon &hole : holes)
41 hole.translate(p);
42}

References contour, and holes.

◆ translate() [2/2]

void Slic3r::ExPolygon::translate ( double x,
double y )
inline
48{ this->translate(Point(coord_t(x), coord_t(y))); }
void translate(double x, double y)
Definition ExPolygon.hpp:48

References translate().

Referenced by Slic3r::FillPlanePath::_fill_surface_single(), anonymous_namespace{Emboss.cpp}::align_shape(), Slic3r::GUI::GLGizmoBrimEars::make_polygon(), Slic3r::GCode::needs_retraction(), Slic3r::arrangement::ArrangePolygon::transformed_poly(), translate(), Slic3r::VoxelUtils::walkAreas(), Slic3r::VoxelUtils::walkDilatedAreas(), and Slic3r::VoxelUtils::walkDilatedPolygons().

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

Member Data Documentation

◆ contour

Polygon Slic3r::ExPolygon::contour

Referenced by ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), Slic3r::Fill3DHoneycomb::_fill_surface_single(), Slic3r::FillConcentric::_fill_surface_single(), Slic3r::FillConcentric::_fill_surface_single(), Slic3r::FillCrossHatch::_fill_surface_single(), Slic3r::FillGyroid::_fill_surface_single(), Slic3r::FillHoneycomb::_fill_surface_single(), Slic3r::FillLine::_fill_surface_single(), Slic3r::FillSpiralInset::_fill_surface_single(), Slic3r::FillSpiralInset::_fill_surface_single(), Slic3r::FillTpmsD::_fill_surface_single(), Slic3r::FillTpmsFK::_fill_surface_single(), Slic3r::Fill::_infill_direction(), Slic3r::Print::_make_skirt(), Slic3r::sla::anonymous_namespace{Pad.cpp}::add_cavity(), Slic3r::ImexArranger::add_keep_outs(), area(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::begin_points(), Slic3r::anonymous_namespace{ClipperUtils.cpp}::c2_offset_expolygons(), Slic3r::GUI::PartPlate::calc_imex_zones(), clear(), Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox(), Slic3r::TimelapsePosPicker::collect_object_slices_data(), Slic3r::collect_slices_outer(), Slic3r::compSecondMoment(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), contains(), Slic3r::contour(), Slic3r::contour_distance(), Slic3r::contour_distance2(), Slic3r::count_points(), Slic3r::EdgeGrid::Grid::create(), Slic3r::sla::anonymous_namespace{Pad.cpp}::create_outer_pad_geometry(), Slic3r::ImexArranger::crosses_keep_out(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::detour_around_obstacle(), Slic3r::Emboss::divide_segments_for_close_point(), douglas_peucker(), Slic3r::SVG::draw_outline(), Slic3r::draw_perimeters(), Slic3r::elephant_foot_compensation(), empty(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::end_points(), Slic3r::GUI::PartPlate::estimate_wipe_tower_polygon(), Slic3r::expoly_to_region(), Slic3r::GUI::expolygon_from_polygon(), Slic3r::expolygons_match(), Slic3r::ClipperZUtils::expolygons_to_zpaths(), priv::fill_polygon_distances(), Slic3r::FillRectilinear::fill_surface_by_multilines(), Slic3r::FillConcentricInternal::fill_surface_extrusion(), Slic3r::FillRectilinear::fill_surface_trapezoidal(), priv::find_close_point(), priv::find_closest_point_pair(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::for_each_expolygon_contour(), Slic3r::from_json(), Slic3r::GUI::PartPlate::generate_exclude_polygon(), Slic3r::GUI::PartPlate::generate_logo_polygon(), Slic3r::GUI::PartPlate::generate_print_polygon(), Slic3r::generate_tree_support_3D(), Slic3r::get_arrange_poly(), Slic3r::ModelInstance::get_arrange_polygon(), priv::get_closest_point_index(), Slic3r::get_extents(), Slic3r::get_extents(), Slic3r::get_extents_rotated(), Slic3r::PrintObject::get_first_layer_bbox(), anonymous_namespace{Emboss.cpp}::get_glyph(), Slic3r::TimelapsePosPicker::get_is_clear_to_x0(), Slic3r::has_duplicate_points(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), is_valid(), Slic3r::SupportGridPattern::island_samples(), lines(), Slic3r::GUI::GLGizmoBrimEars::make_polygon(), medial_axis(), Slic3r::Algorithm::merge_expansions_into_expolygons(), Slic3r::move_inside_expoly(), on_boundary(), Slic3r::operator!=(), Slic3r::operator<<(), Slic3r::operator==(), overlaps(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::point_on_expolygon_boundary(), point_projection(), Slic3r::polygons_append(), Slic3r::precompute_expolygon_distances(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::PartPlateList::preprocess_exclude_areas(), Slic3r::GUI::PartPlateList::preprocess_nonprefered_areas(), Slic3r::arrangement::process_arrangeable(), Slic3r::PerimeterGenerator::process_no_bridge(), Slic3r::GUI::MeshClipper::recalculate_triangles(), Slic3r::GUI::PartPlate::render(), Slic3r::GUI::Bed_2D::repaint(), Slic3r::resample_expolygon(), rotate(), rotate(), Slic3r::CLI::run(), Slic3r::sla::sample_expolygon_boundary(), scale(), scale(), cereal::serialize(), boost::polygon::polygon_mutable_traits< Slic3r::ExPolygon >::set_points(), simplify_p(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::size(), Slic3r::solid_bodies(), Slic3r::straight_walls(), symmetric_y(), Slic3r::GluTessWrapper::tesselate3d(), priv::to_expoly(), Slic3r::to_json(), Slic3r::to_lines(), Slic3r::to_points(), Slic3r::to_polygon_ptrs(), Slic3r::to_polygons(), Slic3r::to_polylines(), Slic3r::top_level_expolygons(), translate(), Slic3r::tree_supports_generate_paths(), Slic3r::anonymous_namespace{Model.cpp}::triangulated_prism_footprints(), Slic3r::validate_expoly_orientation(), and Slic3r::variable_offset().

◆ holes

Polygons Slic3r::ExPolygon::holes

Referenced by ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), area(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::begin_holes(), Slic3r::anonymous_namespace{ClipperUtils.cpp}::c2_offset_expolygons(), clear(), Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox(), Slic3r::collect_region_slices_by_type(), Slic3r::compSecondMoment(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), contains(), Slic3r::contour_distance(), Slic3r::contour_distance2(), Slic3r::count_points(), Slic3r::EdgeGrid::Grid::create(), Slic3r::sla::anonymous_namespace{Pad.cpp}::create_outer_pad_geometry(), Slic3r::Emboss::divide_segments_for_close_point(), douglas_peucker(), Slic3r::SVG::draw_outline(), Slic3r::draw_perimeters(), Slic3r::elephant_foot_compensation(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::end_holes(), Slic3r::expoly_to_region(), Slic3r::expolygons_match(), Slic3r::ClipperZUtils::expolygons_to_zpaths(), priv::fill_polygon_distances(), priv::find_close_point(), priv::find_closest_point_pair(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::for_each_expolygon_contour(), Slic3r::from_json(), Slic3r::get_boundary_external(), priv::get_closest_point_index(), anonymous_namespace{Emboss.cpp}::get_glyph(), Slic3r::has_duplicate_points(), Slic3r::holes(), is_valid(), lines(), Slic3r::mark_boundary_segments_touching_infill(), on_boundary(), Slic3r::operator!=(), Slic3r::operator<<(), Slic3r::operator==(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::point_on_expolygon_boundary(), point_projection(), Slic3r::polygons_append(), Slic3r::precompute_expolygon_distances(), Slic3r::PerimeterGenerator::process_no_bridge(), Slic3r::resample_expolygon(), rotate(), rotate(), Slic3r::sla::sample_expolygon_boundary(), scale(), scale(), cereal::serialize(), boost::polygon::polygon_with_holes_mutable_traits< Slic3r::ExPolygon >::set_holes(), simplify_p(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::size_holes(), Slic3r::solid_bodies(), Slic3r::straight_walls(), symmetric_y(), Slic3r::GluTessWrapper::tesselate3d(), Slic3r::to_json(), Slic3r::to_lines(), Slic3r::to_points(), Slic3r::to_polygon_ptrs(), Slic3r::to_polygons(), Slic3r::to_polylines(), Slic3r::top_level_expolygons(), translate(), Slic3r::tree_supports_generate_paths(), Slic3r::validate_expoly_orientation(), Slic3r::variable_offset(), Slic3r::variable_offset_inner(), Slic3r::variable_offset_inner_ex(), Slic3r::variable_offset_outer(), and Slic3r::variable_offset_outer_ex().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/ExPolygon.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/ExPolygon.cpp