mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-28 05:10:59 -07:00
Turn ExtrusionLoop into a collection of polylines. Includes some changes to the Polygon API to avoid returning newly allocatd objects
This commit is contained in:
parent
c72dc13d7e
commit
d2d885fc53
11 changed files with 107 additions and 72 deletions
|
|
@ -89,11 +89,10 @@ Polyline::extend_start(double distance)
|
|||
|
||||
/* this method returns a collection of points picked on the polygon contour
|
||||
so that they are evenly spaced according to the input distance */
|
||||
Points
|
||||
Polyline::equally_spaced_points(double distance) const
|
||||
void
|
||||
Polyline::equally_spaced_points(double distance, Points* points) const
|
||||
{
|
||||
Points pts;
|
||||
pts.push_back(this->first_point());
|
||||
points->push_back(this->first_point());
|
||||
double len = 0;
|
||||
|
||||
for (Points::const_iterator it = this->points.begin() + 1; it != this->points.end(); ++it) {
|
||||
|
|
@ -102,19 +101,17 @@ Polyline::equally_spaced_points(double distance) const
|
|||
if (len < distance) continue;
|
||||
|
||||
if (len == distance) {
|
||||
pts.push_back(*it);
|
||||
points->push_back(*it);
|
||||
len = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
double take = segment_length - (len - distance); // how much we take of this segment
|
||||
Line segment(*(it-1), *it);
|
||||
pts.push_back(segment.point_at(take));
|
||||
points->push_back(segment.point_at(take));
|
||||
it--;
|
||||
len = -take;
|
||||
}
|
||||
|
||||
return pts;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue