OrcaSlicer latest
OrcaSlicer
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 Polygon & contour (size_t idx) const
Polygon & contour (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
416 {
417 // Copy and rotate the source polygons.
418 polygons_src = expolygon;
419 if (angle != 0.f) {
420 polygons_src.contour.rotate(angle);
421 for (Polygon &hole : polygons_src.holes)
422 hole.rotate(angle);
423 }
424
425 double miterLimit = DefaultMiterLimit;
426 // for the infill pattern, don't cut the corners.
427 // default miterLimt = 3
428 //double miterLimit = 10.;
429 // FIXME: Resolve properly the cases when it is constructed with aoffset1 = 0 and aoffset2 = 0,
430 // that is used in sample_grid_pattern() for Lightning infill.
431 //assert(aoffset1 < 0);
432 assert(aoffset2 <= 0);
433 // assert(aoffset2 == 0 || aoffset2 < aoffset1);
434// bool sticks_removed =
436// if (sticks_removed) BOOST_LOG_TRIVIAL(error) << "Sticks removed!";
437 polygons_outer = aoffset1 == 0 ? to_polygons(polygons_src) : offset(polygons_src, float(aoffset1), jtMiter, miterLimit);
438 if (aoffset2 < 0)
439 polygons_inner = shrink(polygons_outer, float(aoffset1 - aoffset2), jtMiter, miterLimit);
440 // Filter out contours with zero area or small area, contours with 2 points only.
441 const double min_area_threshold = 0.01 * aoffset2 * aoffset2;
442 remove_small(polygons_outer, min_area_threshold);
443 remove_small(polygons_inner, min_area_threshold);
449 polygons_ccw.assign(n_contours, false);
450 for (size_t i = 0; i < n_contours; ++ i) {
452 assert(! contour(i).has_duplicate_points());
454 }
455 }
bool remove_duplicate_points()
Definition MultiPoint.cpp:113
static bool is_ccw(const Polygon &poly)
Definition Geometry.hpp:66
bool has_duplicate_points(const ExPolygon &expoly)
Definition ExPolygon.cpp:451
static constexpr const double DefaultMiterLimit
Definition ClipperUtils.hpp:40
@ jtMiter
Definition ClipperUtils.hpp:21
bool remove_sticks(ExPolygon &poly)
Definition ExPolygon.cpp:514
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138
Polygons to_polygons(const ExPolygon &src)
Definition ExPolygon.hpp:307
Slic3r::Polygons shrink(const Slic3r::Polygons &polygons, const float delta, JoinType joinType=DefaultJoinType, double miterLimit=DefaultMiterLimit)
Definition ClipperUtils.hpp:406
bool remove_small(Polygons &polys, double min_area)
Definition Polygon.cpp:627
size_t n_contours_inner
Definition FillRectilinear.cpp:502
Polygons polygons_inner
Definition FillRectilinear.cpp:499
Polygons polygons_outer
Definition FillRectilinear.cpp:498
size_t n_contours_outer
Definition FillRectilinear.cpp:501
ExPolygon polygons_src
Definition FillRectilinear.cpp:497
const Polygon & contour(size_t idx) const
Definition FillRectilinear.cpp:474
std::vector< unsigned char > polygons_ccw
Definition FillRectilinear.cpp:507
size_t n_contours
Definition FillRectilinear.cpp:503

References Slic3r::angle(), contour(), Slic3r::DefaultMiterLimit, Slic3r::has_duplicate_points(), Slic3r::Geometry::is_ccw(), Slic3r::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().

Referenced by ExPolygonWithOffset().

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

◆ ExPolygonWithOffset() [2/2]

Slic3r::ExPolygonWithOffset::ExPolygonWithOffset ( const ExPolygonWithOffset & rhs,
float angle )
inline
457 : ExPolygonWithOffset(rhs) {
458 if (angle != 0.f) {
459 this->polygons_src.contour.rotate(angle);
460 for (Polygon &hole : this->polygons_src.holes)
461 hole.rotate(angle);
462 for (Polygon &poly : this->polygons_outer)
463 poly.rotate(angle);
464 for (Polygon &poly : this->polygons_inner)
465 poly.rotate(angle);
466 }
467 }
void poly(std::vector< std::pair< Vec2d, Vec2d > > &out, std::initializer_list< Vec2d > p)
Definition DesignSketchTool.cpp:7751
ExPolygonWithOffset(const ExPolygon &expolygon, float angle, coord_t aoffset1, coord_t aoffset2=0)
Definition FillRectilinear.cpp:409

References ExPolygonWithOffset(), Slic3r::angle(), 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
487 { return get_extents(polygons_inner); }
BoundingBox get_extents(const ExPolygonsWithIds &e)
Definition Emboss.cpp:1374

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
485 { 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
483 { 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
478 { 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:470

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
475 { 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
480{ return polygons_ccw[idx]; }

References polygons_ccw.

◆ is_contour_inner()

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

References n_contours_outer.

◆ is_contour_outer()

bool Slic3r::ExPolygonWithOffset::is_contour_outer ( size_t idx) const
inline
470{ 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: