Skip to content

Commit

Permalink
Apply C++ good practices
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Jan 24, 2024
1 parent 41a8029 commit bc297b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion include/PathOrder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions include/PathOrderMonotonic.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class PathOrderMonotonic : public PathOrder<PathType>
using PathOrder<PathType>::coincident_point_distance_;

PathOrderMonotonic(const AngleRadians monotonic_direction, const coord_t max_adjacent_distance, const Point2LL start_point)
: PathOrder<PathType>(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()
Expand Down

0 comments on commit bc297b7

Please sign in to comment.