mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Ported from the playground branch. Various documentation and optimization.
This commit is contained in:
parent
a5b7f14dfa
commit
620c6c7378
38 changed files with 586 additions and 92 deletions
|
@ -33,8 +33,8 @@ MultiPoint::translate(const Point &vector)
|
|||
void
|
||||
MultiPoint::rotate(double angle)
|
||||
{
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
|
||||
double cur_x = (double)it->x;
|
||||
double cur_y = (double)it->y;
|
||||
|
@ -46,8 +46,13 @@ MultiPoint::rotate(double angle)
|
|||
void
|
||||
MultiPoint::rotate(double angle, const Point ¢er)
|
||||
{
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
|
||||
(*it).rotate(angle, center);
|
||||
double dx = double(it->x - center.x);
|
||||
double dy = double(it->y - center.y);
|
||||
it->x = (coord_t)round(double(center.x) + c * dx - s * dy);
|
||||
it->y = (coord_t)round(double(center.y) + c * dy + s * dx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,4 +207,9 @@ MultiPoint::_douglas_peucker(const Points &points, const double tolerance)
|
|||
return results;
|
||||
}
|
||||
|
||||
BoundingBox get_extents(const MultiPoint &mp)
|
||||
{
|
||||
return mp.bounding_box();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue