Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xs/src/libslic3r/MultiPoint.cpp')
-rw-r--r--xs/src/libslic3r/MultiPoint.cpp16
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 &center)
{
+ 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();
+}
+
}