Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ClipperUtils Namespace Reference

Classes

class  EmptyPathsProvider
 
struct  ExPolygonProvider
 
struct  ExPolygonsProvider
 
class  MultiPointsProvider
 
class  PathsProvider
 
class  PathsProviderIteratorBase
 
class  SinglePathProvider
 
struct  SurfacesProvider
 
struct  SurfacesPtrProvider
 

Typedefs

using PolygonsProvider = MultiPointsProvider< Polygons >
 
using PolylinesProvider = MultiPointsProvider< Polylines >
 
using ZPoint = Vec3i32
 
using ZPoints = std::vector< Vec3i32 >
 

Functions

template<typename PointsType >
void clip_clipper_polygon_with_subject_bbox_templ (const PointsType &src, const BoundingBox &bbox, PointsType &out)
 
void clip_clipper_polygon_with_subject_bbox (const Points &src, const BoundingBox &bbox, Points &out)
 
void clip_clipper_polygon_with_subject_bbox (const ZPoints &src, const BoundingBox &bbox, ZPoints &out)
 
template<typename PointsType >
PointsType clip_clipper_polygon_with_subject_bbox_templ (const PointsType &src, const BoundingBox &bbox)
 
Points clip_clipper_polygon_with_subject_bbox (const Points &src, const BoundingBox &bbox)
 
ZPoints clip_clipper_polygon_with_subject_bbox (const ZPoints &src, const BoundingBox &bbox)
 
void clip_clipper_polygon_with_subject_bbox (const Polygon &src, const BoundingBox &bbox, Polygon &out)
 
Polygon clip_clipper_polygon_with_subject_bbox (const Polygon &src, const BoundingBox &bbox)
 
Polygons clip_clipper_polygons_with_subject_bbox (const Polygons &src, const BoundingBox &bbox)
 
Polygons clip_clipper_polygons_with_subject_bbox (const ExPolygon &src, const BoundingBox &bbox)
 

Typedef Documentation

◆ PolygonsProvider

◆ PolylinesProvider

◆ ZPoint

◆ ZPoints

using Slic3r::ClipperUtils::ZPoints = typedef std::vector<Vec3i32>

Function Documentation

◆ clip_clipper_polygon_with_subject_bbox() [1/6]

Points Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const Points src,
const BoundingBox bbox 
)
void clip_clipper_polygon_with_subject_bbox_templ(const PointsType &src, const BoundingBox &bbox, PointsType &out)
Definition ClipperUtils.cpp:69

References clip_clipper_polygon_with_subject_bbox_templ().

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox() [2/6]

void Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const Points src,
const BoundingBox bbox,
Points out 
)

References clip_clipper_polygon_with_subject_bbox_templ().

Referenced by clip_clipper_polygon_with_subject_bbox(), clip_clipper_polygon_with_subject_bbox(), clip_clipper_polygon_with_subject_bbox_templ(), clip_clipper_polygons_with_subject_bbox(), clip_clipper_polygons_with_subject_bbox(), and Slic3r::traverse_extrusions().

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

◆ clip_clipper_polygon_with_subject_bbox() [3/6]

Polygon Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const Polygon src,
const BoundingBox bbox 
)
146 {
147 Polygon out;
149 return out;
150 }
Points points
Definition MultiPoint.hpp:18
Definition Polygon.hpp:24
void clip_clipper_polygon_with_subject_bbox(const Points &src, const BoundingBox &bbox, Points &out)
Definition ClipperUtils.cpp:122

References clip_clipper_polygon_with_subject_bbox(), and Slic3r::MultiPoint::points.

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox() [4/6]

void Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const Polygon src,
const BoundingBox bbox,
Polygon out 
)
141 {
143 }

References clip_clipper_polygon_with_subject_bbox(), and Slic3r::MultiPoint::points.

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox() [5/6]

ZPoints Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const ZPoints src,
const BoundingBox bbox 
)

References clip_clipper_polygon_with_subject_bbox_templ().

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox() [6/6]

void Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox ( const ZPoints src,
const BoundingBox bbox,
ZPoints out 
)

References clip_clipper_polygon_with_subject_bbox_templ().

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox_templ() [1/2]

template<typename PointsType >
PointsType Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox_templ ( const PointsType &  src,
const BoundingBox bbox 
)
129 {
130 PointsType out;
132 return out;
133 }

References clip_clipper_polygon_with_subject_bbox().

+ Here is the call graph for this function:

◆ clip_clipper_polygon_with_subject_bbox_templ() [2/2]

template<typename PointsType >
void Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox_templ ( const PointsType &  src,
const BoundingBox bbox,
PointsType &  out 
)
inline
70 {
71 using PointType = typename PointsType::value_type;
72
73 out.clear();
74 const size_t cnt = src.size();
75 if (cnt < 3)
76 return;
77
78 enum class Side {
79 Left = 1,
80 Right = 2,
81 Top = 4,
82 Bottom = 8
83 };
84
85 auto sides = [bbox](const PointType &p) {
86 return int(p.x() < bbox.min.x()) * int(Side::Left) +
87 int(p.x() > bbox.max.x()) * int(Side::Right) +
88 int(p.y() < bbox.min.y()) * int(Side::Bottom) +
89 int(p.y() > bbox.max.y()) * int(Side::Top);
90 };
91
92 int sides_prev = sides(src.back());
93 int sides_this = sides(src.front());
94 const size_t last = cnt - 1;
95 for (size_t i = 0; i < last; ++ i) {
96 int sides_next = sides(src[i + 1]);
97 if (// This point is inside. Take it.
98 sides_this == 0 ||
99 // Either this point is outside and previous or next is inside, or
100 // the edge possibly cuts corner of the bounding box.
101 (sides_prev & sides_this & sides_next) == 0) {
102 out.emplace_back(src[i]);
103 sides_prev = sides_this;
104 } else {
105 // All the three points (this, prev, next) are outside at the same side.
106 // Ignore this point.
107 }
108 sides_this = sides_next;
109 }
110
111 // Never produce just a single point output polygon.
112 if (! out.empty())
113 if (int sides_next = sides(out.front());
114 // The last point is inside. Take it.
115 sides_this == 0 ||
116 // Either this point is outside and previous or next is inside, or
117 // the edge possibly cuts corner of the bounding box.
118 (sides_prev & sides_this & sides_next) == 0)
119 out.emplace_back(src.back());
120 }
PointType max
Definition BoundingBox.hpp:17
PointType min
Definition BoundingBox.hpp:16

References Slic3r::BoundingBoxBase< PointType, APointsType >::max, and Slic3r::BoundingBoxBase< PointType, APointsType >::min.

Referenced by clip_clipper_polygon_with_subject_bbox(), clip_clipper_polygon_with_subject_bbox(), clip_clipper_polygon_with_subject_bbox(), and clip_clipper_polygon_with_subject_bbox().

+ Here is the caller graph for this function:

◆ clip_clipper_polygons_with_subject_bbox() [1/2]

Polygons Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox ( const ExPolygon src,
const BoundingBox bbox 
)
164 {
165 Polygons out;
166 out.reserve(src.num_contours());
167 out.emplace_back(clip_clipper_polygon_with_subject_bbox(src.contour, bbox));
168 for (const Polygon &p : src.holes)
169 out.emplace_back(clip_clipper_polygon_with_subject_bbox(p, bbox));
170 out.erase(
171 std::remove_if(out.begin(), out.end(), [](const Polygon &polygon) { return polygon.empty(); }),
172 out.end());
173 return out;
174 }
Polygon contour
Definition ExPolygon.hpp:35
size_t num_contours() const
Definition ExPolygon.hpp:80
std::vector< Polygon, PointsAllocator< Polygon > > Polygons
Definition Polygon.hpp:15

References clip_clipper_polygon_with_subject_bbox(), Slic3r::ExPolygon::contour, Slic3r::ExPolygon::holes, and Slic3r::ExPolygon::num_contours().

+ Here is the call graph for this function:

◆ clip_clipper_polygons_with_subject_bbox() [2/2]

Polygons Slic3r::ClipperUtils::clip_clipper_polygons_with_subject_bbox ( const Polygons src,
const BoundingBox bbox 
)
153 {
154 Polygons out;
155 out.reserve(src.size());
156 for (const Polygon &p : src)
157 out.emplace_back(clip_clipper_polygon_with_subject_bbox(p, bbox));
158 out.erase(
159 std::remove_if(out.begin(), out.end(), [](const Polygon &polygon) { return polygon.empty(); }),
160 out.end());
161 return out;
162 }

References clip_clipper_polygon_with_subject_bbox().

Referenced by Slic3r::diff_clipped(), Slic3r::SupportSpotsGenerator::estimate_slice_connection(), Slic3r::generate_extra_perimeters_over_overhangs(), Slic3r::intersection_clipped(), Slic3r::Algorithm::propagate_wave_from_boundary(), Slic3r::FFFTreeSupport::safe_offset_inc(), Slic3r::RetractWhenCrossingPerimeters::travel_inside_internal_regions(), and Slic3r::traverse_loops_classic().

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