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

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

Inheritance diagram for Slic3r::Polyline:
Collaboration diagram for Slic3r::Polyline:

Public Member Functions

 Polyline ()
 Polyline (const Polyline &other)
 Polyline (Polyline &&other) noexcept
 Polyline (std::initializer_list< Point > list)
 Polyline (const Point &p1, const Point &p2)
 Polyline (const Points &points)
 Polyline (Points &&points)
Polyline & operator= (const Polyline &other)
Polyline & operator= (Polyline &&other) noexcept
void append (const Point &point)
void append_before (const Point &point)
void append (const Points &src)
void append (const Points::const_iterator &begin, const Points::const_iterator &end)
void append (Points &&src)
void append (const Polyline &src)
void append (Polyline &&src)
Point & operator[] (Points::size_type idx)
const Point & operator[] (Points::size_type idx) const
const Point & last_point () const override
const Point & leftmost_point () const
Lines lines () const override
void clear ()
void reverse ()
void clip_end (double distance)
void clip_start (double distance)
void extend_end (double distance)
void extend_start (double distance)
Points equally_spaced_points (double distance) const
void simplify (double tolerance)
void split_at (Point &point, Polyline *p1, Polyline *p2) const
bool split_at_index (const size_t index, Polyline *p1, Polyline *p2) const
bool split_at_length (const double length, Polyline *p1, Polyline *p2) const
bool is_straight () const
bool is_closed () const
void simplify_by_fitting_arc (double tolerance)
void reset_to_linear_move ()
Polylines equally_spaced_lines (double distance) const
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 cos_angle, double sin_angle)
void rotate (double angle, const Point &center)
const Point & front () const
const Point & back () const
const Point & first_point () const
size_t size () const
bool empty () const
double length () const
bool is_valid () const
int find_point (const Point &point) const
int find_point (const Point &point, const double scaled_epsilon) const
bool has_boundary_point (const Point &point) const
int closest_point_index (const Point &point) const
const Point * closest_point (const Point &point) const
double distance_to (const Point &point) const
BoundingBox bounding_box () const
bool has_duplicate_points () const
bool remove_duplicate_points ()
bool intersection (const Line &line, Point *intersection) const
bool first_intersection (const Line &line, Point *intersection) const
bool intersections (const Line &line, Points *intersections) const
void symmetric_y (const coord_t &y_axis)
auto begin ()
auto begin () const
auto end ()
auto end () const
auto cbegin () const
auto cend () const

Static Public Member Functions

static Polyline new_scale (const std::vector< Vec2d > &points)
static Points _douglas_peucker (const Points &points, const double tolerance)
static Points visivalingam (const Points &pts, const double tolerance)
static Points concave_hull_2d (const Points &pts, const double tolerence)
static double minimumDistanceBetweenLinesDefinedByPoints (const Points &A, const Points &B)
 Calculates the minimum distance between two lines defined by sets of points.

Public Attributes

std::vector< PathFittingData > fitting_result
Points points

Private Member Functions

void append_fitting_result_after_append_points ()
void append_fitting_result_after_append_polyline (const Polyline &src)
bool split_fitting_result_before_index (const size_t index, Point &new_endpoint, std::vector< PathFittingData > &data) const
bool split_fitting_result_after_index (const size_t index, Point &new_startpoint, std::vector< PathFittingData > &data) const

Static Private Member Functions

static double squaredDistanceToLineSegment (const Point &p, const Point &v, const Point &w)
 Calculates the squared distance between a point and a line segment defined by two points.

Detailed Description

Constructor & Destructor Documentation

◆ Polyline() [1/7]

Slic3r::Polyline::Polyline ( )
inline
27{};

Referenced by Polyline(), Polyline(), append(), append(), append_fitting_result_after_append_polyline(), equally_spaced_lines(), new_scale(), operator=(), operator=(), split_at(), split_at_index(), and split_at_length().

Here is the caller graph for this function:

◆ Polyline() [2/7]

Slic3r::Polyline::Polyline ( const Polyline & other)
inline
28: MultiPoint(other.points), fitting_result(other.fitting_result) {}
MultiPoint()
Definition MultiPoint.hpp:24
std::vector< PathFittingData > fitting_result
Definition Polyline.hpp:135

References Slic3r::MultiPoint::MultiPoint(), Polyline(), fitting_result, and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ Polyline() [3/7]

Slic3r::Polyline::Polyline ( Polyline && other)
inlinenoexcept
29: MultiPoint(std::move(other.points)), fitting_result(std::move(other.fitting_result)) {}

References Polyline().

Here is the call graph for this function:

◆ Polyline() [4/7]

Slic3r::Polyline::Polyline ( std::initializer_list< Point > list)
inline
30 : MultiPoint(list) {
31 fitting_result.clear();
32 }

References Slic3r::MultiPoint::MultiPoint(), and fitting_result.

Here is the call graph for this function:

◆ Polyline() [5/7]

Slic3r::Polyline::Polyline ( const Point & p1,
const Point & p2 )
inlineexplicit
33 {
34 points.reserve(2);
35 points.emplace_back(p1);
36 points.emplace_back(p2);
37 fitting_result.clear();
38 }
Points points
Definition MultiPoint.hpp:22

References fitting_result, and Slic3r::MultiPoint::points.

◆ Polyline() [6/7]

Slic3r::Polyline::Polyline ( const Points & points)
inlineexplicit
40 fitting_result.clear();
41 }

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

Here is the call graph for this function:

◆ Polyline() [7/7]

Slic3r::Polyline::Polyline ( Points && points)
inlineexplicit
42 : MultiPoint(std::move(points)) {
43 fitting_result.clear();
44 }

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

Here is the call graph for this function:

Member Function Documentation

◆ _douglas_peucker()

Points Slic3r::MultiPoint::_douglas_peucker ( const Points & points,
const double tolerance )
staticinherited
176{
177 Points result_pts;
178 double tolerance_sq = tolerance * tolerance;
179 if (! pts.empty()) {
180 const Point *anchor = &pts.front();
181 size_t anchor_idx = 0;
182 const Point *floater = &pts.back();
183 size_t floater_idx = pts.size() - 1;
184 result_pts.reserve(pts.size());
185 result_pts.emplace_back(*anchor);
186 if (anchor_idx != floater_idx) {
187 assert(pts.size() > 1);
188 std::vector<size_t> dpStack;
189 dpStack.reserve(pts.size());
190 dpStack.emplace_back(floater_idx);
191 for (;;) {
192 double max_dist_sq = 0.0;
193 size_t furthest_idx = anchor_idx;
194 // find point furthest from line seg created by (anchor, floater) and note it
195 for (size_t i = anchor_idx + 1; i < floater_idx; ++ i) {
196 double dist_sq = Line::distance_to_squared(pts[i], *anchor, *floater);
197 if (dist_sq > max_dist_sq) {
198 max_dist_sq = dist_sq;
199 furthest_idx = i;
200 }
201 }
202 // remove point if less than tolerance
203 if (max_dist_sq <= tolerance_sq) {
204 result_pts.emplace_back(*floater);
205 anchor_idx = floater_idx;
206 anchor = floater;
207 assert(dpStack.back() == floater_idx);
208 dpStack.pop_back();
209 if (dpStack.empty())
210 break;
211 floater_idx = dpStack.back();
212 } else {
213 floater_idx = furthest_idx;
214 dpStack.emplace_back(floater_idx);
215 }
216 floater = &pts[floater_idx];
217 }
218 }
219 assert(result_pts.front() == pts.front());
220 assert(result_pts.back() == pts.back());
221
222#if 0
223 {
224 static int iRun = 0;
225 BoundingBox bbox(pts);
226 BoundingBox bbox2(result_pts);
227 bbox.merge(bbox2);
228 SVG svg(debug_out_path("douglas_peucker_%d.svg", iRun ++).c_str(), bbox);
229 if (pts.front() == pts.back())
230 svg.draw(Polygon(pts), "black");
231 else
232 svg.draw(Polyline(pts), "black");
233 if (result_pts.front() == result_pts.back())
234 svg.draw(Polygon(result_pts), "green", scale_(0.1));
235 else
236 svg.draw(Polyline(result_pts), "green", scale_(0.1));
237 }
238#endif
239 }
240 return result_pts;
241}
double distance_to_squared(const Point &point) const
Definition Line.hpp:170
#define scale_(val)
Definition libslic3r.h:106
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
std::string debug_out_path(const char *name,...)
Definition utils.cpp:382
std::vector< Point, PointsAllocator< Point > > Points
Definition Point.hpp:73
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References Slic3r::debug_out_path(), Slic3r::Line::distance_to_squared(), Slic3r::SVG::draw(), Slic3r::BoundingBoxBase< PointType, APointsType >::merge(), and scale_.

Referenced by Slic3r::ArcFitter::do_arc_fitting_and_simplify(), Slic3r::Polygon::douglas_peucker(), Slic3r::GUI::GLGizmoBrimEars::generate_points(), Slic3r::GUI::GLGizmoBrimEars::get_detection_radius_max(), Slic3r::make_brim_ears_auto(), Slic3r::polygons_simplify(), Slic3r::Polygon::simplify(), Slic3r::Polyline::simplify(), Slic3r::ExPolygon::simplify_p(), and Slic3r::Geometry::simplify_polygons().

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

◆ append() [1/6]

void Slic3r::Polyline::append ( const Point & point)
inline
65 {
66 //BBS: don't need to append same point
67 if (!this->empty() && this->last_point() == point)
68 return;
69 MultiPoint::append(point);
71 }
void append(const Point &point)
Definition MultiPoint.hpp:90
bool empty() const
Definition MultiPoint.hpp:51
void append_fitting_result_after_append_points()
Definition Polyline.cpp:417
const Point & last_point() const override
Definition Polyline.hpp:114

References Slic3r::MultiPoint::append(), append_fitting_result_after_append_points(), Slic3r::MultiPoint::empty(), and last_point().

Referenced by append(), append(), append(), append_before(), Slic3r::append_path(), Slic3r::Wipe::calculateWipeRetractionLengths(), Slic3r::FillAdaptive::connect_lines_using_hooks(), equally_spaced_lines(), extend_end(), Slic3r::LoopInterfaceProcessor::generate(), Slic3r::GCode::needs_retraction(), Slic3r::reconnect_polylines(), split_at(), split_at_index(), split_at_length(), anonymous_namespace{NSVGUtils.cpp}::to_dashes(), Slic3r::to_polyline(), Slic3r::GCode::travel_to(), and Slic3r::Wipe::wipe().

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

◆ append() [2/6]

void Slic3r::Polyline::append ( const Points & src)
inline
88 {
89 //BBS: don't need to append same point
90 if (!this->empty() && !src.empty() && this->last_point() == src[0])
91 this->append(src.begin() + 1, src.end());
92 else
93 this->append(src.begin(), src.end());
94 }
void append(const Point &point)
Definition Polyline.hpp:65

References append(), and Slic3r::MultiPoint::empty().

Here is the call graph for this function:

◆ append() [3/6]

void Slic3r::Polyline::append ( const Points::const_iterator & begin,
const Points::const_iterator & end )
inline
95 {
96 //BBS: don't need to append same point
97 if (!this->empty() && begin != end && this->last_point() == *begin)
99 else
102 }
auto begin()
Definition MultiPoint.hpp:114
auto end()
Definition MultiPoint.hpp:116

References Slic3r::MultiPoint::append(), append_fitting_result_after_append_points(), Slic3r::MultiPoint::begin(), Slic3r::MultiPoint::empty(), Slic3r::MultiPoint::end(), and last_point().

Here is the call graph for this function:

◆ append() [4/6]

void Slic3r::Polyline::append ( const Polyline & src)
370{
371 if (!src.is_valid()) return;
372
373 if (this->points.empty()) {
374 this->points = src.points;
375 this->fitting_result = src.fitting_result;
376 } else {
377 //BBS: append the first point to create connection first, update the fitting date as well
378 this->append(src.points[0]);
379 //BBS: append a polyline which has fitting data to a polyline without fitting data.
380 //Then create a fake fitting data first, so that we can keep the fitting data in last polyline
381 if (this->fitting_result.empty() &&
382 !src.fitting_result.empty()) {
383 this->fitting_result.emplace_back(PathFittingData{ 0, this->points.size() - 1, EMovePathType::Linear_move, ArcSegment() });
384 }
385 //BBS: then append the remain points
386 MultiPoint::append(src.points.begin() + 1, src.points.end());
387 //BBS: finally append the fitting data
389 }
390}
void append_fitting_result_after_append_polyline(const Polyline &src)
Definition Polyline.cpp:430
@ Linear_move
Definition ArcFitter.hpp:15

References Polyline(), Slic3r::MultiPoint::append(), append(), append_fitting_result_after_append_polyline(), fitting_result, Slic3r::MultiPoint::is_valid(), Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ append() [5/6]

void Slic3r::Polyline::append ( Points && src)
inline
104 {
105 MultiPoint::append(std::move(src));
107 }

References Slic3r::MultiPoint::append(), and append_fitting_result_after_append_points().

Here is the call graph for this function:

◆ append() [6/6]

void Slic3r::Polyline::append ( Polyline && src)
393{
394 if (!src.is_valid()) return;
395
396 if (this->points.empty()) {
397 this->points = std::move(src.points);
398 this->fitting_result = std::move(src.fitting_result);
399 } else {
400 //BBS: append the first point to create connection first, update the fitting date as well
401 this->append(src.points[0]);
402 //BBS: append a polyline which has fitting data to a polyline without fitting data.
403 //Then create a fake fitting data first, so that we can keep the fitting data in last polyline
404 if (this->fitting_result.empty() &&
405 !src.fitting_result.empty()) {
406 this->fitting_result.emplace_back(PathFittingData{ 0, this->points.size() - 1, EMovePathType::Linear_move, ArcSegment() });
407 }
408 //BBS: then append the remain points
409 MultiPoint::append(src.points.begin() + 1, src.points.end());
410 //BBS: finally append the fitting data
412 src.points.clear();
413 src.fitting_result.clear();
414 }
415}

References Polyline(), Slic3r::MultiPoint::append(), append(), append_fitting_result_after_append_polyline(), fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ append_before()

void Slic3r::Polyline::append_before ( const Point & point)
inline
73 {
74 //BBS: don't need to append same point
75 if (!this->empty() && this->first_point() == point)
76 return;
77 if (this->size() == 1) {
78 this->fitting_result.clear();
79 MultiPoint::append(point);
81 } else {
82 this->reverse();
83 this->append(point);
84 this->reverse();
85 }
86 }
void reverse()
Definition MultiPoint.hpp:43
const Point & first_point() const
Definition MultiPoint.hpp:47
size_t size() const
Definition MultiPoint.hpp:50
void reverse()
Definition Polyline.cpp:43

References Slic3r::MultiPoint::append(), append(), Slic3r::MultiPoint::empty(), Slic3r::MultiPoint::first_point(), fitting_result, Slic3r::MultiPoint::reverse(), reverse(), and Slic3r::MultiPoint::size().

Referenced by split_at(), and split_at_length().

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

◆ append_fitting_result_after_append_points()

void Slic3r::Polyline::append_fitting_result_after_append_points ( )
private
417 {
418 if (!fitting_result.empty()) {
419 if (fitting_result.back().is_linear_move()) {
420 fitting_result.back().end_point_index = this->points.size() - 1;
421 } else {
422 size_t new_start = fitting_result.back().end_point_index;
423 size_t new_end = this->points.size() - 1;
424 if (new_start != new_end)
425 fitting_result.emplace_back(PathFittingData{ new_start, new_end, EMovePathType::Linear_move, ArcSegment() });
426 }
427 }
428}

References fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Referenced by append(), append(), and append().

Here is the caller graph for this function:

◆ append_fitting_result_after_append_polyline()

void Slic3r::Polyline::append_fitting_result_after_append_polyline ( const Polyline & src)
private
431{
432 if (!this->fitting_result.empty()) {
433 //BBS: offset and save the fitting_result from src polyline
434 if (!src.fitting_result.empty()) {
435 size_t old_size = this->fitting_result.size();
436 size_t index_offset = this->fitting_result.back().end_point_index;
437 this->fitting_result.insert(this->fitting_result.end(), src.fitting_result.begin(), src.fitting_result.end());
438 for (size_t i = old_size; i < this->fitting_result.size(); i++) {
439 this->fitting_result[i].start_point_index += index_offset;
440 this->fitting_result[i].end_point_index += index_offset;
441 }
442 } else {
443 //BBS: the append polyline has no fitting data, then append as linear move directly
444 size_t new_start = this->fitting_result.back().end_point_index;
445 size_t new_end = this->size() - 1;
446 if (new_start != new_end)
447 this->fitting_result.emplace_back(PathFittingData{ new_start, new_end, EMovePathType::Linear_move, ArcSegment() });
448 }
449 }
450}

References Polyline(), fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::size().

Referenced by append(), and append().

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

◆ back()

const Point & Slic3r::MultiPoint::back ( ) const
inlineinherited
46{ return this->points.back(); }

Referenced by Slic3r::Arachne::removeDegenerateVerts(), Slic3r::FillLightning::Node::removeJunctionOverlap(), Slic3r::GCode::travel_to(), and Slic3r::tree_supports_generate_paths().

Here is the caller graph for this function:

◆ begin() [1/2]

auto Slic3r::MultiPoint::begin ( )
inlineinherited
114{ return points.begin(); }

References points.

Referenced by append(), Slic3r::Polyline::append(), Slic3r::generate_transform_pattern(), and Slic3r::Polyline::split_at_index().

Here is the caller graph for this function:

◆ begin() [2/2]

auto Slic3r::MultiPoint::begin ( ) const
inlineinherited
115{ return points.begin(); }

References points.

◆ bounding_box()

◆ cbegin()

auto Slic3r::MultiPoint::cbegin ( ) const
inlineinherited
118{ return points.begin(); }

References points.

◆ cend()

auto Slic3r::MultiPoint::cend ( ) const
inlineinherited
119{ return points.end(); }

References points.

◆ clear()

void Slic3r::Polyline::clear ( )
inline
118{ MultiPoint::clear(); this->fitting_result.clear(); }
void clear()
Definition MultiPoint.hpp:89

References Slic3r::MultiPoint::clear(), and fitting_result.

Referenced by Slic3r::ThickPolyline::clear(), Slic3r::TreeSupport3D::ensure_maximum_distance_polyline(), equally_spaced_lines(), Slic3r::evaluate_support_arches(), split_at_index(), split_at_length(), and anonymous_namespace{NSVGUtils.cpp}::to_dashes().

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

◆ clip_end()

