summaryrefslogtreecommitdiffhomepage
path: root/spline-widget
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-05 17:14:38 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-05 17:14:38 +0200
commit06c591326a2c545484004b58a41c4b7b60c35525 (patch)
treea25f00334553c876254280b3622277ffebbaff33 /spline-widget
parent0b07159f32b28f775771ea37a4fa48fa94ef2d9e (diff)
spline-widget: fix rounding for short splines
This was especially visible with XYZ spline widgets.
Diffstat (limited to 'spline-widget')
-rw-r--r--spline-widget/spline.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/spline-widget/spline.cpp b/spline-widget/spline.cpp
index 7d0c8412..9f0f2dec 100644
--- a/spline-widget/spline.cpp
+++ b/spline-widget/spline.cpp
@@ -391,13 +391,13 @@ mem<const spline::settings> spline::get_settings() const
return s;
}
-int spline::precision(const QList<QPointF>& points) const
+double spline::precision(const QList<QPointF>& points) const
{
// this adjusts the memoized range to the largest X value. empty space doesn't take value_count discrete points.
if (points.size())
- return clamp(value_count / clamp(int(points[points.size() - 1].x()), 1, int(max_x)), 0, value_count);
+ return clamp(value_count / clamp(points[points.size() - 1].x(), 1., max_x), 0., double(value_count));
- return value_count / clamp(int(max_x), 1, value_count);
+ return value_count / clamp(max_x, 1., double(value_count));
}
namespace spline_detail {