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 41756a3726
commit cf94011294
40 changed files with 243 additions and 220 deletions

View File

@@ -180,7 +180,7 @@ void TaskSectionView::setUiEdit()
Base::Vector3d projectedViewDirection = m_base->projectPoint(sectionNormalVec, false);
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);
m_viewDirectionWidget->setValueNoNotify(sectionNormalVec * -1.0);
}
@@ -272,7 +272,7 @@ void TaskSectionView::slotViewDirectionChanged(Base::Vector3d newDirection)
Base::Vector3d projectedViewDirection = m_base->projectPoint(newDirection, false);
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);
directionChanged(true);
applyAligned();
@@ -281,7 +281,7 @@ void TaskSectionView::slotViewDirectionChanged(Base::Vector3d newDirection)
//the CompassWidget reports that the view direction angle has changed
void TaskSectionView::slotChangeAngle(double 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);