void Slic3r::Polyline::clip_end ( double distance)
62{
63 bool last_point_inserted = false;
64 size_t remove_after_index = MultiPoint::size();
65 while (distance > 0) {
66 Vec2d last_point = this->last_point().cast<double>();
67 this->points.pop_back();
68 remove_after_index--;
69 if (this->points.empty()) {
70 this->fitting_result.clear();
71 return;
72 }
73 Vec2d v = this->last_point().cast<double>() - last_point;
74 double lsqr = v.squaredNorm();
75 if (lsqr > distance * distance) {
76 this->points.emplace_back((last_point + v * (distance / sqrt(lsqr))).cast<coord_t>());
77 last_point_inserted = true;
78 break;
79 }
80 distance -= sqrt(lsqr);
81 }
82
83 //BBS: don't need to clip fitting result if it's empty
84 if (fitting_result.empty())
85 return;
86 while (!fitting_result.empty() && fitting_result.back().start_point_index >= remove_after_index)
87 fitting_result.pop_back();
88 if (!fitting_result.empty()) {
89 //BBS: last remaining segment is arc move, then clip the arc at last point
90 if (fitting_result.back().path_type == EMovePathType::Arc_move_ccw
91 || fitting_result.back().path_type == EMovePathType::Arc_move_cw) {
92 if (fitting_result.back().arc_data.clip_end(this->last_point()))
93 //BBS: succeed to clip arc, then update the last point
94 this->points.back() = fitting_result.back().arc_data.end_point;
95 else
96 //BBS: Failed to clip arc, then back to linear move
98 }
99 fitting_result.back().end_point_index = this->points.size() - 1;
100 }
101}
float distance(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:19
@ Arc_move_cw
Definition ArcFitter.hpp:16
@ Arc_move_ccw
Definition ArcFitter.hpp:17
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299

References Slic3r::Arc_move_ccw, Slic3r::Arc_move_cw, Slic3r::cast(), fitting_result, last_point(), Slic3r::Linear_move, Slic3r::MultiPoint::points, and Slic3r::MultiPoint::size().

Referenced by Slic3r::clip_path_end(), clip_start(), Slic3r::Fill::connect_base_support(), Slic3r::draw_perimeters(), Slic3r::TreeSupport3D::ensure_maximum_distance_polyline(), Slic3r::offset_wipe_path(), Slic3r::store_wipe_path(), Slic3r::tree_supports_generate_paths(), and Slic3r::Wipe::wipe().

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

◆ clip_start()

void Slic3r::Polyline::clip_start ( double distance)
105{
106 this->reverse();
107 this->clip_end(distance);
108 if (this->points.size() >= 2)
109 this->reverse();
110}
void clip_end(double distance)
Definition Polyline.cpp:61

References clip_end(), Slic3r::MultiPoint::points, and reverse().

Referenced by Slic3r::Fill::connect_base_support().

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

◆ closest_point()

const Point * Slic3r::MultiPoint::closest_point ( const Point & point) const
inlineinherited
77{ return this->points.empty() ? nullptr : &this->points[this->closest_point_index(point)]; }
int closest_point_index(const Point &point) const
Definition MultiPoint.hpp:62

References closest_point_index().

Referenced by distance_to().

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

◆ closest_point_index()

int Slic3r::MultiPoint::closest_point_index ( const Point & point) const
inlineinherited
62 {
63 int idx = -1;
64 if (! this->points.empty()) {
65 idx = 0;
66 double dist_min = (point - this->points.front()).cast<double>().norm();
67 for (int i = 1; i < int(this->points.size()); ++ i) {
68 double d = (this->points[i] - point).cast<double>().norm();
69 if (d < dist_min) {
70 dist_min = d;
71 idx = i;
72 }
73 }
74 }
75 return idx;
76 }

References Slic3r::cast().

Referenced by closest_point(), and Slic3r::remove_points_from_polygon().

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

◆ concave_hull_2d()

Points Slic3r::MultiPoint::concave_hull_2d ( const Points & pts,
const double tolerence )
staticinherited
365{
366 Points hull;
367 int n = (int)pts.size();
368 if (n >= 3) {
369 int k = 0;
370 hull.resize(n);
371 for (int i = 0; i < n; ++i) {
372 while (k >= 2 && pts[i].ccw(hull[k - 2], hull[k - 1]) <= 0 && -pts[i].ccw(hull[k - 2], hull[k - 1]) / (pts[i] - hull[k - 1]).norm() < tolerence)
373 --k;
374 hull[k++] = pts[i];
375 }
376 hull.resize(k);
377 if (hull.front() == hull.back())
378 hull.pop_back();
379 }
380 return hull;
381}

◆ distance_to()

double Slic3r::MultiPoint::distance_to ( const Point & point) const
inlineinherited
80 {
81 const Point* cl = closest_point(point);
82 return (*cl - point).cast<double>().norm();
83 }
const Point * closest_point(const Point &point) const
Definition MultiPoint.hpp:77

References closest_point().

Here is the call graph for this function:

◆ empty()

◆ end() [1/2]

auto Slic3r::MultiPoint::end ( )
inlineinherited
116{ return points.end(); }

References points.

Referenced by append(), Slic3r::Polyline::append(), and Slic3r::generate_transform_pattern().

Here is the caller graph for this function:

◆ end() [2/2]

auto Slic3r::MultiPoint::end ( ) const
inlineinherited
117{ return points.end(); }

References points.

◆ equally_spaced_lines()

Polylines Slic3r::Polyline::equally_spaced_lines ( double distance) const
168{
170 Polyline line;
171 line.append(this->first_point());
172 double len = 0;
173
174 for (Points::const_iterator it = this->points.begin() + 1; it != this->points.end(); ++it) {
175 Vec2d p1 = line.points.back().cast<double>();
176 Vec2d v = it->cast<double>() - p1;
177 double segment_length = v.norm();
178 len += segment_length;
179 if (len < distance)
180 continue;
181 if (len == distance) {
182 line.append(*it);
183 lines.emplace_back(line);
184
185 line.clear();
186 line.append(*it);
187 len = 0;
188 continue;
189 }
190 double take = distance; // how much we take of this segment
191 line.append((p1 + v * (take / v.norm())).cast<coord_t>());
192 lines.emplace_back(line);
193
194 line.clear();
195 line.append(lines.back().last_point());
196 --it;
197 len = -take;
198 }
199 // add the last reminder
200 if (line.size() == 1) {
201 line.append(this->last_point());
202 if(line.first_point()!=line.last_point())
203 lines.emplace_back(line);
204 }
205 return lines;
206}
Polyline()
Definition Polyline.hpp:27
Lines lines() const override
Definition Polyline.cpp:31
int64_t coord_t
Definition libslic3r.h:48
std::vector< Polyline > Polylines
Definition Polyline.hpp:22
static void take(Polyline &pl1, const Polyline &pl2, const Points &contour, size_t idx_start, size_t idx_end, bool clockwise)
Definition FillBase.cpp:642
static coordf_t segment_length(const Polygon &poly, size_t seg1, const Point &p1, size_t seg2, const Point &p2)
Definition FillRectilinear.cpp:64

References Polyline(), append(), clear(), Slic3r::MultiPoint::first_point(), last_point(), lines(), Slic3r::MultiPoint::points, Slic3r::segment_length(), Slic3r::MultiPoint::size(), and Slic3r::take().

Here is the call graph for this function:

◆ equally_spaced_points()

Points Slic3r::Polyline::equally_spaced_points ( double distance) const
130{
132 points.emplace_back(this->first_point());
133 double len = 0;
134
135 for (Points::const_iterator it = this->points.begin() + 1; it != this->points.end(); ++it) {
136 Vec2d p1 = (it-1)->cast<double>();
137 Vec2d v = it->cast<double>() - p1;
138 double segment_length = v.norm();
139 len += segment_length;
140 if (len < distance)
141 continue;
142 if (len == distance) {
143 points.emplace_back(*it);
144 len = 0;
145 continue;
146 }
147 double take = segment_length - (len - distance); // how much we take of this segment
148 points.emplace_back((p1 + v * (take / v.norm())).cast<coord_t>());
149 -- it;
150 len = - take;
151 }
152 return points;
153}

References Slic3r::cast(), Slic3r::MultiPoint::first_point(), Slic3r::MultiPoint::points, Slic3r::segment_length(), and Slic3r::take().

Referenced by Slic3r::Polygon::equally_spaced_points().

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

◆ extend_end()

void Slic3r::Polyline::extend_end ( double distance)
113{
114 //BBS: append a new last point by extending the last segment by the specified length
115 Vec2d v = (this->points.back() - *(this->points.end() - 2)).cast<double>().normalized();
116 Point new_last_point = this->points.back() + (v * distance).cast<coord_t>();
117 this->append(new_last_point);
118}

References append(), Slic3r::cast(), and Slic3r::MultiPoint::points.

Referenced by extend_start().

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

◆ extend_start()

void Slic3r::Polyline::extend_start ( double distance)
121{
122 this->reverse();
123 this->extend_end(distance);
124 this->reverse();
125}
void extend_end(double distance)
Definition Polyline.cpp:112

References extend_end(), and reverse().

Here is the call graph for this function:

◆ find_point() [1/2]

int Slic3r::MultiPoint::find_point ( const Point & point) const
inherited
70{
71 for (const Point &pt : this->points)
72 if (pt == point)
73 return int(&pt - &this->points.front());
74 return -1; // not found
75}

References points.

Referenced by find_point(), Slic3r::Polyline::split_at(), and Slic3r::Polyline::split_at_length().

Here is the caller graph for this function:

◆ find_point() [2/2]

int Slic3r::MultiPoint::find_point ( const Point & point,
const double scaled_epsilon ) const
inherited
78{
79 if (scaled_epsilon == 0) return this->find_point(point);
80
81 auto dist2_min = std::numeric_limits<double>::max();
82 auto eps2 = scaled_epsilon * scaled_epsilon;
83 int idx_min = -1;
84 for (const Point &pt : this->points) {
85 double d2 = (pt - point).cast<double>().squaredNorm();
86 if (d2 < dist2_min) {
87 idx_min = int(&pt - &this->points.front());
88 dist2_min = d2;
89 }
90 }
91 return dist2_min < eps2 ? idx_min : -1;
92}
int find_point(const Point &point) const
Definition MultiPoint.cpp:69

References Slic3r::cast(), find_point(), and points.

Here is the call graph for this function:

◆ first_intersection()

bool Slic3r::MultiPoint::first_intersection ( const Line & line,
Point * intersection ) const
inherited
142{
143 bool found = false;
144 double dmin = 0.;
145 for (const Line &l : this->lines()) {
146 Point ip;
147 if (l.intersection(line, &ip)) {
148 if (! found) {
149 found = true;
150 dmin = (line.a - ip).cast<double>().norm();
151 *intersection = ip;
152 } else {
153 double d = (line.a - ip).cast<double>().norm();
154 if (d < dmin) {
155 dmin = d;
156 *intersection = ip;
157 }
158 }
159 }
160 }
161 return found;
162}
bool intersection(const Line &line, Point *intersection) const
Definition MultiPoint.cpp:132
virtual Lines lines() const =0

References Slic3r::Line::a, Slic3r::cast(), intersection(), and lines().

Here is the call graph for this function:

◆ first_point()

◆ front()

const Point & Slic3r::MultiPoint::front ( ) const
inlineinherited
45{ return this->points.front(); }

Referenced by first_point(), Slic3r::Algorithm::merge_expansions_into_expolygons(), and Slic3r::precompute_expolygon_distances().

Here is the caller graph for this function:

◆ has_boundary_point()

bool Slic3r::MultiPoint::has_boundary_point ( const Point & point) const
inherited
95{
96 double dist = (point.projection_onto(*this) - point).cast<double>().norm();
97 return dist < SCALED_EPSILON;
98}
#define SCALED_EPSILON
Definition libslic3r.h:109
T dist(const boost::polygon::point_data< T > &p1, const boost::polygon::point_data< T > &p2)
Definition Geometry.cpp:298

References Slic3r::Geometry::dist(), Slic3r::Point::projection_onto(), and SCALED_EPSILON.

Here is the call graph for this function:

◆ has_duplicate_points()

bool Slic3r::MultiPoint::has_duplicate_points ( ) const
inherited
106{
107 for (size_t i = 1; i < points.size(); ++i)
108 if (points[i-1] == points[i])
109 return true;
110 return false;
111}

References points.

Referenced by Slic3r::polylines_from_paths(), and Slic3r::traverse_graph_generate_polylines().

Here is the caller graph for this function:

◆ intersection()

bool Slic3r::MultiPoint::intersection ( const Line & line,
Point * intersection ) const
inherited
133{
134 Lines lines = this->lines();
135 for (Lines::const_iterator it = lines.begin(); it != lines.end(); ++it) {
136 if (it->intersection(line, intersection)) return true;
137 }
138 return false;
139}
std::vector< Line > Lines
Definition Line.hpp:20

References intersection(), and lines().

Referenced by first_intersection(), intersection(), and intersections().

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

◆ intersections()

bool Slic3r::MultiPoint::intersections ( const Line & line,
Points * intersections ) const
inherited
165{
166 size_t intersections_size = intersections->size();
167 for (const Line &polygon_line : this->lines()) {
169 if (polygon_line.intersection(line, &intersection))
170 intersections->emplace_back(std::move(intersection));
171 }
172 return intersections->size() > intersections_size;
173}
bool intersections(const Line &line, Points *intersections) const
Definition MultiPoint.cpp:164

References intersection(), intersections(), and lines().

Referenced by intersections().

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

◆ is_closed()

bool Slic3r::Polyline::is_closed ( ) const
inline
132{ return this->points.front() == this->points.back(); }

References Slic3r::MultiPoint::points.

Referenced by Slic3r::connect_brim_lines(), and Slic3r::optimize_polylines_by_reversing().

Here is the caller graph for this function:

◆ is_straight()

bool Slic3r::Polyline::is_straight ( ) const
358{
359 // Check that each segment's direction is equal to the line connecting
360 // first point and last point. (Checking each line against the previous
361 // one would cause the error to accumulate.)
362 double dir = Line(this->first_point(), this->last_point()).direction();
363 for (const auto &line: this->lines())
364 if (! line.parallel_to(dir))
365 return false;
366 return true;
367}

References Slic3r::Line::direction(), Slic3r::MultiPoint::first_point(), last_point(), and lines().

Here is the call graph for this function:

◆ is_valid()

bool Slic3r::MultiPoint::is_valid ( ) const
inlineinherited
53{ return this->points.size() >= 2; }

Referenced by Slic3r::Polyline::append(), and Slic3r::Polyline::split_at().

Here is the caller graph for this function:

◆ last_point()

◆ leftmost_point()

const Point & Slic3r::Polyline::leftmost_point ( ) const
22{
23 const Point *p = &this->points.front();
24 for (Points::const_iterator it = this->points.begin() + 1; it != this->points.end(); ++ it) {
25 if (it->x() < p->x())
26 p = &(*it);
27 }
28 return *p;
29}

References Slic3r::MultiPoint::points.

◆ length()

double Slic3r::MultiPoint::length ( ) const
inherited
60{
61 const Lines& lines = this->lines();
62 double len = 0;
63 for (auto it = lines.cbegin(); it != lines.cend(); ++it) {
64 len += it->length();
65 }
66 return len;
67}

References lines().

Referenced by Slic3r::PreciseSeam::detail::append_fragment(), Slic3r::Wipe::calculateWipeRetractionLengths(), Slic3r::FillAdaptive::connect_lines_using_hooks(), Slic3r::make_adaptive_tpms(), Slic3r::ExPolygon::medial_axis(), Slic3r::GCode::needs_retraction(), Slic3r::offset_wipe_path(), Slic3r::Polyline::split_at_length(), Slic3r::store_wipe_path(), Slic3r::AvoidCrossingPerimeters::travel_to(), Slic3r::GCode::travel_to(), and Slic3r::Wipe::wipe().

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

◆ lines()

Lines Slic3r::Polyline::lines ( ) const
overridevirtual

Implements Slic3r::MultiPoint.

32{
34 if (this->points.size() >= 2) {
35 lines.reserve(this->points.size() - 1);
36 for (Points::const_iterator it = this->points.begin(); it != this->points.end()-1; ++it) {
37 lines.push_back(Line(*it, *(it + 1)));
38 }
39 }
40 return lines;
41}

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

Referenced by Slic3r::WipeInwardSupport::append(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), Slic3r::LinesBucket::curLines(), equally_spaced_lines(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), is_straight(), lines(), Slic3r::paths_touch(), split_at(), split_at_length(), Slic3r::ThickPolyline::thicklines(), and Slic3r::Wipe::wipe().

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

◆ minimumDistanceBetweenLinesDefinedByPoints()

double Slic3r::MultiPoint::minimumDistanceBetweenLinesDefinedByPoints ( const Points & A,
const Points & B )
staticinherited

Calculates the minimum distance between two lines defined by sets of points.

Parameters
AThe first set of points defining a polyline.
BThe second set of points defining a polyline.
Returns
double The minimum distance between the two polylines.
414 {
415 double min_distance = std::numeric_limits<double>::infinity();
416
417 // Calculate the minimum distance between segments in A and points in B
418 for (size_t i = 0; i < A.size() - 1; ++i) {
419 for (const auto& b : B) {
420 double distance = squaredDistanceToLineSegment(b, A[i], A[i + 1]);
421 min_distance = std::min(min_distance, std::sqrt(distance));
422 }
423 }
424
425 // Calculate the minimum distance between segments in B and points in A
426 for (size_t i = 0; i < B.size() - 1; ++i) {
427 for (const auto& a : A) {
428 double distance = squaredDistanceToLineSegment(a, B[i], B[i + 1]);
429 min_distance = std::min(min_distance, std::sqrt(distance));
430 }
431 }
432
433 return min_distance;
434}
static double squaredDistanceToLineSegment(const Point &p, const Point &v, const Point &w)
Calculates the squared distance between a point and a line segment defined by two points.
Definition MultiPoint.cpp:393

References squaredDistanceToLineSegment().

Here is the call graph for this function:

◆ new_scale()

Polyline Slic3r::Polyline::new_scale ( const std::vector< Vec2d > & points)
inlinestatic
55 {
56 Polyline pl;
57 pl.points.reserve(points.size());
58 for (const Vec2d &pt : points)
59 pl.points.emplace_back(Point::new_scale(pt(0), pt(1)));
60 //BBS: new_scale doesn't support arc, so clean
61 pl.fitting_result.clear();
62 return pl;
63 }
static Point new_scale(coordf_t x, coordf_t y)
Definition Point.hpp:214

References Polyline(), fitting_result, Slic3r::Point::new_scale(), and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ operator=() [1/2]

Polyline & Slic3r::Polyline::operator= ( const Polyline & other)
inline
45 {
46 points = other.points;
47 fitting_result = other.fitting_result;
48 return *this;
49 }

References Polyline(), fitting_result, and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ operator=() [2/2]

Polyline & Slic3r::Polyline::operator= ( Polyline && other)
inlinenoexcept
50 {
51 points = std::move(other.points);
52 fitting_result = std::move(other.fitting_result);
53 return *this;
54 }

References Polyline(), fitting_result, and Slic3r::MultiPoint::points.

Here is the call graph for this function:

◆ operator[]() [1/2]

Point & Slic3r::Polyline::operator[] ( Points::size_type idx)
inline
111{ return this->points[idx]; }

References Slic3r::MultiPoint::points.

◆ operator[]() [2/2]

const Point & Slic3r::Polyline::operator[] ( Points::size_type idx) const
inline
112{ return this->points[idx]; }

References Slic3r::MultiPoint::points.

◆ remove_duplicate_points()

bool Slic3r::MultiPoint::remove_duplicate_points ( )
inherited
114{
115 size_t j = 0;
116 for (size_t i = 1; i < points.size(); ++i) {
117 if (points[j] == points[i]) {
118 // Just increase index i.
119 } else {
120 ++ j;
121 if (j < i)
122 points[j] = points[i];
123 }
124 }
125 if (++ j < points.size()) {
126 points.erase(points.begin() + j, points.end());
127 return true;
128 }
129 return false;
130}

References points.

Referenced by Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::polylines_from_paths(), Slic3r::WipeTower::rib_section(), Slic3r::rounding_polygon(), Slic3r::WipeTower::rounding_polygon(), Slic3r::smooth_polyline_corners(), and Slic3r::traverse_graph_generate_polylines().

Here is the caller graph for this function:

◆ reset_to_linear_move()

void Slic3r::Polyline::reset_to_linear_move ( )
453{
454 this->fitting_result.clear();
455 fitting_result.emplace_back(PathFittingData{ 0, points.size() - 1, EMovePathType::Linear_move, ArcSegment() });
456 this->fitting_result.shrink_to_fit();
457}

References fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Referenced by Slic3r::WipeTowerWriter::polygon(), and Slic3r::store_wipe_path().

Here is the caller graph for this function:

◆ reverse()

void Slic3r::Polyline::reverse ( )
44{
45 //BBS: reverse points
47 //BBS: reverse the fitting_result
48 if (!this->fitting_result.empty()) {
49 for (size_t i = 0; i < this->fitting_result.size(); i++) {
50 std::swap(fitting_result[i].start_point_index, fitting_result[i].end_point_index);
51 fitting_result[i].start_point_index = MultiPoint::size() - 1 - fitting_result[i].start_point_index;
52 fitting_result[i].end_point_index = MultiPoint::size() - 1 - fitting_result[i].end_point_index;
53 if (fitting_result[i].is_arc_move())
54 fitting_result[i].reverse_arc_path();
55 }
56 std::reverse(this->fitting_result.begin(), this->fitting_result.end());
57 }
58}

References fitting_result, Slic3r::MultiPoint::reverse(), and Slic3r::MultiPoint::size().

Referenced by Slic3r::FillPlanePath::_fill_surface_single(), append_before(), Slic3r::base_support_extend_infill_lines(), Slic3r::chain_lines(), clip_start(), Slic3r::Fill::connect_base_support(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), Slic3r::draw_perimeters(), extend_start(), Slic3r::LoopInterfaceProcessor::generate(), Slic3r::join_close_ends(), Slic3r::modulate_extrusion_by_overlapping_layers(), Slic3r::offset_wipe_path_toward_support(), Slic3r::optimize_polylines_by_reversing(), Slic3r::reconnect_polylines(), Slic3r::restore_source_path_order(), Slic3r::ThickPolyline::reverse(), Slic3r::take_limited(), and Slic3r::tree_supports_generate_paths().

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

◆ rotate() [1/3]

void Slic3r::MultiPoint::rotate ( double angle)
inlineinherited
40{ this->rotate(cos(angle), sin(angle)); }
void rotate(double angle)
Definition MultiPoint.hpp:40
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

References Slic3r::angle(), and rotate().

Referenced by Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), Slic3r::ExPolygonWithOffset::ExPolygonWithOffset(), Slic3r::FillHoneycomb::_fill_surface_single(), Slic3r::Print::_make_wipe_tower(), Slic3r::GUI::PartPlate::estimate_wipe_tower_polygon(), Slic3r::get_arrange_poly(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), Slic3r::layered_print_cleareance_valid(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::place_wipe_tower(), rotate(), and Slic3r::ModelInstance::transform_polygon().

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

◆ rotate() [2/3]

void Slic3r::MultiPoint::rotate ( double angle,
const Point & center )
inherited
49{
50 double s = sin(angle);
51 double c = cos(angle);
52 for (Point &pt : points) {
53 Vec2crd v(pt - center);
54 pt(0) = (coord_t)round(double(center(0)) + c * v[0] - s * v[1]);
55 pt(1) = (coord_t)round(double(center(1)) + c * v[1] + s * v[0]);
56 }
57}
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
Eigen::Matrix< coord_t, 2, 1, Eigen::DontAlign > Vec2crd
Definition Point.hpp:52

References Slic3r::angle(), Slic3r::center(), and points.

Here is the call graph for this function:

◆ rotate() [3/3]

void Slic3r::MultiPoint::rotate ( double cos_angle,
double sin_angle )
inherited
39{
40 for (Point &pt : this->points) {
41 double cur_x = double(pt(0));
42 double cur_y = double(pt(1));
43 pt(0) = coord_t(round(cos_angle * cur_x - sin_angle * cur_y));
44 pt(1) = coord_t(round(cos_angle * cur_y + sin_angle * cur_x));
45 }
46}

References points.

◆ scale() [1/2]

void Slic3r::MultiPoint::scale ( double factor)
inherited
18{
19 for (Point &pt : points)
20 pt *= factor;
21}

References points.

Referenced by Slic3r::TreeSupport3D::RichInterfacePlacer::add_points_along_lines(), and Slic3r::ModelInstance::transform_polygon().

Here is the caller graph for this function:

◆ scale() [2/2]

void Slic3r::MultiPoint::scale ( double factor_x,
double factor_y )
inherited
24{
25 for (Point &pt : points)
26 {
27 pt(0) = coord_t(pt(0) * factor_x);
28 pt(1) = coord_t(pt(1) * factor_y);
29 }
30}

References points.

◆ simplify()

void Slic3r::Polyline::simplify ( double tolerance)
156{
157 this->points = MultiPoint::_douglas_peucker(this->points, tolerance);
158 this->fitting_result.clear();
159}
static Points _douglas_peucker(const Points &points, const double tolerance)
Definition MultiPoint.cpp:175

References Slic3r::MultiPoint::_douglas_peucker(), fitting_result, and Slic3r::MultiPoint::points.

Referenced by Slic3r::GUI::GLGizmoPainterBase::get_projected_mouse_positions(), Slic3r::make_adaptive_tpms(), and Slic3r::WipeTowerWriter::polygon().

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

◆ simplify_by_fitting_arc()

void Slic3r::Polyline::simplify_by_fitting_arc ( double tolerance)
162{
163 //BBS: do arc fit first, then use DP simplify to handle the straight part to reduce point.
165}
static void do_arc_fitting_and_simplify(Points &points, std::vector< PathFittingData > &result, double tolerance)
Definition ArcFitter.cpp:103

References Slic3r::ArcFitter::do_arc_fitting_and_simplify(), fitting_result, and Slic3r::MultiPoint::points.

Referenced by Slic3r::WipeTowerWriter::polygon().

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

◆ size()

size_t Slic3r::MultiPoint::size ( ) const
inlineinherited
50{ return points.size(); }

References points.

Referenced by Slic3r::BuildVolume::BuildVolume(), Slic3r::GCode::_do_export(), Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::add_extra_point(), Slic3r::any_expolygon_contains(), Slic3r::Polyline::append_before(), Slic3r::PreciseSeam::detail::append_exact_fragment(), Slic3r::Polyline::append_fitting_result_after_append_polyline(), Slic3r::PreciseSeam::detail::append_fragment(), Slic3r::PreciseSeam::detail::append_projected_fragment(), Slic3r::PreciseSeam::detail::bind_fragment(), Slic3r::SeamPlacerImpl::calculate_polygon_angles_at_vertices(), Slic3r::Polyline::clip_end(), Slic3r::Fill::connect_base_support(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), Slic3r::contour_distance(), Slic3r::Geometry::convex_polygons_intersect(), Slic3r::create_boundary_infill_graph(), Slic3r::GUI::ImGuiWrapper::draw(), Slic3r::TreeSupport3D::ensure_maximum_distance_polyline(), Slic3r::Polyline::equally_spaced_lines(), Slic3r::PreciseSeam::extract_perimeter_segments(), Slic3r::find_first_different_vertex(), Slic3r::generate_transform_pattern(), priv::get_closest_point_index(), Slic3r::ClipperUtils::interior_point(), Slic3r::PreciseSeam::detail::interval_on_edge(), anonymous_namespace{TextLines.cpp}::its_create_torus(), Slic3r::WipeTower::its_make_rib_brim(), Slic3r::WipeTower::its_make_rib_tower(), Slic3r::mark_boundary_segments_overlapping_infill(), Slic3r::move_inside_expoly(), Slic3r::nearest_clear_wipe_tower_anchor(), Slic3r::need_wipe(), anonymous_namespace{Emboss.cpp}::point_in_distance(), anonymous_namespace{Emboss.cpp}::point_in_distance(), anonymous_namespace{Emboss.cpp}::point_in_reverse_distance(), Slic3r::polygons_match(), Slic3r::precompute_polygon_distances(), Slic3r::PreciseSeam::prepare_weak_modifier_segments(), Slic3r::arrangement::process_arrangeable(), Slic3r::SeamPlacerImpl::process_perimeter_polygon(), Slic3r::GUI::MeshClipper::recalculate_triangles(), Slic3r::remove_duplicates(), Slic3r::remove_points_from_polygon(), Slic3r::Arachne::removeColinearEdges(), Slic3r::Arachne::removeDegenerateVerts(), Slic3r::FillLightning::Node::removeJunctionOverlap(), Slic3r::resample_polygon(), Slic3r::Polyline::reverse(), Slic3r::Arachne::simplify(), Slic3r::smooth_outward(), Slic3r::smooth_outward(), Slic3r::smooth_polyline_corners(), Slic3r::PreciseSeam::detail::snap_cuts_to_adjacent_vertices(), Slic3r::Polyline::split_at_index(), Slic3r::take(), Slic3r::take_limited(), priv::to_expoly(), Slic3r::to_polyline(), Slic3r::GCode::travel_to(), Slic3r::tree_supports_generate_paths(), Slic3r::triangulate_wall(), Slic3r::trim_loop(), and Slic3r::GUI::PartPlate::wipe_tower_obstacles().

◆ split_at()

void Slic3r::Polyline::split_at ( Point & point,
Polyline * p1,
Polyline * p2 ) const
233{
234 if (this->points.empty()) return;
235
236 //0 judge whether the point is on the polyline
237 int index = this->find_point(point);
238 if (index != -1) {
239 //BBS: the spilit point is on the polyline, then easy
240 split_at_index(index, p1, p2);
241 point = p1->is_valid()? p1->last_point(): p2->first_point();
242 return;
243 }
244
245 //1 find the line to split at
246 size_t line_idx = 0;
247 Point p = this->first_point();
248 double min = (p - point).cast<double>().norm();
249 Lines lines = this->lines();
250 for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
251 Point p_tmp = point.projection_onto(*line);
252 if ((p_tmp - point).cast<double>().norm() < min) {
253 p = p_tmp;
254 min = (p - point).cast<double>().norm();
255 line_idx = line - lines.begin();
256 }
257 }
258
259 //2 judge whether the cloest point is one vertex of polyline.
260 // and spilit the polyline at different index
261 index = this->find_point(p);
262 if (index != -1)
263 {
264 this->split_at_index(index, p1, p2);
265 p1->append(point);
266 p2->append_before(point);
267 } else {
268 Polyline temp;
269 this->split_at_index(line_idx, p1, &temp);
270 p1->append(point);
271 this->split_at_index(line_idx + 1, &temp, p2);
272 p2->append_before(point);
273 }
274}
bool split_at_index(const size_t index, Polyline *p1, Polyline *p2) const
Definition Polyline.cpp:277

