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

@@ -986,7 +986,7 @@ double DrawViewPart::getSizeAlongVector(Base::Vector3d alignmentVector)
if (getEdgeCompound().IsNull()) {
return 1.0;
}
TopoDS_Shape rotatedShape = ShapeUtils::rotateShape(getEdgeCompound(), OXYZ, alignmentAngle * 180.0 / M_PI);
TopoDS_Shape rotatedShape = ShapeUtils::rotateShape(getEdgeCompound(), OXYZ, alignmentAngle * 180.0 / std::numbers::pi);
Bnd_Box shapeBox;
shapeBox.SetGap(0.0);
BRepBndLib::AddOptimal(rotatedShape, shapeBox);
@@ -1105,7 +1105,7 @@ gp_Ax2 DrawViewPart::getRotatedCS(const Base::Vector3d basePoint) const
// Base::Console().Message("DVP::getRotatedCS() - %s - %s\n", getNameInDocument(), Label.getValue());
gp_Ax2 unrotated = getProjectionCS(basePoint);
gp_Ax1 rotationAxis(Base::convertTo<gp_Pnt>(basePoint), unrotated.Direction());
double angleRad = Rotation.getValue() * M_PI / 180.0;
double angleRad = Rotation.getValue() * std::numbers::pi / 180.0;
gp_Ax2 rotated = unrotated.Rotated(rotationAxis, -angleRad);
return rotated;
}
@@ -1302,9 +1302,9 @@ void DrawViewPart::spin(const SpinDirection& spindirection)
{
double angle;
if (spindirection == SpinDirection::CW)
angle = M_PI / 2.0;// Top -> Right -> Bottom -> Left -> Top
angle = std::numbers::pi / 2.0;// Top -> Right -> Bottom -> Left -> Top
if (spindirection == SpinDirection::CCW)
angle = -M_PI / 2.0;// Top -> Left -> Bottom -> Right -> Top
angle = -std::numbers::pi / 2.0;// Top -> Left -> Bottom -> Right -> Top
spin(angle);
}
@@ -1338,7 +1338,7 @@ std::pair<Base::Vector3d, Base::Vector3d> DrawViewPart::getDirsFromFront(ProjDir
gp_Dir gNewDir;
gp_Dir gNewXDir;
double angle = M_PI / 2.0;//90*
double angle = std::numbers::pi / 2.0;//90*
if (viewType == ProjDirection::Right) {
newCS = anchorCS.Rotated(gUpAxis, angle);