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

This commit is contained in:
Benjamin Nauck
2025-03-27 19:02:45 +01:00
parent f5244d404c
commit bfdaa9aab2
40 changed files with 243 additions and 220 deletions

View File

@@ -24,6 +24,7 @@
#ifndef _PreComp_
#include <QMessageBox>
#include <gp_Pnt.hxx>
#include <numbers>
#endif// #ifndef _PreComp_
#include <App/Document.h>
@@ -193,7 +194,7 @@ void TaskComplexSection::setUiEdit()
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
Base::Vector3d projectedViewDirection = m_baseView->projectPoint(sectionNormalVec, false);
double viewAngle = atan2(-projectedViewDirection.y, -projectedViewDirection.x);
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
m_compass->setDialAngle(viewAngle * 180.0 / std::numbers::pi);
m_viewDirectionWidget->setValueNoNotify(projectedViewDirection * -1.0);
}
else {
@@ -308,7 +309,7 @@ void TaskComplexSection::slotViewDirectionChanged(Base::Vector3d newDirection)
}
projectedViewDirection.Normalize();
double viewAngle = atan2(projectedViewDirection.y, projectedViewDirection.x);
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
m_compass->setDialAngle(viewAngle * 180.0 / std::numbers::pi);
checkAll(false);
applyAligned();
}
@@ -318,7 +319,7 @@ void TaskComplexSection::slotViewDirectionChanged(Base::Vector3d newDirection)
void TaskComplexSection::slotChangeAngle(double newAngle)
{
// Base::Console().Message("TCS::slotAngleChanged(%.3f)\n", newAngle);
double angleRadians = newAngle * M_PI / 180.0;
double angleRadians = newAngle * std::numbers::pi / 180.0;
double unitX = cos(angleRadians);
double unitY = sin(angleRadians);
Base::Vector3d localUnit(unitX, unitY, 0.0);