Gui: Use std::numeric_limits and std::numbers instead of defines

This commit is contained in:
Benjamin Nauck
2025-03-27 18:59:58 +01:00
parent 3253f2c2de
commit b625e81a3e
33 changed files with 204 additions and 168 deletions

View File

@@ -25,6 +25,8 @@
#include "NavigationAnimation.h"
#include <Inventor/nodes/SoCamera.h>
#include <numbers>
using namespace Gui;
NavigationAnimation::NavigationAnimation(NavigationStyle* navigation)
@@ -69,8 +71,8 @@ void FixedTimeAnimation::initialize()
SbVec3f rotationAxisPost;
float angle;
SbRotation(navigation->getCamera()->orientation.getValue().inverse() * targetOrientation).getValue(rotationAxisPost, angle);
if (angle > M_PI) {
angle -= float(2 * M_PI);
if (angle > std::numbers::pi) {
angle -= float(2 * std::numbers::pi);
}
// Convert post-multiplication axis to a pre-multiplication axis
@@ -130,9 +132,9 @@ SpinningAnimation::SpinningAnimation(NavigationStyle* navigation, const SbVec3f&
: NavigationAnimation(navigation)
, rotationAxis(axis)
{
setDuration((2 * M_PI / velocity) * 1000.0);
setDuration((2 * std::numbers::pi / velocity) * 1000.0);
setStartValue(0.0);
setEndValue(2 * M_PI);
setEndValue(2 * std::numbers::pi);
setLoopCount(-1);
}