From 00fd19331efdbb83a93100bac105891c2572737c Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 6 May 2018 20:37:18 -0500 Subject: [PATCH] Added convenience function to build a Point from a Pointf that is scaled. --- xs/src/libslic3r/Point.cpp | 5 +++++ xs/src/libslic3r/Point.hpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/xs/src/libslic3r/Point.cpp b/xs/src/libslic3r/Point.cpp index 9a4a71ac2..465f78db8 100644 --- a/xs/src/libslic3r/Point.cpp +++ b/xs/src/libslic3r/Point.cpp @@ -18,6 +18,11 @@ Point::operator==(const Point& rhs) const return this->coincides_with(rhs); } +Point +Point::new_scale(Pointf p) { + return Point(scale_(p.x), scale_(p.y)); +} + std::string Point::wkt() const { diff --git a/xs/src/libslic3r/Point.hpp b/xs/src/libslic3r/Point.hpp index 57a9ef7e8..3c0b5f299 100644 --- a/xs/src/libslic3r/Point.hpp +++ b/xs/src/libslic3r/Point.hpp @@ -36,6 +36,9 @@ class Point static Point new_scale(coordf_t x, coordf_t y) { return Point(scale_(x), scale_(y)); }; + + /// Scale and create a Point from a Pointf. + static Point new_scale(Pointf p); bool operator==(const Point& rhs) const; std::string wkt() const; std::string dump_perl() const;