diff --git a/src/libvgcode/include/Types.hpp b/src/libvgcode/include/Types.hpp index 531bdf27ee..f4a44769bc 100644 --- a/src/libvgcode/include/Types.hpp +++ b/src/libvgcode/include/Types.hpp @@ -16,13 +16,18 @@ namespace libvgcode { static constexpr float PI = 3.141592f; // -// Default radius, in mm, of the cylinders used to render the travel moves. +// Predefined values for the radius, in mm, of the cylinders used to render the travel moves. // static constexpr float DEFAULT_TRAVELS_RADIUS_MM = 0.1f; +static constexpr float MIN_TRAVELS_RADIUS_MM = 0.05f; +static constexpr float MAX_TRAVELS_RADIUS_MM = 1.0f; + // -// Default radius, in mm, of the cylinders used to render the wipe moves. +// Predefined values for the radius, in mm, of the cylinders used to render the wipe moves. // static constexpr float DEFAULT_WIPES_RADIUS_MM = 0.1f; +static constexpr float MIN_WIPES_RADIUS_MM = 0.05f; +static constexpr float MAX_WIPES_RADIUS_MM = 1.0f; // // Vector in 3 dimensions diff --git a/src/libvgcode/include/Viewer.hpp b/src/libvgcode/include/Viewer.hpp index a79bb7e8a5..c93d007942 100644 --- a/src/libvgcode/include/Viewer.hpp +++ b/src/libvgcode/include/Viewer.hpp @@ -309,6 +309,7 @@ public: float get_travels_radius() const; // // Set the radius, in mm, of the cylinders used to render the travel moves. + // Radius is clamped to [MIN_TRAVELS_RADIUS_MM..MAX_TRAVELS_RADIUS_MM] // void set_travels_radius(float radius); // @@ -317,6 +318,7 @@ public: float get_wipes_radius() const; // // Set the radius, in mm, of the cylinders used to render the wipe moves. + // Radius is clamped to [MIN_WIPES_RADIUS_MM..MAX_WIPES_RADIUS_MM] // void set_wipes_radius(float radius); diff --git a/src/libvgcode/src/ViewerImpl.cpp b/src/libvgcode/src/ViewerImpl.cpp index df234b71b4..819bac0b3c 100644 --- a/src/libvgcode/src/ViewerImpl.cpp +++ b/src/libvgcode/src/ViewerImpl.cpp @@ -1002,13 +1002,13 @@ void ViewerImpl::set_color_range_palette(EViewType type, const Palette& palette) void ViewerImpl::set_travels_radius(float radius) { - m_travels_radius = std::clamp(radius, 0.05f, 0.5f); + m_travels_radius = std::clamp(radius, MIN_TRAVELS_RADIUS_MM, MAX_TRAVELS_RADIUS_MM); update_heights_widths(); } void ViewerImpl::set_wipes_radius(float radius) { - m_wipes_radius = std::clamp(radius, 0.05f, 0.5f); + m_wipes_radius = std::clamp(radius, MIN_WIPES_RADIUS_MM, MAX_WIPES_RADIUS_MM); update_heights_widths(); }