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

@@ -22,6 +22,8 @@
#include "PreCompiled.h"
#include <numbers>
#include <QApplication>
#include <QGestureEvent>
#include <QWidget>
@@ -86,8 +88,8 @@ SoGesturePinchEvent::SoGesturePinchEvent(QPinchGesture* qpinch, QWidget *widget)
deltaZoom = qpinch->scaleFactor();
totalZoom = qpinch->totalScaleFactor();
deltaAngle = -unbranchAngle((qpinch->rotationAngle()-qpinch->lastRotationAngle()) / 180.0 * M_PI);
totalAngle = -qpinch->totalRotationAngle() / 180 * M_PI;
deltaAngle = -unbranchAngle((qpinch->rotationAngle()-qpinch->lastRotationAngle()) / 180.0 * std::numbers::pi);
totalAngle = -qpinch->totalRotationAngle() / 180 * std::numbers::pi;
state = SbGestureState(qpinch->state());
@@ -111,7 +113,9 @@ SbBool SoGesturePinchEvent::isSoGesturePinchEvent(const SoEvent *ev) const
*/
double SoGesturePinchEvent::unbranchAngle(double ang)
{
return ang - 2.0 * M_PI * floor((ang + M_PI) / (2.0 * M_PI));
using std::numbers::pi;
return ang - 2.0 * pi * floor((ang + pi) / (2.0 * pi));
}