Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ExPolygonWithOffset Struct Reference
+ Collaboration diagram for Slic3r::ExPolygonWithOffset:

Public Member Functions

 ExPolygonWithOffset (const ExPolygon &expolygon, float angle, coord_t aoffset1, coord_t aoffset2=0)
 
 ExPolygonWithOffset (const ExPolygonWithOffset &rhs, float angle)
 
bool is_contour_outer (size_t idx) const
 
bool is_contour_inner (size_t idx) const
 
const Polygoncontour (size_t idx) const
 
Polygoncontour (size_t idx)
 
bool is_contour_ccw (size_t idx) const
 
BoundingBox bounding_box_src () const
 
BoundingBox bounding_box_outer () const
 
BoundingBox bounding_box_inner () const
 

Public Attributes

ExPolygon polygons_src
 
Polygons polygons_outer
 
Polygons polygons_inner
 
size_t n_contours_outer
 
size_t n_contours_inner
 
size_t n_contours
 

Protected Attributes

std::vector< unsigned char > polygons_ccw
 

Detailed Description

Constructor & Destructor Documentation

◆ ExPolygonWithOffset() [1/2]

Slic3r::ExPolygonWithOffset::ExPolygonWithOffset ( const ExPolygon expolygon,
float  angle,
coord_t  aoffset1,
coord_t  aoffset2 = 0 
)
inline
396 {
397 // Copy and rotate the source polygons.
398 polygons_src = expolygon;
399 if (angle != 0.f) {
401 for (Polygon &hole : polygons_src.holes)
403 }
404
405 double miterLimit = DefaultMiterLimit;
406 // for the infill pattern, don't cut the corners.
407 // default miterLimt = 3
408 //double miterLimit = 10.;
409 // FIXME: Resolve properly the cases when it is constructed with aoffset1 = 0 and aoffset2 = 0,
410 // that is used in sample_grid_pattern() for Lightning infill.
411 // assert(aoffset1 < 0);
412 assert(aoffset2 <= 0);
413 // assert(aoffset2 == 0 || aoffset2 < aoffset1);
414// bool sticks_removed =
416// if (sticks_removed) BOOST_LOG_TRIVIAL(error) << "Sticks removed!";
417 polygons_outer = aoffset1 == 0 ? to_polygons(polygons_src) : offset(polygons_src, float(aoffset1), ClipperLib::jtMiter, miterLimit);
418 if (aoffset2 < 0)
419 polygons_inner = shrink(polygons_outer, float(aoffset1 - aoffset2), ClipperLib::jtMiter, miterLimit);
420 // Filter out contours with zero area or small area, contours with 2 points only.
421 const double min_area_threshold = 0.01 * aoffset2 * aoffset2;
422 remove_small(polygons_outer, min_area_threshold);
423 remove_small(polygons_inner, min_area_threshold);
429 polygons_ccw.assign(n_contours, false);
430 for (size_t i = 0; i < n_contours; ++ i) {
432 assert(! contour(i).has_duplicate_points());
434 }
435 }
Polygon contour
Definition ExPolygon.hpp:35
void rotate(double angle)
Definition MultiPoint.hpp:31
bool remove_duplicate_points()
Definition MultiPoint.cpp:87
Definition clipper.cpp:60
@ jtMiter
Definition clipper.hpp:138
static bool is_ccw(const Polygon &poly)
Definition Geometry.hpp:44
static constexpr const double DefaultMiterLimit
Definition ClipperUtils.hpp:36
Slic3r::Polygons shrink(const Slic3r::Polygons &polygons, const float delta, ClipperLib::JoinType joinType=DefaultJoinType, double miterLimit=DefaultMiterLimit)
Definition ClipperUtils.hpp:372
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416
bool remove_sticks(ExPolygon &poly)
Definition ExPolygon.cpp:460
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:112
Polygons to_polygons(const ExPolygon &src)
Definition ExPolygon.hpp:281
bool remove_small(Polygons &polys, double min_area)
Definition Polygon.cpp:522
bool has_duplicate_points(const ClipperLib::PolyTree &polytree)
Definition ClipperUtils.cpp:252
const Polygons & holes(const ExPolygon &p)
Definition AGGRaster.hpp:22
Slic3r::Polygon & hole(Slic3r::ExPolygon &sh, unsigned long idx)
Definition geometries.hpp:200
void rotate(Slic3r::ExPolygon &sh, const Radians &rads)
Definition geometries.hpp:248
size_t n_contours_inner
Definition FillRectilinear.cpp:482
Polygons polygons_inner
Definition FillRectilinear.cpp:479
Polygons polygons_outer
Definition FillRectilinear.cpp:478
size_t n_contours_outer
Definition FillRectilinear.cpp:481
ExPolygon polygons_src
Definition FillRectilinear.cpp:477
const Polygon & contour(size_t idx) const
Definition FillRectilinear.cpp:454
std::vector< unsigned char > polygons_ccw
Definition FillRectilinear.cpp:487
size_t n_contours
Definition FillRectilinear.cpp:483

