From 7b6dff3f0373281bd29cf28bc181eaf34e9c4a23 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik <bubnikv@gmail.com> Date: Thu, 21 May 2020 17:47:17 +0200 Subject: [PATCH] Little simplification of Point to boost::polygon bindings --- src/libslic3r/Point.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/Point.hpp b/src/libslic3r/Point.hpp index e511a6316..b818cd8be 100644 --- a/src/libslic3r/Point.hpp +++ b/src/libslic3r/Point.hpp @@ -369,7 +369,7 @@ namespace boost { namespace polygon { typedef coord_t coordinate_type; static inline coordinate_type get(const Slic3r::Point& point, orientation_2d orient) { - return (orient == HORIZONTAL) ? (coordinate_type)point(0) : (coordinate_type)point(1); + return (coordinate_type)point((orient == HORIZONTAL) ? 0 : 1); } }; @@ -377,16 +377,10 @@ namespace boost { namespace polygon { struct point_mutable_traits<Slic3r::Point> { typedef coord_t coordinate_type; static inline void set(Slic3r::Point& point, orientation_2d orient, coord_t value) { - if (orient == HORIZONTAL) - point(0) = value; - else - point(1) = value; + point((orient == HORIZONTAL) ? 0 : 1) = value; } static inline Slic3r::Point construct(coord_t x_value, coord_t y_value) { - Slic3r::Point retval; - retval(0) = x_value; - retval(1) = y_value; - return retval; + return Slic3r::Point(x_value, y_value); } }; } }