New gcode visualization library - Custom values for travel and wipe moves radius

This commit is contained in:
enricoturri1966 2024-01-11 09:45:48 +01:00 committed by Lukas Matena
parent 7adaa32cd5
commit 72846bf0cd
3 changed files with 11 additions and 4 deletions

View File

@ -16,13 +16,18 @@ namespace libvgcode {
static constexpr float PI = 3.141592f; 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 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 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 // Vector in 3 dimensions

View File

@ -309,6 +309,7 @@ public:
float get_travels_radius() const; float get_travels_radius() const;
// //
// Set the radius, in mm, of the cylinders used to render the travel moves. // 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); void set_travels_radius(float radius);
// //
@ -317,6 +318,7 @@ public:
float get_wipes_radius() const; float get_wipes_radius() const;
// //
// Set the radius, in mm, of the cylinders used to render the wipe moves. // 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); void set_wipes_radius(float radius);

View File

@ -1002,13 +1002,13 @@ void ViewerImpl::set_color_range_palette(EViewType type, const Palette& palette)
void ViewerImpl::set_travels_radius(float radius) 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(); update_heights_widths();
} }
void ViewerImpl::set_wipes_radius(float radius) 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(); update_heights_widths();
} }