mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
New Polygon::triangulate_convex() method
This commit is contained in:
parent
ca4d4211c9
commit
bb0ce3cccd
4 changed files with 34 additions and 1 deletions
|
@ -158,6 +158,20 @@ Polygon::simplify(double tolerance, Polygons &polygons) const
|
|||
polygons.insert(polygons.end(), pp.begin(), pp.end());
|
||||
}
|
||||
|
||||
// Only call this on convex polygons or it will return invalid results
|
||||
void
|
||||
Polygon::triangulate_convex(Polygons* polygons) const
|
||||
{
|
||||
for (Points::const_iterator it = this->points.begin() + 2; it != this->points.end(); ++it) {
|
||||
Polygon p;
|
||||
p.points.reserve(3);
|
||||
p.points.push_back(this->points.front());
|
||||
p.points.push_back(*(it-1));
|
||||
p.points.push_back(*it);
|
||||
polygons->push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
SV*
|
||||
Polygon::to_SV_ref() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue