MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / gridStep

Method gridStep

app/src/UI/Widgets/Plot3D.cpp:794–810  ·  view source on GitHub ↗

* @brief Computes a clean grid step based on current world scale. */

Source from the content-addressed store, hash-verified

792 * @brief Computes a clean grid step based on current world scale.
793 */
794double Widgets::Plot3D::gridStep(const double scale) const
795{
796 auto s = scale;
797 if (s == -1)
798 s = m_worldScale;
799
800 const float rawStep = 1.0f / s;
801 const float exponent = std::floor(std::log10(rawStep));
802 const float base = static_cast<float>(fastPow10(exponent));
803
804 if (rawStep >= base * 5)
805 return base * 5;
806 else if (rawStep >= base * 2)
807 return base * 2;
808 else
809 return base;
810}
811
812/**
813 * @brief Projects 3D world-space points into 2D screen-space coordinates.

Callers

nothing calls this directly

Calls 3

floorFunction · 0.85
log10Function · 0.85
fastPow10Function · 0.70

Tested by

no test coverage detected