mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 05:54:03 -06:00
New seal_position option that replaces randomize_start, start_perimeters_at_concave_points and start_perimeters_at_non_overhang. The two latter options are now always on by default. A new "Aligned" seal position value has been added, that forces starting points to be aligned when not randomized. #1741 #925
This commit is contained in:
parent
c63bd8165d
commit
a3bd1b5302
17 changed files with 153 additions and 112 deletions
|
@ -191,6 +191,24 @@ Polygon::triangulate_convex(Polygons* polygons) const
|
|||
}
|
||||
}
|
||||
|
||||
// center of mass
|
||||
Point
|
||||
Polygon::centroid() const
|
||||
{
|
||||
double area_temp = this->area();
|
||||
double x_temp = 0;
|
||||
double y_temp = 0;
|
||||
|
||||
Polyline polyline;
|
||||
this->split_at_first_point(&polyline);
|
||||
for (Points::const_iterator point = polyline.points.begin(); point != polyline.points.end() - 1; ++point) {
|
||||
x_temp += (double)( point->x + (point+1)->x ) * ( (double)point->x*(point+1)->y - (double)(point+1)->x*point->y );
|
||||
y_temp += (double)( point->y + (point+1)->y ) * ( (double)point->x*(point+1)->y - (double)(point+1)->x*point->y );
|
||||
}
|
||||
|
||||
return Point(x_temp/(6*area_temp), y_temp/(6*area_temp));
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(Polygon, "Polygon");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue