Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ExPolygon Class Reference

#include <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)
 
ExPolygonoperator= (const ExPolygon &other)=default
 
ExPolygonoperator= (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
 
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
 
Polygoncontour_or_hole (size_t idx)
 
const Polygoncontour_or_hole (size_t idx) const
 

Public Attributes

Polygon contour
 
Polygons holes
 

Detailed Description

Constructor & Destructor Documentation

◆ ExPolygon() [1/13]

Slic3r::ExPolygon::ExPolygon ( )
default

◆ ExPolygon() [2/13]

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

◆ ExPolygon() [3/13]

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

◆ ExPolygon() [4/13]

Slic3r::ExPolygon::ExPolygon ( const Polygon contour)
inlineexplicit
21: contour(contour) {}
Polygon contour
Definition ExPolygon.hpp:35

◆ ExPolygon() [5/13]

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

◆ ExPolygon() [6/13]

Slic3r::ExPolygon::ExPolygon ( const Points contour)
inlineexplicit
23: contour(contour) {}

◆ ExPolygon() [7/13]

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

◆ ExPolygon() [8/13]

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

References holes.

◆ ExPolygon() [9/13]

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

References holes.

◆ ExPolygon() [10/13]

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

References holes.

◆ ExPolygon() [11/13]

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

References holes.

◆ ExPolygon() [12/13]

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

◆ ExPolygon() [13/13]

Slic3r::ExPolygon::ExPolygon ( std::initializer_list< Point contour,
std::initializer_list< Point hole 
)
inline
30: contour(contour), holes({ hole }) {}
Slic3r::Polygon & hole(Slic3r::ExPolygon &sh, unsigned long idx)
Definition geometries.hpp:200

Member Function Documentation

◆ area()

double Slic3r::ExPolygon::area ( ) const
53{
54 double a = this->contour.area();
55 for (const Polygon &hole : holes)
56 a -= - hole.area(); // holes have negative area
57 return a;
58}
double area() const
Definition ExPolygon.cpp:52
static double area(const Points &pts)
Definition Polygon.cpp:49

References Slic3r::Polygon::area(), contour, and holes.

Referenced by Slic3r::Surface::area(), Slic3r::area(), Slic3r::elephant_foot_compensation(), Slic3r::GUI::FillBedJob::prepare(), and Slic3r::FFFSupport::tree_supports_generate_paths().

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

◆ clear()

void Slic3r::ExPolygon::clear ( )
inline
38{ contour.points.clear(); holes.clear(); }
Points points
Definition MultiPoint.hpp:18

References contour, holes, and Slic3r::MultiPoint::points.

Referenced by Slic3r::Surface::clear(), and Slic3r::FFFSupport::tree_supports_generate_paths().

+ Here is the caller graph for this function:

◆ contains() [1/4]

bool Slic3r::ExPolygon::contains ( const Line line) const
77{
78 return this->contains(Polyline(line.a, line.b));
79}
bool contains(const Line &line) const
Definition ExPolygon.cpp:76

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

Referenced by Slic3r::FillLine::_fill_surface_single(), contains(), Slic3r::GUI::MeshClipper::is_projection_inside_cut(), 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
104{
105 if (! Slic3r::contains(contour, point, border_result))
106 // Outside the outer contour, not on the contour boundary.
107 return false;
108 for (const Polygon &hole : this->holes)
109 if (Slic3r::contains(hole, point, ! border_result))
110 // Inside a hole, not on the hole boundary.
111 return false;
112 return true;
113}
if(!(yy_init))
Definition lexer.c:1190
Definition avrdude-slic3r.cpp:16
bool contains(const ContainerType &c, const ValueType &v)
Definition libslic3r.h:247

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

+ Here is the call graph for this function:

◆ contains() [3/4]

bool Slic3r::ExPolygon::contains ( const Polyline polyline) const
82{
83 return diff_pl(polyline, *this).empty();
84}
Slic3r::Polylines diff_pl(const Slic3r::Polyline &subject, const Slic3r::Polygons &clip)
Definition ClipperUtils.cpp:852

References Slic3r::diff_pl().

+ Here is the call graph for this function:

◆ contains() [4/4]

bool Slic3r::ExPolygon::contains ( const Polylines polylines) const
87{
88 #if 0
89 BoundingBox bbox = get_extents(polylines);
90 bbox.merge(get_extents(*this));
91 SVG svg(debug_out_path("ExPolygon_contains.svg"), bbox);
92 svg.draw(*this);
93 svg.draw_outline(*this);
94 svg.draw(polylines, "blue");
95 #endif
96 Polylines pl_out = diff_pl(polylines, *this);
97 #if 0
98 svg.draw(pl_out, "red");
99 #endif
100 return pl_out.empty();
101}
std::string debug_out_path(const char *name,...)
Definition utils.cpp:218
std::vector< Polyline > Polylines
Definition Polyline.hpp:14
BoundingBox get_extents(const ExPolygon &expolygon)
Definition ExPolygon.cpp:352

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
81{ return (idx == 0) ? this->contour : this->holes[idx - 1]; }

References contour.

Referenced by Slic3r::Algorithm::expolygons_to_zpaths_expanded_opened(), point_projection(), and Slic3r::FFFSupport::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
82{ return (idx == 0) ? this->contour : this->holes[idx - 1]; }

References contour.

◆ douglas_peucker()

void Slic3r::ExPolygon::douglas_peucker ( double  tolerance)
70{
71 this->contour.douglas_peucker(tolerance);
72 for (Polygon &poly : this->holes)
73 poly.douglas_peucker(tolerance);
74}
void douglas_peucker(double tolerance)
Definition ExPolygon.cpp:69
void douglas_peucker(double tolerance)
Definition Polygon.cpp:96

References contour, Slic3r::Polygon::douglas_peucker(), and holes.

+ Here is the call graph for this function:

◆ empty()

bool Slic3r::ExPolygon::empty ( ) const
inline

◆ is_valid()

bool Slic3r::ExPolygon::is_valid ( ) const
61{
62 if (!this->contour.is_valid() || !this->contour.is_counter_clockwise()) return false;
63 for (Polygons::const_iterator it = this->holes.begin(); it != this->holes.end(); ++it) {
64 if (!(*it).is_valid() || (*it).is_counter_clockwise()) return false;
65 }
66 return true;
67}
bool is_valid() const
Definition Polygon.hpp:62

References contour, holes, and Slic3r::Polygon::is_valid().

+ Here is the call graph for this function:

◆ lines()

Lines Slic3r::ExPolygon::lines ( ) const
331{
332 Lines lines = this->contour.lines();
333 for (Polygons::const_iterator h = this->holes.begin(); h != this->holes.end(); ++h) {
334 Lines hole_lines = h->lines();
335 lines.insert(lines.end(), hole_lines.begin(), hole_lines.end());
336 }
337 return lines;
338}
Lines lines() const
Definition ExPolygon.cpp:330
Lines lines() const
Definition Polygon.cpp:22
std::vector< Line > Lines
Definition Line.hpp:17

References contour, holes, lines(), and Slic3r::Polygon::lines().

Referenced by 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
76 { 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:211

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
322{
324 this->medial_axis(min_width, max_width, &tp);
325 polylines->reserve(polylines->size() + tp.size());
326 for (auto &pl : tp)
327 polylines->emplace_back(pl.points);
328}
std::vector< ThickPolyline > ThickPolylines
Definition Polyline.hpp:15

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
212{
213 // init helper object
214 Slic3r::Geometry::MedialAxis ma(min_width, max_width, *this);
215
216 // compute the Voronoi diagram and extract medial axis polylines
218 ma.build(&pp);
219
220 /*
221 SVG svg("medial_axis.svg");
222 svg.draw(*this);
223 svg.draw(pp);
224 svg.Close();
225 */
226
227 /* Find the maximum width returned; we're going to use this for validating and
228 filtering the output segments. */
229 double max_w = 0;
230 for (ThickPolylines::const_iterator it = pp.begin(); it != pp.end(); ++it)
231 max_w = fmaxf(max_w, *std::max_element(it->width.begin(), it->width.end()));
232
233 /* Loop through all returned polylines in order to extend their endpoints to the
234 expolygon boundaries */
235 bool removed = false;
236 for (size_t i = 0; i < pp.size(); ++i) {
237 ThickPolyline& polyline = pp[i];
238
239 // extend initial and final segments of each polyline if they're actual endpoints
240 /* We assign new endpoints to temporary variables because in case of a single-line
241 polyline, after we extend the start point it will be caught by the intersection()
242 call, so we keep the inner point until we perform the second intersection() as well */
243 Point new_front = polyline.points.front();
244 Point new_back = polyline.points.back();
245 if (polyline.endpoints.first && !this->on_boundary(new_front, SCALED_EPSILON)) {
246 Vec2d p1 = polyline.points.front().cast<double>();
247 Vec2d p2 = polyline.points[1].cast<double>();
248 // prevent the line from touching on the other side, otherwise intersection() might return that solution
249 if (polyline.points.size() == 2)
250 p2 = (p1 + p2) * 0.5;
251 // Extend the start of the segment.
252 p1 -= (p2 - p1).normalized() * max_width;
253 this->contour.intersection(Line(p1.cast<coord_t>(), p2.cast<coord_t>()), &new_front);
254 }
255 if (polyline.endpoints.second && !this->on_boundary(new_back, SCALED_EPSILON)) {
256 Vec2d p1 = (polyline.points.end() - 2)->cast<double>();
257 Vec2d p2 = polyline.points.back().cast<double>();
258 // prevent the line from touching on the other side, otherwise intersection() might return that solution
259 if (polyline.points.size() == 2)
260 p1 = (p1 + p2) * 0.5;
261 // Extend the start of the segment.
262 p2 += (p2 - p1).normalized() * max_width;
263 this->contour.intersection(Line(p1.cast<coord_t>(), p2.cast<coord_t>()), &new_back);
264 }
265 polyline.points.front() = new_front;
266 polyline.points.back() = new_back;
267
268 /* remove too short polylines
269 (we can't do this check before endpoints extension and clipping because we don't
270 know how long will the endpoints be extended since it depends on polygon thickness
271 which is variable - extension will be <= max_width/2 on each side) */
272 if ((polyline.endpoints.first || polyline.endpoints.second)
273 && polyline.length() < max_w*2) {
274 pp.erase(pp.begin() + i);
275 --i;
276 removed = true;
277 continue;
278 }
279 }
280
281 /* If we removed any short polylines we now try to connect consecutive polylines
282 in order to allow loop detection. Note that this algorithm is greedier than
283 MedialAxis::process_edge_neighbors() as it will connect random pairs of
284 polylines even when more than two start from the same point. This has no
285 drawbacks since we optimize later using nearest-neighbor which would do the
286 same, but should we use a more sophisticated optimization algorithm we should
287 not connect polylines when more than two meet. */
288 if (removed) {
289 for (size_t i = 0; i < pp.size(); ++i) {
290 ThickPolyline& polyline = pp[i];
291 if (polyline.endpoints.first && polyline.endpoints.second) continue; // optimization
292
293 // find another polyline starting here
294 for (size_t j = i+1; j < pp.size(); ++j) {
295 ThickPolyline& other = pp[j];
296 if (polyline.last_point() == other.last_point()) {
297 other.reverse();
298 } else if (polyline.first_point() == other.last_point()) {
299 polyline.reverse();
300 other.reverse();
301 } else if (polyline.first_point() == other.first_point()) {
302 polyline.reverse();
303 } else if (polyline.last_point() != other.first_point()) {
304 continue;
305 }
306
307 polyline.points.insert(polyline.points.end(), other.points.begin() + 1, other.points.end());
308 polyline.width.insert(polyline.width.end(), other.width.begin(), other.width.end());
309 polyline.endpoints.second = other.endpoints.second;
310 assert(polyline.width.size() == polyline.points.size()*2 - 2);
311
312 pp.erase(pp.begin() + j);
313 j = i; // restart search from i+1
314 }
315 }
316 }
317
318 polylines->insert(polylines->end(), pp.begin(), pp.end());
319}
Definition MedialAxis.hpp:9
bool intersection(const Line &line, Point *intersection) const
Definition Polygon.cpp:155
#define SCALED_EPSILON
Definition libslic3r.h:71
int32_t coord_t
Definition libslic3r.h:39
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:51
Kernel::Point_2 Point
Definition point_areas.cpp:20

References Slic3r::Geometry::MedialAxis::build(), contour, Slic3r::ThickPolyline::endpoints, Slic3r::ThickPolyline::first_point(), Slic3r::Polygon::intersection(), Slic3r::ThickPolyline::last_point(), Slic3r::ThickPolyline::length(), Slic3r::ThickPolyline::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
80{ 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::FFFSupport::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
116{
117 if (this->contour.on_boundary(point, eps))
118 return true;
119 for (const Polygon &hole : this->holes)
120 if (hole.on_boundary(point, eps))
121 return true;
122 return false;
123}
bool on_boundary(const Point &point, double eps) const
Definition ExPolygon.cpp:115
bool on_boundary(const Point &point, double eps) const
Definition Polygon.hpp:68

References contour, holes, and Slic3r::Polygon::on_boundary().

+ Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ overlaps()

bool Slic3r::ExPolygon::overlaps ( const ExPolygon other) const
146{
147 if (this->empty() || other.empty())
148 return false;
149
150 #if 0
151 BoundingBox bbox = get_extents(other);
152 bbox.merge(get_extents(*this));
153 static int iRun = 0;
154 SVG svg(debug_out_path("ExPolygon_overlaps-%d.svg", iRun ++), bbox);
155 svg.draw(*this);
156 svg.draw_outline(*this);
157 svg.draw_outline(other, "blue");
158 #endif
159
160 Polylines pl_out = intersection_pl(to_polylines(other), *this);
161
162 #if 0
163 svg.draw(pl_out, "red");
164 #endif
165
166 // See unit test SCENARIO("Clipper diff with polyline", "[Clipper]")
167 // for in which case the intersection_pl produces any intersection.
168 return ! pl_out.empty() ||
169 // If *this is completely inside other, then pl_out is empty, but the expolygons overlap. Test for that situation.
170 other.contains(this->contour.points.front());
171}
bool empty() const
Definition ExPolygon.hpp:46
Polylines to_polylines(const ExPolygon &src)
Definition ExPolygon.hpp:209
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip)
Definition ClipperUtils.cpp:866

References 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(), Slic3r::MultiPoint::points, and Slic3r::to_polylines().

Referenced by Slic3r::sla::anonymous_namespace{Pad.cpp}::Intersector::intersects(), and 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
127{
128 if (this->holes.empty()) {
129 return this->contour.point_projection(point);
130 } else {
131 double dist_min2 = std::numeric_limits<double>::max();
132 Point closest_pt_min;
133 for (size_t i = 0; i < this->num_contours(); ++ i) {
134 Point closest_pt = this->contour_or_hole(i).point_projection(point);
135 double d2 = (closest_pt - point).cast<double>().squaredNorm();
136 if (d2 < dist_min2) {
137 dist_min2 = d2;
138 closest_pt_min = closest_pt;
139 }
140 }
141 return closest_pt_min;
142 }
143}
size_t num_contours() const
Definition ExPolygon.hpp:80
Polygon & contour_or_hole(size_t idx)
Definition ExPolygon.hpp:81
Point point_projection(const Point &point) const
Definition Polygon.cpp:266

References 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)
39{
41 for (Polygon &hole : holes)
43}
void rotate(double angle)
Definition ExPolygon.cpp:38
void rotate(double angle)
Definition MultiPoint.hpp:31
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:112

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

Referenced by Slic3r::FillGyroid::_fill_surface_single(), Slic3r::FillLine::_fill_surface_single(), Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::get_all_polygons(), libnest2d::shapelike::rotate(), 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 
)
46{
47 contour.rotate(angle, center);
48 for (Polygon &hole : holes)
49 hole.rotate(angle, center);
50}

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

+ Here is the call graph for this function:

◆ scale() [1/2]

void Slic3r::ExPolygon::scale ( double  factor)
18{
19 contour.scale(factor);
20 for (Polygon &hole : holes)
21 hole.scale(factor);
22}
void scale(double factor)
Definition ExPolygon.cpp:17
void scale(double factor)
Definition MultiPoint.cpp:6

References contour, holes, and Slic3r::MultiPoint::scale().

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

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

◆ scale() [2/2]

void Slic3r::ExPolygon::scale ( double  factor_x,
double  factor_y 
)
25{
26 contour.scale(factor_x, factor_y);
27 for (Polygon &hole : holes)
28 hole.scale(factor_x, factor_y);
29}

References contour, holes, and Slic3r::MultiPoint::scale().

+ Here is the call graph for this function:

◆ simplify() [1/2]

ExPolygons Slic3r::ExPolygon::simplify ( double  tolerance) const
202{
203 return union_ex(this->simplify_p(tolerance));
204}
void simplify_p(double tolerance, Polygons *polygons) const
Definition ExPolygon.cpp:173
Slic3r::ExPolygons union_ex(const Slic3r::Polygons &subject, ClipperLib::PolyFillType fill_type)
Definition ClipperUtils.cpp:774

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

Referenced by Slic3r::SVGRaster::draw(), 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
207{
208 append(*expolygons, this->simplify(tolerance));
209}
ExPolygons simplify(double tolerance) const
Definition ExPolygon.cpp:201
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:110

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
180{
181 Polygons pp;
182 pp.reserve(this->holes.size() + 1);
183 // contour
184 {
185 Polygon p = this->contour;
186 p.points.push_back(p.points.front());
187 p.points = MultiPoint::douglas_peucker(p.points, tolerance);
188 p.points.pop_back();
189 pp.emplace_back(std::move(p));
190 }
191 // holes
192 for (Polygon p : this->holes) {
193 p.points.push_back(p.points.front());
194 p.points = MultiPoint::douglas_peucker(p.points, tolerance);
195 p.points.pop_back();
196 pp.emplace_back(std::move(p));
197 }
198 return simplify_polygons(pp);
199}
static Points douglas_peucker(const Points &points, const double tolerance)
Definition MultiPoint.cpp:106
std::vector< Polygon, PointsAllocator< Polygon > > Polygons
Definition Polygon.hpp:15
Polygons simplify_polygons(const Polygons &subject)
Definition ClipperUtils.cpp:969
Slic3r::Polygon Polygon
Definition Emboss.cpp:34

References contour, Slic3r::MultiPoint::douglas_peucker(), 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
174{
175 Polygons pp = this->simplify_p(tolerance);
176 polygons->insert(polygons->end(), pp.begin(), pp.end());
177}

References simplify_p().

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

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

◆ translate() [1/2]

void Slic3r::ExPolygon::translate ( const Point vector)
32{
34 for (Polygon &hole : holes)
35 hole.translate(p);
36}
void translate(double x, double y)
Definition ExPolygon.hpp:41
void translate(double x, double y)
Definition MultiPoint.hpp:29

References contour, holes, and Slic3r::MultiPoint::translate().

+ Here is the call graph for this function:

◆ translate() [2/2]

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

References translate().

Referenced by Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::get_all_polygons(), Slic3r::arrangement::ArrangePolygon::transformed_poly(), translate(), and libnest2d::shapelike::translate().

+ 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 Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), Slic3r::Fill3DHoneycomb::_fill_surface_single(), Slic3r::FillConcentric::_fill_surface_single(), Slic3r::FillGyroid::_fill_surface_single(), Slic3r::FillHoneycomb::_fill_surface_single(), Slic3r::FillLine::_fill_surface_single(), Slic3r::FillConcentric::_fill_surface_single(), Slic3r::Fill::_infill_direction(), Slic3r::sla::anonymous_namespace{Pad.cpp}::add_cavity(), area(), Slic3r::arrangement::arrange(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::begin_points(), Slic3r::SupportSpotsGenerator::build_object_part_from_slice(), clear(), Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox(), priv::collect_close_points(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), contains(), Slic3r::contour(), libnest2d::shapelike::contour(), libnest2d::shapelike::contour(), Slic3r::contour_distance(), Slic3r::contour_distance2(), contour_or_hole(), contour_or_hole(), Slic3r::count_points(), Slic3r::EdgeGrid::Grid::create(), libnest2d::shapelike::create(), libnest2d::shapelike::create(), Slic3r::sla::anonymous_namespace{Pad.cpp}::create_outer_pad_geometry(), Slic3r::sla::anonymous_namespace{Pad.cpp}::divide_blueprint(), Slic3r::Emboss::divide_segments_for_close_point(), douglas_peucker(), Slic3r::SVG::draw_outline(), Slic3r::FFFSupport::draw_perimeters(), Slic3r::elephant_foot_compensation(), empty(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::end_points(), Slic3r::expolygons_match(), Slic3r::ClipperZUtils::expolygons_to_zpaths(), priv::fill_polygon_distances(), Slic3r::FillRectilinear::fill_surface_by_multilines(), priv::find_close_point(), priv::find_closest_point_pair(), Slic3r::WipeTower::finish_layer(), Slic3r::foreach_vertex(), Slic3r::sla::foreach_vertex(), Slic3r::get_all_polygons(), Slic3r::get_arrange_poly(), Slic3r::ModelInstance::get_arrange_polygon(), Slic3r::GUI::WipeTower::get_arrange_polygon(), priv::get_closest_point_index(), Slic3r::get_extents(), Slic3r::get_extents(), Slic3r::get_extents_rotated(), Slic3r::has_duplicate_points(), Slic3r::GUI::Bed3D::init_gridlines(), Slic3r::sla::anonymous_namespace{Pad.cpp}::Intersector::intersects(), is_valid(), Slic3r::SupportGridPattern::island_samples(), lines(), medial_axis(), Slic3r::Algorithm::merge_expansions_into_expolygons(), Slic3r::sla::anonymous_namespace{Pad.cpp}::offset_contour_only(), Slic3r::offset_expolygon_inner(), on_boundary(), Slic3r::operator!=(), Slic3r::ClipperUtils::ExPolygonProvider::iterator::operator*(), Slic3r::operator==(), overlaps(), point_projection(), Slic3r::polygons_append(), Slic3r::precompute_expolygon_distances(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::arrangement::process_arrangeable(), Slic3r::GUI::MeshClipper::recalculate_triangles(), Slic3r::remove_sticks(), Slic3r::resample_expolygon(), rotate(), rotate(), Slic3r::sla::sample_expolygon_boundary(), scale(), scale(), boost::polygon::polygon_mutable_traits< Slic3r::ExPolygon >::set_points(), Slic3r::GUI::Bed3D::set_shape(), simplify_p(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::size(), Slic3r::straight_walls(), Slic3r::GluTessWrapper::tesselate3d(), priv::to_expoly(), Slic3r::to_lines(), Slic3r::to_points(), Slic3r::to_polygon_ptrs(), Slic3r::to_polygons(), Slic3r::to_polylines(), libnest2d::shapelike::toString(), Slic3r::anonymous_namespace{SL1_SVG.cpp}::transform(), translate(), Slic3r::traverse_pt(), Slic3r::FFFSupport::tree_supports_generate_paths(), Slic3r::GUI::update_arrangepoly_slaprint(), Slic3r::validate_expoly_orientation(), Slic3r::variable_offset_inner_raw(), Slic3r::variable_offset_outer_ex(), and Slic3r::variable_offset_outer_raw().

◆ holes

Polygons Slic3r::ExPolygon::holes

Referenced by ExPolygon(), ExPolygon(), ExPolygon(), ExPolygon(), Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), area(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::begin_holes(), Slic3r::SupportSpotsGenerator::build_object_part_from_slice(), Slic3r::ClipperUtils::ExPolygonProvider::cend(), clear(), Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox(), priv::collect_close_points(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), contains(), Slic3r::contour_distance(), Slic3r::contour_distance2(), Slic3r::count_points(), Slic3r::EdgeGrid::Grid::create(), libnest2d::shapelike::create(), libnest2d::shapelike::create(), Slic3r::sla::anonymous_namespace{Pad.cpp}::create_outer_pad_geometry(), Slic3r::sla::anonymous_namespace{Pad.cpp}::divide_blueprint(), Slic3r::Emboss::divide_segments_for_close_point(), douglas_peucker(), Slic3r::SVG::draw_outline(), Slic3r::FFFSupport::draw_perimeters(), Slic3r::elephant_foot_compensation(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::end_holes(), Slic3r::expolygons_match(), Slic3r::ClipperZUtils::expolygons_to_zpaths(), priv::fill_polygon_distances(), priv::find_close_point(), priv::find_closest_point_pair(), Slic3r::foreach_vertex(), Slic3r::sla::foreach_vertex(), Slic3r::get_all_polygons(), priv::get_closest_point_index(), Slic3r::has_duplicate_points(), libnest2d::shapelike::hole(), libnest2d::shapelike::hole(), libnest2d::shapelike::holeCount(), Slic3r::holes(), libnest2d::shapelike::holes(), libnest2d::shapelike::holes(), is_valid(), lines(), Slic3r::mark_boundary_segments_touching_infill(), Slic3r::sla::anonymous_namespace{Pad.cpp}::offset_contour_only(), Slic3r::offset_expolygon_inner(), on_boundary(), Slic3r::operator!=(), Slic3r::ClipperUtils::ExPolygonProvider::iterator::operator*(), Slic3r::operator==(), point_projection(), Slic3r::polygons_append(), Slic3r::precompute_expolygon_distances(), Slic3r::remove_sticks(), Slic3r::resample_expolygon(), rotate(), rotate(), Slic3r::sla::sample_expolygon_boundary(), scale(), scale(), boost::polygon::polygon_with_holes_mutable_traits< Slic3r::ExPolygon >::set_holes(), simplify_p(), Slic3r::ClipperUtils::ExPolygonProvider::size(), boost::polygon::polygon_with_holes_traits< Slic3r::ExPolygon >::size_holes(), Slic3r::straight_walls(), Slic3r::GluTessWrapper::tesselate3d(), Slic3r::to_lines(), Slic3r::to_points(), Slic3r::to_polygon_ptrs(), Slic3r::to_polygons(), Slic3r::to_polylines(), libnest2d::shapelike::toString(), Slic3r::anonymous_namespace{SL1_SVG.cpp}::transform(), translate(), Slic3r::FFFSupport::tree_supports_generate_paths(), Slic3r::GUI::update_arrangepoly_slaprint(), Slic3r::validate_expoly_orientation(), Slic3r::variable_offset_inner_raw(), Slic3r::variable_offset_outer_ex(), and Slic3r::variable_offset_outer_raw().


The documentation for this class was generated from the following files: