diff options
author | bubnikv <bubnikv@gmail.com> | 2016-09-13 14:30:00 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2016-09-13 14:30:00 +0300 |
commit | 620c6c7378c4799980f63794669548c104b9bcea (patch) | |
tree | fc7aea3342539018bb19d27abd1144956eb00b4d /xs/src/libslic3r/MultiPoint.cpp | |
parent | a5b7f14dfa291039fd6971a356efd011fab84440 (diff) |
Ported from the playground branch. Various documentation and optimization.
Diffstat (limited to 'xs/src/libslic3r/MultiPoint.cpp')
-rw-r--r-- | xs/src/libslic3r/MultiPoint.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xs/src/libslic3r/MultiPoint.cpp b/xs/src/libslic3r/MultiPoint.cpp index 5be53e5da..e253f9bba 100644 --- a/xs/src/libslic3r/MultiPoint.cpp +++ b/xs/src/libslic3r/MultiPoint.cpp @@ -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(); +} + } |