From bc297b70b02dc14dd8e9e95d7b1bd68028ef260e Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 24 Jan 2024 11:24:53 +0100 Subject: [PATCH] Apply C++ good practices --- include/PathOrder.h | 11 ++++++++++- include/PathOrderMonotonic.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/PathOrder.h b/include/PathOrder.h index bd95594ee7..7fd338fbfc 100644 --- a/include/PathOrder.h +++ b/include/PathOrder.h @@ -42,7 +42,7 @@ class PathOrder * The location where the nozzle is assumed to start from before printing * these parts. */ - Point2LL start_point_; + const Point2LL start_point_; /*! * Seam settings. @@ -97,6 +97,15 @@ class PathOrder */ constexpr static coord_t coincident_point_distance_ = 10; + /*! + * \brief Basic constructor with a given start point + * \param start_point The location where the nozzle is assumed to start + * from before printing these parts. + */ + PathOrder(const Point2LL& start_point) + : start_point_(start_point) + { + } /*! * In the current set of paths, detect all loops and mark them as such. diff --git a/include/PathOrderMonotonic.h b/include/PathOrderMonotonic.h index 356eb248f5..2b8aa5dfc1 100644 --- a/include/PathOrderMonotonic.h +++ b/include/PathOrderMonotonic.h @@ -45,11 +45,11 @@ class PathOrderMonotonic : public PathOrder using PathOrder::coincident_point_distance_; PathOrderMonotonic(const AngleRadians monotonic_direction, const coord_t max_adjacent_distance, const Point2LL start_point) + : PathOrder(start_point) // The monotonic vector needs to rotate clockwise instead of counter-clockwise, the same as how the infill patterns are generated. - : monotonic_vector_(-std::cos(monotonic_direction) * monotonic_vector_resolution_, std::sin(monotonic_direction) * monotonic_vector_resolution_) + , monotonic_vector_(-std::cos(monotonic_direction) * monotonic_vector_resolution_, std::sin(monotonic_direction) * monotonic_vector_resolution_) , max_adjacent_distance_(max_adjacent_distance) { - this->start_point_ = start_point; } void optimize()