diff options
author | bubnikv <bubnikv@gmail.com> | 2017-06-08 15:02:37 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-06-08 15:02:37 +0300 |
commit | f9f094029787b338ea508b9b27be5b1d33a79806 (patch) | |
tree | 3b819bb0f2fa925d6a4cb517b5386b79c3a57ee1 /xs/src/libslic3r/MultiPoint.cpp | |
parent | 27003dc0fdfdc8680082c8945467ef29b53505a5 (diff) |
Implemented rotation of the support structure.
Diffstat (limited to 'xs/src/libslic3r/MultiPoint.cpp')
-rw-r--r-- | xs/src/libslic3r/MultiPoint.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/xs/src/libslic3r/MultiPoint.cpp b/xs/src/libslic3r/MultiPoint.cpp index a1bc2140d..7929747a0 100644 --- a/xs/src/libslic3r/MultiPoint.cpp +++ b/xs/src/libslic3r/MultiPoint.cpp @@ -30,16 +30,13 @@ MultiPoint::translate(const Point &vector) this->translate(vector.x, vector.y); } -void -MultiPoint::rotate(double angle) +void MultiPoint::rotate(double cos_angle, double sin_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; - it->x = (coord_t)round(c * cur_x - s * cur_y); - it->y = (coord_t)round(c * cur_y + s * cur_x); + for (Point &pt : this->points) { + double cur_x = double(pt.x); + double cur_y = double(pt.y); + pt.x = coord_t(round(cos_angle * cur_x - sin_angle * cur_y)); + pt.y = coord_t(round(cos_angle * cur_y + sin_angle * cur_x)); } } |