References Slic3r::angle(), Slic3r::ExPolygon::contour, contour(), Slic3r::DefaultMiterLimit, Slic3r::has_duplicate_points(), Slic3r::ExPolygon::holes, Slic3r::Geometry::is_ccw(), ClipperLib::jtMiter, n_contours, n_contours_inner, n_contours_outer, Slic3r::offset(), polygons_ccw, polygons_inner, polygons_outer, polygons_src, Slic3r::MultiPoint::remove_duplicate_points(), Slic3r::remove_small(), Slic3r::remove_sticks(), Slic3r::MultiPoint::rotate(), Slic3r::shrink(), and Slic3r::to_polygons().

+ Here is the call graph for this function:

◆ ExPolygonWithOffset() [2/2]

Slic3r::ExPolygonWithOffset::ExPolygonWithOffset ( const ExPolygonWithOffset rhs,
float  angle 
)
inline
437 : ExPolygonWithOffset(rhs) {
438 if (angle != 0.f) {
440 for (Polygon &hole : this->polygons_src.holes)
442 for (Polygon &poly : this->polygons_outer)
443 poly.rotate(angle);
444 for (Polygon &poly : this->polygons_inner)
445 poly.rotate(angle);
446 }
447 }
ExPolygonWithOffset(const ExPolygon &expolygon, float angle, coord_t aoffset1, coord_t aoffset2=0)
Definition FillRectilinear.cpp:389

References Slic3r::angle(), Slic3r::ExPolygon::contour, Slic3r::ExPolygon::holes, polygons_inner, polygons_outer, polygons_src, and Slic3r::MultiPoint::rotate().

+ Here is the call graph for this function:

Member Function Documentation

◆ bounding_box_inner()

BoundingBox Slic3r::ExPolygonWithOffset::bounding_box_inner ( ) const
inline
467 { return get_extents(polygons_inner); }
BoundingBox get_extents(const ExPolygon &expolygon)
Definition ExPolygon.cpp:352

References Slic3r::get_extents(), and polygons_inner.

+ Here is the call graph for this function:

◆ bounding_box_outer()

BoundingBox Slic3r::ExPolygonWithOffset::bounding_box_outer ( ) const
inline
465 { return get_extents(polygons_outer); }

References Slic3r::get_extents(), and polygons_outer.

Referenced by Slic3r::FillSupportBase::fill_surface(), and Slic3r::FillRectilinear::fill_surface_by_lines().

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

◆ bounding_box_src()

BoundingBox Slic3r::ExPolygonWithOffset::bounding_box_src ( ) const
inline
463 { return get_extents(polygons_src); }

References Slic3r::get_extents(), and polygons_src.

Referenced by Slic3r::FillRectilinear::fill_surface_by_lines(), and Slic3r::make_fill_lines().

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

◆ contour() [1/2]

Polygon & Slic3r::ExPolygonWithOffset::contour ( size_t  idx)
inline
458 { return is_contour_outer(idx) ? polygons_outer[idx] : polygons_inner[idx - n_contours_outer]; }
bool is_contour_outer(size_t idx) const
Definition FillRectilinear.cpp:450

References is_contour_outer(), n_contours_outer, polygons_inner, and polygons_outer.

+ Here is the call graph for this function:

◆ contour() [2/2]

const Polygon & Slic3r::ExPolygonWithOffset::contour ( size_t  idx) const
inline
455 { return is_contour_outer(idx) ? polygons_outer[idx] : polygons_inner[idx - n_contours_outer]; }

References is_contour_outer(), n_contours_outer, polygons_inner, and polygons_outer.

Referenced by ExPolygonWithOffset(), Slic3r::connect_segment_intersections_by_contours(), Slic3r::emit_perimeter_prev_next_segment(), Slic3r::emit_perimeter_segment_on_vertical_line(), Slic3r::measure_perimeter_horizontal_segment_length(), Slic3r::measure_perimeter_segment_on_vertical_line_length(), and Slic3r::slice_region_by_vertical_lines().

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

◆ is_contour_ccw()

bool Slic3r::ExPolygonWithOffset::is_contour_ccw ( size_t  idx) const
inline
460{ return polygons_ccw[idx]; }

References polygons_ccw.

◆ is_contour_inner()

bool Slic3r::ExPolygonWithOffset::is_contour_inner ( size_t  idx) const
inline
452{ return idx >= n_contours_outer; }

References n_contours_outer.

◆ is_contour_outer()

bool Slic3r::ExPolygonWithOffset::is_contour_outer ( size_t  idx) const
inline
450{ return idx < n_contours_outer; }

References n_contours_outer.

Referenced by contour(), contour(), and Slic3r::slice_region_by_vertical_lines().

+ Here is the caller graph for this function:

Member Data Documentation

◆ n_contours

◆ n_contours_inner

size_t Slic3r::ExPolygonWithOffset::n_contours_inner

◆ n_contours_outer

size_t Slic3r::ExPolygonWithOffset::n_contours_outer

◆ polygons_ccw

std::vector<unsigned char> Slic3r::ExPolygonWithOffset::polygons_ccw
protected

◆ polygons_inner

◆ polygons_outer

◆ polygons_src


The documentation for this struct was generated from the following file: