From 33ba6d2fa7ac44095a059bfb285184160eed39ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 12 Jan 2017 16:51:41 +0100 Subject: [PATCH] [apps] In curve view range, improve constant naming Change-Id: Ibad771a35d1130f41ef57ba323fd401ff3ea4340 --- apps/curve_view_range.cpp | 2 +- apps/curve_view_range.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/curve_view_range.cpp b/apps/curve_view_range.cpp index f85bde9cd..e5d0fffe3 100644 --- a/apps/curve_view_range.cpp +++ b/apps/curve_view_range.cpp @@ -16,7 +16,7 @@ float CurveViewRange::computeGridUnit(Axis axis, float min, float max) { maxNumberOfUnits = k_maxNumberOfYGridUnits; minNumberOfUnits = k_minNumberOfYGridUnits; } - float units[3] = {k_oneUnit, k_twoUnit, k_fiveUnit}; + float units[3] = {k_smallGridUnitMantissa, k_mediumGridUnitMantissa, k_largeGridUnitMantissa}; for (int k = 0; k < 3; k++) { float unit = units[k]; if (floorf(log10f(d/(unit*maxNumberOfUnits))) != floorf(log10f(d/(unit*minNumberOfUnits)))) { diff --git a/apps/curve_view_range.h b/apps/curve_view_range.h index 514af2a63..69d13e8b7 100644 --- a/apps/curve_view_range.h +++ b/apps/curve_view_range.h @@ -19,9 +19,12 @@ public: private: constexpr static float k_minNumberOfXGridUnits = 7.0f; constexpr static float k_minNumberOfYGridUnits = 5.0f; - constexpr static float k_oneUnit = 1.0f; - constexpr static float k_twoUnit = 2.0f; - constexpr static float k_fiveUnit = 5.0f; + /* The grid units is constrained to be a number of type: k*10^n with k = 1,2 or 5 + * and n a relative integer. The choice of x and y grid units depend on the + * grid range.*/ + constexpr static float k_smallGridUnitMantissa = 1.0f; + constexpr static float k_mediumGridUnitMantissa = 2.0f; + constexpr static float k_largeGridUnitMantissa = 5.0f; }; #endif