References Polyline(), append(), append_before(), Slic3r::cast(), Slic3r::MultiPoint::find_point(), Slic3r::MultiPoint::first_point(), Slic3r::MultiPoint::is_valid(), last_point(), lines(), Slic3r::MultiPoint::points, Slic3r::Point::projection_onto(), and split_at_index().

Here is the call graph for this function:

◆ split_at_index()

bool Slic3r::Polyline::split_at_index ( const size_t index,
Polyline * p1,
Polyline * p2 ) const
278{
279 if (index > this->size() - 1)
280 return false;
281
282 if (index == 0) {
283 p1->clear();
284 p1->append(this->first_point());
285 *p2 = *this;
286 } else if (index == this->size() - 1) {
287 p2->clear();
288 p2->append(this->last_point());
289 *p1 = *this;
290 } else {
291 //BBS: spilit first part
292 p1->clear();
293 p1->points.reserve(index + 1);
294 p1->points.insert(p1->begin(), this->begin(), this->begin() + index + 1);
295 Point new_endpoint;
296 if (this->split_fitting_result_before_index(index, new_endpoint, p1->fitting_result))
297 p1->points.back() = new_endpoint;
298
299 p2->clear();
300 p2->points.reserve(this->size() - index);
301 p2->points.insert(p2->begin(), this->begin() + index, this->end());
302 Point new_startpoint;
303 if (this->split_fitting_result_after_index(index, new_startpoint, p2->fitting_result))
304 p2->points.front() = new_startpoint;
305 }
306 return true;
307}
bool split_fitting_result_after_index(const size_t index, Point &new_startpoint, std::vector< PathFittingData > &data) const
Definition Polyline.cpp:492
bool split_fitting_result_before_index(const size_t index, Point &new_endpoint, std::vector< PathFittingData > &data) const
Definition Polyline.cpp:459

References Polyline(), append(), Slic3r::MultiPoint::begin(), clear(), Slic3r::MultiPoint::first_point(), fitting_result, last_point(), Slic3r::MultiPoint::points, Slic3r::MultiPoint::size(), split_fitting_result_after_index(), and split_fitting_result_before_index().

Referenced by split_at(), and split_at_length().

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

◆ split_at_length()

bool Slic3r::Polyline::split_at_length ( const double length,
Polyline * p1,
Polyline * p2 ) const
310{
311 if (this->points.empty()) return false;
312 if (length < 0 || length > this->length()) {
313 return false;
314 }
315
316 if (length < SCALED_EPSILON) {
317 p1->clear();
318 p1->append(this->first_point());
319 *p2 = *this;
320 } else if (is_approx(length, this->length(), SCALED_EPSILON)) {
321 p2->clear();
322 p2->append(this->last_point());
323 *p1 = *this;
324 } else {
325 // 1 find the line to split at
326 size_t line_idx = 0;
327 double acc_length = 0;
328 Point p = this->first_point();
329 for (const auto& l : this->lines()) {
330 p = l.b;
331
332 const double current_length = l.length();
333 if (acc_length + current_length >= length) {
334 p = lerp(l.a, l.b, (length - acc_length) / current_length);
335 break;
336 }
337 acc_length += current_length;
338 line_idx++;
339 }
340
341 //2 judge whether the cloest point is one vertex of polyline.
342 // and spilit the polyline at different index
343 int index = this->find_point(p);
344 if (index != -1) {
345 this->split_at_index(index, p1, p2);
346 } else {
347 Polyline temp;
348 this->split_at_index(line_idx, p1, &temp);
349 p1->append(p);
350 this->split_at_index(line_idx + 1, &temp, p2);
351 p2->append_before(p);
352 }
353 }
354 return true;
355}
double length() const
Definition MultiPoint.cpp:59
ColorRGB lerp(const ColorRGB &a, const ColorRGB &b, float t)
Definition Color.cpp:244
constexpr bool is_approx(Number value, Number test_value, Number precision=EPSILON)
Definition libslic3r.h:320

References Polyline(), append(), append_before(), clear(), Slic3r::MultiPoint::find_point(), Slic3r::MultiPoint::first_point(), Slic3r::is_approx(), last_point(), Slic3r::MultiPoint::length(), Slic3r::lerp(), lines(), Slic3r::MultiPoint::points, SCALED_EPSILON, and split_at_index().

Here is the call graph for this function:

◆ split_fitting_result_after_index()

bool Slic3r::Polyline::split_fitting_result_after_index ( const size_t index,
Point & new_startpoint,
std::vector< PathFittingData > & data ) const
private
493{
494 data.clear();
495 new_startpoint = this->points[index];
496 if (!this->fitting_result.empty()) {
497 data.reserve(this->fitting_result.size());
498 for (size_t i = 0; i < this->fitting_result.size(); i++) {
499 if (this->fitting_result[i].end_point_index > index)
500 data.push_back(this->fitting_result[i]);
501 }
502 if (!data.empty()) {
503 for (size_t i = 0; i < data.size(); i++) {
504 if (i != 0) {
505 data[i].start_point_index -= index;
506 data[i].end_point_index -= index;
507 } else {
508 data[i].end_point_index -= index;
509 //BBS: need to clip the arc and generate new start point
510 if (data.front().is_arc_move() && data.front().start_point_index < index) {
511 if (!data.front().arc_data.clip_start(this->points[index]))
512 //BBS: failed to clip arc, then return to be linear move
513 data.front().path_type = EMovePathType::Linear_move;
514 else
515 //BBS: succeed to clip arc, then update and return the new start point
516 new_startpoint = data.front().arc_data.start_point;
517 }
518 data[i].start_point_index = 0;
519 }
520 }
521 }
522 data.shrink_to_fit();
523 return true;
524 }
525 return false;
526}

References fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Referenced by split_at_index().

Here is the caller graph for this function:

◆ split_fitting_result_before_index()

bool Slic3r::Polyline::split_fitting_result_before_index ( const size_t index,
Point & new_endpoint,
std::vector< PathFittingData > & data ) const
private
460{
461 data.clear();
462 new_endpoint = this->points[index];
463 if (!this->fitting_result.empty()) {
464 //BBS: max size
465 data.reserve(this->fitting_result.size());
466 //BBS: save fitting result before index
467 for (size_t i = 0; i < this->fitting_result.size(); i++)
468 {
469 if (this->fitting_result[i].start_point_index < index)
470 data.push_back(this->fitting_result[i]);
471 else
472 break;
473 }
474
475 if (!data.empty()) {
476 //BBS: need to clip the arc and generate new end point
477 if (data.back().is_arc_move() && data.back().end_point_index > index) {
478 if (!data.back().arc_data.clip_end(this->points[index]))
479 //BBS: failed to clip arc, then return to be linear move
480 data.back().path_type = EMovePathType::Linear_move;
481 else
482 //BBS: succeed to clip arc, then update and return the new end point
483 new_endpoint = data.back().arc_data.end_point;
484 }
485 data.back().end_point_index = index;
486 }
487 data.shrink_to_fit();
488 return true;
489 }
490 return false;
491}

References fitting_result, Slic3r::Linear_move, and Slic3r::MultiPoint::points.

Referenced by split_at_index().

Here is the caller graph for this function:

◆ squaredDistanceToLineSegment()

double Slic3r::MultiPoint::squaredDistanceToLineSegment ( const Point & p,
const Point & v,
const Point & w )
staticprivateinherited

Calculates the squared distance between a point and a line segment defined by two points.

Parameters
pThe point.
vThe starting point of the line segment.
wThe ending point of the line segment.
Returns
double The squared distance between the point and the line segment.
393 {
394 // Calculate the squared length of the line segment
395 double l2 = (v - w).squaredNorm();
396 // If the segment is a single point, return the squared distance to that point
397 if (l2 == 0.0) return (p - v).squaredNorm();
398 // Project point p onto the line defined by v and w, and clamp the projection to the segment
399 double t = std::max(0.0, std::min(1.0, ((p - v).dot(w - v)) / l2));
400 // Compute the projection point
401 Point projection{v.x() + t * (w.x() - v.x()), v.y() + t * (w.y() - v.y())};
402 // Return the squared distance between the point and the projection
403 return (p - projection).squaredNorm();
404}
T l2(const boost::geometry::model::d2::point_xy< T > &v)
Definition ExtrusionSimulator.cpp:177
T dot(const boost::geometry::model::d2::point_xy< T > &v1, const boost::geometry::model::d2::point_xy< T > &v2)
Definition ExtrusionSimulator.cpp:154

References Slic3r::dot(), and Slic3r::l2().

Referenced by minimumDistanceBetweenLinesDefinedByPoints().

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

◆ symmetric_y()

void Slic3r::MultiPoint::symmetric_y ( const coord_t & y_axis)
inherited
582{
583 for (Point &pt : points) {
584 pt(0) = 2 * x_axis - pt(0);
585 }
586}

References points.

◆ translate() [1/2]

void Slic3r::MultiPoint::translate ( const Point & vector)
inherited
33{
34 for (Point &pt : points)
35 pt += v;
36}

References points.

◆ translate() [2/2]

void Slic3r::MultiPoint::translate ( double x,
double y )
inlineinherited
38{ this->translate(Point(coord_t(x), coord_t(y))); }
void translate(double x, double y)
Definition MultiPoint.hpp:38

References translate().

Referenced by Slic3r::Print::_make_wipe_tower(), Slic3r::TreeSupport3D::RichInterfacePlacer::add_points_along_lines(), Slic3r::anonymous_namespace{ExclusionVolumeGeometry.cpp}::append_active_footprints(), Slic3r::GCodeProcessor::check_multi_extruder_gcode_valid(), Slic3r::GUI::PartPlate::check_outside(), Slic3r::compacted_tower_print_instance_hull(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), libvgcode::convert_to_vertices(), Slic3r::LinesBucket::curLines(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::_3DScene::extrusionentity_to_verts(), Slic3r::WipeTower::finish_layer_new(), Slic3r::TreeSupport3D::generate_support_areas(), Slic3r::generate_transform_pattern(), Slic3r::get_arrange_poly(), anonymous_namespace{Emboss.cpp}::heal_dupl_inter(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), Slic3r::ExclusionVolumeTravelAvoidance::init(), Slic3r::layered_print_cleareance_valid(), Slic3r::make_gyroid_waves(), Slic3r::makeEndPoints(), Slic3r::makeZigZag(), Slic3r::GCode::needs_retraction(), translate(), Slic3r::AvoidCrossingPerimeters::travel_to(), Slic3r::GUI::PartPlate::update_exclusion_volume_preview_models(), and Slic3r::GUI::PartPlate::wipe_tower_obstacles().

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

◆ visivalingam()

Points Slic3r::MultiPoint::visivalingam ( const Points & pts,
const double tolerance )
staticinherited
266{
267 // Make sure there's enough points in "pts" to bother with simplification.
268 assert(pts.size() >= 2);
269 // Result object
270 Points results;
271 // Lambda to calculate effective area spanned by a point and its immediate
272 // successor + predecessor.
273 auto effective_area = [pts](const size_t& curr_pt_idx, const size_t& prev_pt_idx, const size_t& next_pt_idx)->coordf_t {
274 const Point& curr = pts[curr_pt_idx];
275 const Point& prev = pts[prev_pt_idx];
276 const Point& next = pts[next_pt_idx];
277 // Use point objects as vector-distances
278 const Vec2d curr_to_next = (next - curr).cast<double>();
279 const Vec2d prev_to_next = (prev - curr).cast<double>();
280 // Take cross product of these two vector distances
281 return 0.50 * abs(cross2(curr_to_next, prev_to_next));
282 };
283 // We store the effective areas for each node
284 std::vector<coordf_t> areas;
285 areas.reserve(pts.size());
286 // Construct the initial set of nodes. We will make a heap out of the "heap" vector using
287 // std::make_heap. node_list is used later.
288 std::vector<vis_node*> node_list;
289 node_list.resize(pts.size());
290 std::vector<vis_node*> heap;
291 heap.reserve(pts.size());
292 for (size_t i = 1; i < pts.size() - 1; ++ i) {
293 // Get effective area of current node.
294 coordf_t area = effective_area(i, i - 1, i + 1);
295 // If area is greater than some arbitrarily small value, use it.
296 node_list[i] = new vis_node(i, i - 1, i + 1, area);
297 heap.push_back(node_list[i]);
298 }
299 // Call std::make_heap, which uses the < operator by default to make "heap" into
300 // a binheap, sorted by the < operator we defind in the vis_node struct
301 std::make_heap(heap.begin(), heap.end());
302 // Start comparing areas. Set min_area to an outrageous value initially.
303 double min_area = -std::numeric_limits<double>::max();
304 while (!heap.empty()) {
305 // Get current node.
306 vis_node* curr = heap.front();
307 // Pop node we just retrieved off the heap. pop_heap moves front element in vector
308 // to the back, so we can call pop_back()
309 std::pop_heap(heap.begin(), heap.end());
310 heap.pop_back();
311 // Sanity assert check
312 assert(curr == node_list[curr->pt_idx]);
313 // If the current pt'ss area is less than that of the previous pt's area
314 // use the last pt's area instead. This ensures we don't elimate the current
315 // point without eliminating the previous
316 min_area = std::max(min_area, curr->area);
317 // Update prev
318 vis_node* prev = node_list[curr->prev_idx];
319 if(prev != nullptr){
320 prev->next_idx = curr->next_idx;
321 prev->area = effective_area(prev->pt_idx, prev->prev_idx, prev->next_idx);
322 // For some reason, std::make_heap() is the fastest way to resort the heap. Probably needs testing.
323 std::make_heap(heap.begin(), heap.end());
324 }
325 // Update next
326 vis_node* next = node_list[curr->next_idx];
327 if(next != nullptr){
328 next->prev_idx = curr->prev_idx;
329 next->area = effective_area(next->pt_idx, next->prev_idx, next->next_idx);
330 std::make_heap(heap.begin(), heap.end());
331 }
332 areas[curr->pt_idx] = min_area;
333 node_list[curr->pt_idx] = nullptr;
334 delete curr;
335 }
336 // Clear node list and shrink_to_fit() (to free actual memory). Not necessary. Could be removed.
337 node_list.clear();
338 node_list.shrink_to_fit();
339 // This lambda is how we test whether or not to keep a point.
340 auto use_point = [areas, tolerance](const size_t& idx)->bool {
341 assert(idx < areas.size());
342 // Return true at front/back of path/areas
343 if(idx == 0 || idx == areas.size() - 1){
344 return true;
345 }
346 // Return true if area at idx is greater than minimum area to consider "valid"
347 else{
348 return areas[idx] > tolerance;
349 }
350 };
351 // Use previously defined lambda to build results.
352 for (size_t i = 0; i < pts.size(); ++i) {
353 if (use_point(i)){
354 results.push_back(pts[i]);
355 }
356 }
357 // Check that results has at least two points
358 assert(results.size() >= 2);
359 // Return simplified vector of points
360 return results;
361}
double coordf_t
Definition GUI_ObjectList.hpp:46
int32_t cross2(const Eigen::MatrixBase< Eigen::Matrix< int32_t, 2, 1, Options > > &v1, const Eigen::MatrixBase< Eigen::Matrix< int32_t, 2, 1, Options > > &v2)=delete
double area(const ExPolygon &poly)
Definition ExPolygon.hpp:511

References Slic3r::area(), Slic3r::vis_node::area, Slic3r::cast(), Slic3r::cross2(), Slic3r::vis_node::next_idx, Slic3r::vis_node::prev_idx, and Slic3r::vis_node::pt_idx.

Here is the call graph for this function:

Member Data Documentation

◆ fitting_result

◆ points

Points Slic3r::MultiPoint::points
inherited

Referenced by Slic3r::BuildVolume::BuildVolume(), Slic3r::ExPolygonsIndices::ExPolygonsIndices(), MultiPoint(), MultiPoint(), MultiPoint(), Slic3r::Polygon::Polygon(), Slic3r::Polygon::Polygon(), Slic3r::Polygon::Polygon(), Slic3r::Polyline::Polyline(), Slic3r::Polyline::Polyline(), Slic3r::Polyline::Polyline(), Slic3r::Polyline::Polyline(), Slic3r::GCode::_do_export(), Slic3r::FillConcentric::_fill_surface_single(), Slic3r::FillHoneycomb::_fill_surface_single(), Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::Print::_make_skirt(), Slic3r::AreaMoments::add(), Slic3r::sla::ConcaveHull::add_connector_rectangles(), Slic3r::add_extra_point(), Slic3r::TreeSupport3D::RichInterfacePlacer::add_points_along_lines(), Slic3r::addTops(), Slic3r::any_expolygon_contains(), Slic3r::Polyline::append(), Slic3r::Polyline::append(), Slic3r::PreciseSeam::detail::append_exact_fragment(), Slic3r::Polyline::append_fitting_result_after_append_points(), Slic3r::anonymous_namespace{PrintConfig.cpp}::append_legacy_bed_exclude_regions(), Slic3r::append_path(), Slic3r::append_path_point(), Slic3r::append_path_point(), Slic3r::PreciseSeam::detail::append_projected_fragment(), Slic3r::WipeTowerIntegration::append_tcr(), Slic3r::WipeTowerIntegration::append_tcr2(), Slic3r::Feature::FuzzySkin::apply_fuzzy_skin(), Slic3r::Feature::FuzzySkin::apply_fuzzy_skin(), Slic3r::Polygon::area(), Slic3r::Polygon::area(), Slic3r::ExtrusionMultiPath::as_polyline(), Slic3r::MutablePolygon::assign(), Slic3r::bed_exclusion_arrange_polygon(), begin(), begin(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::begin_points(), boost::polygon::polygon_traits< Slic3r::Polygon >::begin_points(), Slic3r::belt_brim_band_paths(), bounding_box(), Slic3r::Geometry::MedialAxis::build(), Slic3r::anonymous_namespace{ClipperUtils.cpp}::c2_attach_stray_holes(), Slic3r::anonymous_namespace{ClipperUtils.cpp}::c2_offset_expolygons(), Slic3r::SeamPlacerImpl::calculate_polygon_angles_at_vertices(), cbegin(), cend(), Slic3r::Polygon::centroid(), Slic3r::chain_lines(), Slic3r::chamfer_polygon(), Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox(), Slic3r::ClipperUtils::clip_clipper_polygon_with_subject_bbox(), Slic3r::Polyline::clip_end(), Slic3r::clip_inner_walls_over_top(), Slic3r::clip_path_end(), Slic3r::Polyline::clip_start(), Slic3r::colored_points_to_polygon(), Slic3r::compacted_tower_print_instance_hull(), Slic3r::Print::compacted_wipe_tower_clearance_valid(), Slic3r::compacted_wipe_tower_zone(), Slic3r::Polygon::concave_points(), Slic3r::WipeTower2::cone_base_polygon(), Slic3r::Fill::connect_base_support(), Slic3r::connect_brim_lines(), Slic3r::Fill::connect_infill(), Slic3r::Fill::connect_infill(), Slic3r::FillAdaptive::connect_lines_using_hooks(), Slic3r::TimelapsePosPicker::construct_printable_area_by_printer(), Slic3r::contains(), Slic3r::contour_distance(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::contour_intersections(), Slic3r::contour_to_polygons(), Slic3r::Geometry::convex_hull(), Slic3r::ModelObject::convex_hull_2d(), Slic3r::Polygon::convex_points(), Slic3r::count_points(), Slic3r::EdgeGrid::Grid::create(), Slic3r::EdgeGrid::Grid::create(), Slic3r::create_boundary_infill_graph(), Slic3r::create_polyholes(), Slic3r::Polygon::densify(), Slic3r::diff(), Slic3r::diff_ex(), Slic3r::diff_ex(), Slic3r::diff_pl(), Slic3r::diff_pl(), Slic3r::Emboss::divide_segments_for_close_point(), Slic3r::Algorithm::do_split_line(), Slic3r::Polygon::douglas_peucker(), Slic3r::GUI::ImGuiWrapper::draw(), Slic3r::draw_perimeters(), Slic3r::emit_perimeter_prev_next_segment(), Slic3r::emit_perimeter_segment_on_vertical_line(), empty(), end(), end(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::end_points(), boost::polygon::polygon_traits< Slic3r::Polygon >::end_points(), Slic3r::TreeSupport3D::ensure_maximum_distance_polyline(), Slic3r::Polyline::equally_spaced_lines(), Slic3r::Polyline::equally_spaced_points(), Slic3r::estimated_wipe_tower_footprint(), Slic3r::evaluate_support_arch_cost(), Slic3r::evaluate_support_arches(), Slic3r::executable_path_length(), Slic3r::ClipperZUtils::expolygons_to_zpaths(), Slic3r::Polyline::extend_end(), Slic3r::PreciseSeam::extract_perimeter_segments(), Slic3r::extrusion_polyline_extents(), priv::fill_polygon_distances(), priv::fill_shape_distances(), Slic3r::FillConcentricInternal::fill_surface_extrusion(), Slic3r::FillRectilinear::fill_surface_trapezoidal(), priv::find_close_point(), Slic3r::find_first_different_vertex(), find_point(), find_point(), Slic3r::find_spiral_start_corner(), Slic3r::Polygon::first_intersection(), Slic3r::from_json(), Slic3r::from_json(), Slic3r::WipeTowerIntegration::generate_path_to_wipe_tower(), Slic3r::GUI::GLGizmoBrimEars::generate_points(), Slic3r::generate_rectange_polygon(), Slic3r::generate_spiral_insets(), Slic3r::generate_transform_pattern(), Slic3r::generate_tree_support_3D(), Slic3r::get_arrange_poly(), Slic3r::get_bed_shape(), Slic3r::get_bed_shape(), Slic3r::get_bed_shape_with_excluded_area(), Slic3r::GUI::GLGizmoBrimEars::get_detection_radius_max(), Slic3r::get_extents(), Slic3r::get_extents_rotated(), anonymous_namespace{Emboss.cpp}::get_glyph(), Slic3r::SVG::get_path_d(), Slic3r::get_polygon_vertex_inward_normal(), Slic3r::get_polygon_vertex_offset(), Slic3r::GUI::GLGizmoPainterBase::get_projected_mouse_positions(), Slic3r::get_shared_poly(), Slic3r::get_svg_profile(), Slic3r::has_duplicate_points(), Slic3r::has_duplicate_points(), has_duplicate_points(), Slic3r::FillAdaptive::has_no_collinear_lines(), Slic3r::Wipe::has_path(), Slic3r::imex_hull_violates_zones(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), Slic3r::ExclusionVolumeTravelAvoidance::init(), Slic3r::GUI::init_exclusion_volume_prism_model(), Slic3r::initial_connector_is_clear(), priv::insert_edges(), priv::insert_edges(), Slic3r::PreciseSeam::insert_point_into_perimeter(), Slic3r::ClipperUtils::interior_point(), Slic3r::intersection(), Slic3r::Polygon::intersection(), Slic3r::intersection_pl(), Slic3r::intersection_pl(), Slic3r::intersection_pl(), Slic3r::Polygon::intersections(), Slic3r::ModelInstance::intersects_bed_exclude_region(), Slic3r::PreciseSeam::detail::interval_on_edge(), Slic3r::Polyline::is_closed(), Slic3r::Polygon::is_valid(), Slic3r::SupportGridPattern::island_samples(), anonymous_namespace{TextLines.cpp}::its_create_torus(), Slic3r::WipeTower::its_make_rib_tower(), Slic3r::join_close_ends(), Slic3r::Polygon::last_point(), Slic3r::Polyline::last_point(), Slic3r::layered_print_cleareance_valid(), Slic3r::Polyline::leftmost_point(), Slic3r::Polygon::length(), Slic3r::length_off_reference(), Slic3r::Polyline::lines(), Slic3r::loop_clip_length(), Slic3r::make_adaptive_infill_shells(), Slic3r::make_adaptive_tpms(), Slic3r::make_brim_ears(), Slic3r::make_brim_ears_auto(), Slic3r::make_circle_num_segments(), Slic3r::GUI::GLGizmoBrimEars::make_polygon(), Slic3r::make_wave(), Slic3r::makeEndPoints(), Slic3r::makeZigZag(), Slic3r::mark_boundary_segments_overlapping_infill(), Slic3r::material_side_support_lines(), Slic3r::ExPolygon::medial_axis(), Slic3r::modulate_extrusion_by_overlapping_layers(), Slic3r::move_inside_expoly(), Slic3r::FillAdaptive::multiline_paths(), Slic3r::nearest_clear_wipe_tower_anchor(), Slic3r::GCode::needs_retraction(), Slic3r::Polygon::new_scale(), Slic3r::Polyline::new_scale(), Slic3r::offset(), Slic3r::offset(), Slic3r::offset(), Slic3r::offset_wipe_path(), Slic3r::offset_wipe_path_toward_support(), Slic3r::open_loop(), Slic3r::operator!=(), Slic3r::operator!=(), Slic3r::operator<<(), operator=(), operator=(), Slic3r::Polygon::operator=(), Slic3r::Polygon::operator=(), Slic3r::Polyline::operator=(), Slic3r::Polyline::operator=(), Slic3r::operator==(), Slic3r::operator==(), Slic3r::Polygon::operator[](), Slic3r::Polygon::operator[](), Slic3r::Polyline::operator[](), Slic3r::Polyline::operator[](), Slic3r::Polygon::parameter_by_length(), Slic3r::anonymous_namespace{PrintConfig.cpp}::parse_exclude_polygon_points(), Slic3r::anonymous_namespace{ClipperUtils.cpp}::path_encloses(), Slic3r::patternPoints(), Slic3r::Polygon::point_projection(), Slic3r::MutablePolygon::polygon(), Slic3r::WipeTowerWriter::polygon(), Slic3r::polygon_segment_append(), Slic3r::polygon_segment_append_reversed(), Slic3r::polygon_to_string(), Slic3r::polygons_match(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::polyline_intersects_obstacles(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::polyline_length(), Slic3r::polylines_from_paths(), Slic3r::precompute_polygon_distances(), Slic3r::PreciseSeam::prepare_weak_modifier_segments(), Slic3r::GUI::PartPlateList::preprocess_exclude_areas(), Slic3r::Geometry::MedialAxis::process_edge_neighbors(), Slic3r::SeamPlacerImpl::process_perimeter_polygon(), Slic3r::reconnect_polylines(), Slic3r::PreciseSeam::refine_at_vertex(), remove_duplicate_points(), Slic3r::remove_points_from_polygon(), Slic3r::remove_same_neighbor(), Slic3r::remove_same_neighbor(), anonymous_namespace{Emboss.cpp}::remove_spikes_in_duplicates(), anonymous_namespace{Emboss.cpp}::remove_when_spike(), Slic3r::Arachne::removeColinearEdges(), Slic3r::Arachne::removeDegenerateVerts(), Slic3r::FillLightning::Node::removeJunctionOverlap(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::replace_segment(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::replacement_matches_original_segment(), Slic3r::resample_polygon(), Slic3r::Polyline::reset_to_linear_move(), Slic3r::restore_source_path_order(), Slic3r::WipeTower::rib_section(), rotate(), rotate(), Slic3r::rounding_polygon(), Slic3r::WipeTower::rounding_polygon(), Slic3r::rounding_rectangle(), Slic3r::ExclusionVolumeTravelAvoidance::route(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::routed_polyline_inside_bed(), Slic3r::sample_polyline_at_distance(), scale(), scale(), Slic3r::scale_polygon(), cereal::serialize(), boost::polygon::polygon_mutable_traits< Slic3r::ExPolygon >::set_points(), Slic3r::Model::setPrintSpeedTable(), Slic3r::Arachne::simplify(), Slic3r::Polygon::simplify(), Slic3r::Polyline::simplify(), Slic3r::Polyline::simplify_by_fitting_arc(), Slic3r::ExPolygon::simplify_p(), Slic3r::anonymous_namespace{ExclusionVolumeTravelAvoidance.cpp}::simplify_path(), Slic3r::Geometry::simplify_polygons(), boost::polygon::polygon_traits< Slic3r::ExPolygon >::size(), boost::polygon::polygon_traits< Slic3r::Polygon >::size(), size(), Slic3r::slice_region_by_vertical_lines(), Slic3r::smooth_polyline_corners(), Slic3r::PreciseSeam::detail::snap_cuts_to_adjacent_vertices(), Slic3r::solid_bodies(), Slic3r::Polyline::split_at(), Slic3r::Polygon::split_at_index(), Slic3r::Polyline::split_at_index(), Slic3r::Polyline::split_at_length(), Slic3r::Polygon::split_at_vertex(), Slic3r::Polyline::split_fitting_result_after_index(), Slic3r::Polyline::split_fitting_result_before_index(), Slic3r::ThickPolyline::start_at_index(), Slic3r::starts_by_backtracking(), Slic3r::store_wipe_path(), Slic3r::GUI::ImGuiWrapper::suggest_location(), Slic3r::support_offset_at_start(), Slic3r::sweep_ex(), symmetric_y(), Slic3r::take(), Slic3r::take_ccw_full(), Slic3r::take_ccw_limited(), Slic3r::take_cw_full(), Slic3r::take_cw_limited(), Slic3r::take_limited(), Slic3r::GluTessWrapper::tesselate3d(), Slic3r::ThickPolyline::thicklines(), anonymous_namespace{NSVGUtils.cpp}::to_dashes(), Slic3r::to_json(), Slic3r::to_json(), Slic3r::to_linesf(), Slic3r::to_points(), Slic3r::to_points(), Slic3r::Arachne::to_polygon(), Slic3r::to_polygon(), Slic3r::Polyline3::to_polyline(), Slic3r::to_polyline(), Slic3r::to_polyline(), Slic3r::to_polylines(), Slic3r::to_polylines(), Slic3r::to_polylines(), Slic3r::to_polylines(), Slic3r::to_polylines(), Slic3r::Arachne::to_thick_polyline(), Slic3r::top_level_expolygons(), Slic3r::Arachne::ExtrusionLine::toPolygon(), Slic3r::Polygon::transform(), translate(), Slic3r::translated_wipe_path(), Slic3r::AvoidCrossingPerimeters::travel_to(), Slic3r::GCode::travel_to(), Slic3r::WipeTowerIntegration::travel_to_tower_gap(), Slic3r::traverse_graph_generate_polylines(), Slic3r::traverse_loops(), Slic3r::traverse_pt_outside_in(), Slic3r::tree_supports_generate_paths(), Slic3r::Triangulation::triangulate(), Slic3r::Polygon::triangulate_convex(), Slic3r::triangulate_wall(), Slic3r::anonymous_namespace{Model.cpp}::triangulated_prism_footprints(), Slic3r::trim_loop(), Slic3r::unscale_polygon(), Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), Slic3r::Print::validate_compacted_wipe_tower_clearance(), Slic3r::TreeSupport3D::validate_range(), Slic3r::variable_offset(), Slic3r::Wipe::wipe(), Slic3r::wipe_path_stays_on_material_side(), and Slic3r::wipe_path_support_score().


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