diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp
index 9e691c0f16..7b4a27623d 100644
--- a/src/App/Expression.cpp
+++ b/src/App/Expression.cpp
@@ -49,6 +49,7 @@
#include
#include
#include
+#include
#include
#include "ExpressionParser.h"
@@ -2213,7 +2214,7 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std
Rotation rotation = Base::Rotation(
Vector3d(static_cast(f == MROTATEX), static_cast(f == MROTATEY), static_cast(f == MROTATEZ)),
- rotationAngle.getValue() * pi / 180.0);
+ Base::toRadians(rotationAngle.getValue()));
Base::Matrix4D rotationMatrix;
rotation.getValue(rotationMatrix);
@@ -2411,7 +2412,7 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std
_EXPR_THROW("Unit must be either empty or an angle.", expr);
// Convert value to radians
- value *= pi / 180.0;
+ value = Base::toRadians(value);
unit = Unit();
break;
case ACOS:
diff --git a/src/Base/PlacementPyImp.cpp b/src/Base/PlacementPyImp.cpp
index 8513895157..5e1428bc4e 100644
--- a/src/Base/PlacementPyImp.cpp
+++ b/src/Base/PlacementPyImp.cpp
@@ -100,7 +100,7 @@ int PlacementPy::PyInit(PyObject* args, PyObject* /*kwd*/)
// NOTE: The first parameter defines the translation, the second the rotation axis
// and the last parameter defines the rotation angle in degree.
Base::Rotation rot(static_cast(d)->value(),
- angle / 180.0 * std::numbers::pi);
+ Base::toRadians(angle));
*getPlacementPtr() = Base::Placement(static_cast(o)->value(), rot);
return 0;
}
diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp
index d35fa1e672..2882d37c62 100644
--- a/src/Base/Rotation.cpp
+++ b/src/Base/Rotation.cpp
@@ -29,6 +29,7 @@
#include
#include "Base/Exception.h"
+#include "Base/Tools.h"
#include "Rotation.h"
#include "Matrix.h"
@@ -696,9 +697,9 @@ void Rotation::setYawPitchRoll(double y, double p, double r)
{
// The Euler angles (yaw,pitch,roll) are in XY'Z''-notation
// convert to radians
- y = (y / 180.0) * std::numbers::pi;
- p = (p / 180.0) * std::numbers::pi;
- r = (r / 180.0) * std::numbers::pi;
+ y = toRadians(y);
+ p = toRadians(p);
+ r = toRadians(r);
double c1 = cos(y / 2.0);
double s1 = sin(y / 2.0);
@@ -994,9 +995,9 @@ void Rotation::setEulerAngles(EulerSequence theOrder,
EulerSequence_Parameters o = translateEulerSequence(theOrder);
- theAlpha *= pi / 180.0;
- theBeta *= pi / 180.0;
- theGamma *= pi / 180.0;
+ theAlpha = Base::toRadians(theAlpha);
+ theBeta = Base::toRadians(theBeta);
+ theGamma = Base::toRadians(theGamma);
double a = theAlpha;
double b = theBeta;
diff --git a/src/Gui/SoTouchEvents.cpp b/src/Gui/SoTouchEvents.cpp
index 8b99c606e8..eaa6b16085 100644
--- a/src/Gui/SoTouchEvents.cpp
+++ b/src/Gui/SoTouchEvents.cpp
@@ -29,6 +29,7 @@
#include
#include
+#include
#include "SoTouchEvents.h"
@@ -88,8 +89,8 @@ SoGesturePinchEvent::SoGesturePinchEvent(QPinchGesture* qpinch, QWidget *widget)
deltaZoom = qpinch->scaleFactor();
totalZoom = qpinch->totalScaleFactor();
- deltaAngle = -unbranchAngle((qpinch->rotationAngle()-qpinch->lastRotationAngle()) / 180.0 * std::numbers::pi);
- totalAngle = -qpinch->totalRotationAngle() / 180 * std::numbers::pi;
+ deltaAngle = -unbranchAngle(Base::toRadians(qpinch->rotationAngle()-qpinch->lastRotationAngle()));
+ totalAngle = Base::toRadians(-qpinch->totalRotationAngle());
state = SbGestureState(qpinch->state());
diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp
index b6b0e68b81..78734b9b67 100644
--- a/src/Gui/Transform.cpp
+++ b/src/Gui/Transform.cpp
@@ -26,6 +26,7 @@
#include
#include
+#include
#include
#include
@@ -378,7 +379,6 @@ Base::Vector3d Transform::getDirection() const
Base::Placement Transform::getPlacementData() const
{
- using std::numbers::pi;
int index = ui->rotationInput->currentIndex();
Base::Rotation rot;
Base::Vector3d pos;
@@ -389,7 +389,8 @@ Base::Placement Transform::getPlacementData() const
if (index == 0) {
Base::Vector3d dir = getDirection();
- rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),ui->angle->value().getValue()*pi/180.0);
+ rot.setValue(Base::Vector3d(dir.x,dir.y,dir.z),
+ Base::toRadians(ui->angle->value().getValue()));
}
else if (index == 1) {
rot.setYawPitchRoll(
diff --git a/src/Mod/CAM/App/Area.cpp b/src/Mod/CAM/App/Area.cpp
index 100bba2a90..de73697705 100644
--- a/src/Mod/CAM/App/Area.cpp
+++ b/src/Mod/CAM/App/Area.cpp
@@ -72,6 +72,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -2632,7 +2633,7 @@ TopoDS_Shape Area::makePocket(int index, PARAM_ARGS(PARAM_FARG, AREA_PARAMS_POCK
for (int j = 0; j < steps; ++j, offset += stepover) {
Point p1(-r, offset), p2(r, offset);
if (a > Precision::Confusion()) {
- double r = a * std::numbers::pi / 180.0;
+ double r = Base::toRadians(a);
p1.Rotate(r);
p2.Rotate(r);
}
diff --git a/src/Mod/CAM/App/PathSegmentWalker.cpp b/src/Mod/CAM/App/PathSegmentWalker.cpp
index 5b9a54b6cb..4274d3281c 100644
--- a/src/Mod/CAM/App/PathSegmentWalker.cpp
+++ b/src/Mod/CAM/App/PathSegmentWalker.cpp
@@ -25,6 +25,7 @@
#include
#include
+#include
#include "PathSegmentWalker.h"
@@ -187,7 +188,7 @@ void PathSegmentWalker::walk(PathSegmentVisitor& cb, const Base::Vector3d& start
if (nrot != lrot) {
double amax = std::max(fmod(fabs(a - A), 360),
std::max(fmod(fabs(b - B), 360), fmod(fabs(c - C), 360)));
- double angle = amax / 180 * std::numbers::pi;
+ double angle = Base::toRadians(amax);
int segments = std::max(ARC_MIN_SEGMENTS, 3.0 / (deviation / angle));
double da = (a - A) / segments;
@@ -329,7 +330,7 @@ void PathSegmentWalker::walk(PathSegmentVisitor& cb, const Base::Vector3d& start
if (nrot != lrot) {
double amax = std::max(fmod(fabs(a - A), 360),
std::max(fmod(fabs(b - B), 360), fmod(fabs(c - C), 360)));
- double angle = amax / 180 * std::numbers::pi;
+ double angle = Base::toRadians(amax);
int segments = std::max(ARC_MIN_SEGMENTS, 3.0 / (deviation / angle));
double da = (a - A) / segments;
diff --git a/src/Mod/CAM/App/Voronoi.cpp b/src/Mod/CAM/App/Voronoi.cpp
index 0ccad2e191..1f840559f7 100644
--- a/src/Mod/CAM/App/Voronoi.cpp
+++ b/src/Mod/CAM/App/Voronoi.cpp
@@ -25,6 +25,7 @@
#endif
#include
+#include
#include "Voronoi.h"
@@ -291,7 +292,7 @@ bool Voronoi::diagram_type::segmentsAreConnected(int i, int j) const
void Voronoi::colorColinear(Voronoi::color_type color, double degree)
{
using std::numbers::pi;
- double rad = degree * pi / 180;
+ double rad = Base::toRadians(degree);
Voronoi::diagram_type::angle_map_t angle;
int psize = vd->points.size();
diff --git a/src/Mod/Fem/App/FemConstraintTransform.cpp b/src/Mod/Fem/App/FemConstraintTransform.cpp
index aaa7299009..83206182b8 100644
--- a/src/Mod/Fem/App/FemConstraintTransform.cpp
+++ b/src/Mod/Fem/App/FemConstraintTransform.cpp
@@ -23,6 +23,7 @@
#include "PreCompiled.h"
+#include
#include
#include "FemConstraintTransform.h"
@@ -116,14 +117,12 @@ namespace
Base::Rotation anglesToRotation(double xAngle, double yAngle, double zAngle)
{
- using std::numbers::pi;
-
static Base::Vector3d a(1, 0, 0);
static Base::Vector3d b(0, 1, 0);
static int count = 0;
- double xRad = xAngle * pi / 180.0;
- double yRad = yAngle * pi / 180.0;
- double zRad = zAngle * pi / 180.0;
+ double xRad = Base::toRadians(xAngle);
+ double yRad = Base::toRadians(yAngle);
+ double zRad = Base::toRadians(zAngle);
if (xAngle != 0) {
a[1] = 0;
a[2] = 0;
diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp
index 95609843a4..326853ca15 100644
--- a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp
+++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp
@@ -33,6 +33,7 @@
#include "Gui/Control.h"
#include
+#include
#include
#include "FemGuiTools.h"
@@ -88,7 +89,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
if (dia < 2 * radius) {
dia = 2 * radius;
}
- double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
+ double angle = Base::toRadians(pcConstraint->ForceAngle.getValue());
SbVec3f b(base.x, base.y, base.z);
SbVec3f ax(axis.x, axis.y, axis.z);
@@ -118,7 +119,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
if (dia < 2 * radius) {
dia = 2 * radius;
}
- double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
+ double angle = Base::toRadians(pcConstraint->ForceAngle.getValue());
SbVec3f ax(axis.x, axis.y, axis.z);
SbVec3f dir(direction.x, direction.y, direction.z);
@@ -143,7 +144,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
direction = Base::Vector3d(0, 1, 0);
}
double dia = pcConstraint->Diameter.getValue();
- double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
+ double angle = Base::toRadians(pcConstraint->ForceAngle.getValue());
SbVec3f ax(axis.x, axis.y, axis.z);
SbVec3f dir(direction.x, direction.y, direction.z);
diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp
index 4cd2bc084f..82aad692ea 100644
--- a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp
+++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp
@@ -30,6 +30,7 @@
#include
#endif
+#include
#include "Gui/Control.h"
#include "FemGuiTools.h"
#include "TaskFemConstraintPulley.h"
@@ -84,7 +85,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
if (dia < 2 * radius) {
dia = 2 * radius;
}
- double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
+ double forceAngle = Base::toRadians(pcConstraint->ForceAngle.getValue());
double beltAngle = pcConstraint->BeltAngle.getValue();
double rat1 = 0.8, rat2 = 0.2;
double f1 = pcConstraint->BeltForce1.getValue();
@@ -136,7 +137,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
if (dia < 2 * radius) {
dia = 2 * radius;
}
- double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
+ double forceAngle = Base::toRadians(pcConstraint->ForceAngle.getValue());
double beltAngle = pcConstraint->BeltAngle.getValue();
double rat1 = 0.8, rat2 = 0.2;
double f1 = pcConstraint->BeltForce1.getValue();
@@ -189,7 +190,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
if (dia < 2 * radius) {
dia = 2 * radius;
}
- double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
+ double forceAngle = Base::toRadians(pcConstraint->ForceAngle.getValue());
double beltAngle = pcConstraint->BeltAngle.getValue();
const SoSeparator* sep = static_cast(pShapeSep->getChild(3));
diff --git a/src/Mod/Measure/Gui/ViewProviderMeasureAngle.cpp b/src/Mod/Measure/Gui/ViewProviderMeasureAngle.cpp
index 33cfbd62b2..7609486af2 100644
--- a/src/Mod/Measure/Gui/ViewProviderMeasureAngle.cpp
+++ b/src/Mod/Measure/Gui/ViewProviderMeasureAngle.cpp
@@ -67,6 +67,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -325,8 +326,7 @@ void ViewProviderMeasureAngle::redrawAnnotation()
{
auto obj = dynamic_cast(getMeasureObject());
double angleDeg = obj->Angle.getValue();
- constexpr double radiansPerDegree = std::numbers::pi / 180.0;
- this->fieldAngle = angleDeg * radiansPerDegree;
+ this->fieldAngle = Base::toRadians(angleDeg);
// Set matrix
try {
diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp
index abffc334bd..53fb59e28e 100644
--- a/src/Mod/Part/App/FeatureExtrusion.cpp
+++ b/src/Mod/Part/App/FeatureExtrusion.cpp
@@ -38,6 +38,7 @@
#endif
#include
+#include
#include "FeatureExtrusion.h"
#include "ExtrusionHelper.h"
@@ -246,10 +247,10 @@ ExtrusionParameters Extrusion::computeFinalParameters()
result.solid = this->Solid.getValue();
- result.taperAngleFwd = this->TaperAngle.getValue() * pi / 180.0;
+ result.taperAngleFwd = Base::toRadians(this->TaperAngle.getValue());
if (fabs(result.taperAngleFwd) > pi * 0.5 - Precision::Angular())
throw Base::ValueError("Magnitude of taper angle matches or exceeds 90 degrees. That is too much.");
- result.taperAngleRev = this->TaperAngleRev.getValue() * pi / 180.0;
+ result.taperAngleRev = Base::toRadians(this->TaperAngleRev.getValue());
if (fabs(result.taperAngleRev) > pi * 0.5 - Precision::Angular())
throw Base::ValueError("Magnitude of taper angle matches or exceeds 90 degrees. That is too much.");
diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp
index 2a59f99bce..1bc993ce01 100644
--- a/src/Mod/Part/App/FeatureRevolution.cpp
+++ b/src/Mod/Part/App/FeatureRevolution.cpp
@@ -30,6 +30,7 @@
# include
#endif
+#include
#include "FeatureRevolution.h"
#include "FaceMaker.h"
@@ -143,7 +144,7 @@ App::DocumentObjectExecReturn *Revolution::execute()
gp_Ax1 revAx(pnt, dir);
//read out revolution angle
- double angle = Angle.getValue()/180.0f * std::numbers::pi;
+ double angle = Base::toRadians(Angle.getValue());
if (fabs(angle) < Precision::Angular())
angle = angle_edge;
diff --git a/src/Mod/Part/Gui/DlgRevolution.cpp b/src/Mod/Part/Gui/DlgRevolution.cpp
index 5002410851..ce585d634d 100644
--- a/src/Mod/Part/Gui/DlgRevolution.cpp
+++ b/src/Mod/Part/Gui/DlgRevolution.cpp
@@ -309,7 +309,7 @@ bool DlgRevolution::validate()
//check angle
if (!axisLinkHasAngle){
- if (fabs(this->getAngle() / 180.0 * std::numbers::pi) < Precision::Angular()) {
+ if (fabs(Base::toRadians(this->getAngle())) < Precision::Angular()) {
QMessageBox::critical(this, windowTitle(),
tr("Revolution angle span is zero. It must be non-zero."));
ui->angle->setFocus();
diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp
index 1d9df50d3f..2f70a08a6c 100644
--- a/src/Mod/Part/Gui/ViewProviderExt.cpp
+++ b/src/Mod/Part/Gui/ViewProviderExt.cpp
@@ -981,7 +981,7 @@ void ViewProviderPartExt::updateVisual()
//deflection = std::min(deflection, 20.0);
// create or use the mesh on the data structure
- Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * std::numbers::pi;
+ Standard_Real AngDeflectionRads = Base::toRadians(AngularDeflection.getValue());
IMeshTools_Parameters meshParams;
meshParams.Deflection = deflection;
diff --git a/src/Mod/PartDesign/App/FeatureExtrude.cpp b/src/Mod/PartDesign/App/FeatureExtrude.cpp
index f1a6f43d7c..83dafdc2b9 100644
--- a/src/Mod/PartDesign/App/FeatureExtrude.cpp
+++ b/src/Mod/PartDesign/App/FeatureExtrude.cpp
@@ -721,8 +721,8 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
Part::ExtrusionParameters params;
params.dir = dir;
params.solid = makeface;
- params.taperAngleFwd = this->TaperAngle.getValue() * pi / 180.0;
- params.taperAngleRev = this->TaperAngle2.getValue() * pi / 180.0;
+ params.taperAngleFwd = Base::toRadians(this->TaperAngle.getValue());
+ params.taperAngleRev = Base::toRadians(this->TaperAngle2.getValue());
if (L2 == 0.0 && Midplane.getValue()) {
params.lengthFwd = L / 2;
params.lengthRev = L / 2;
diff --git a/src/Mod/PartDesign/App/FeatureHelix.cpp b/src/Mod/PartDesign/App/FeatureHelix.cpp
index 4afb42f670..11bb0bc2b6 100644
--- a/src/Mod/PartDesign/App/FeatureHelix.cpp
+++ b/src/Mod/PartDesign/App/FeatureHelix.cpp
@@ -496,7 +496,7 @@ double Helix::safePitch()
}
}
- double angle = Angle.getValue() / 180.0 * std::numbers::pi;
+ double angle = Base::toRadians(Angle.getValue());
gp_Dir direction(axisVec.x, axisVec.y, axisVec.z);
gp_Dir directionStart(startVec.x, startVec.y, startVec.z);
TopoDS_Shape sketchshape = getVerifiedFace();
diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp
index 448db0bad9..e6485b79d1 100644
--- a/src/Mod/PartDesign/App/FeatureHole.cpp
+++ b/src/Mod/PartDesign/App/FeatureHole.cpp
@@ -2245,7 +2245,7 @@ TopoDS_Shape Hole::makeThread(const gp_Vec& xDir, const gp_Vec& zDir, double len
// | base-sharpV Rmaj H
// the little adjustment of p1 and p4 is here to prevent coincidencies
- double marginX = std::tan(62.5 * std::numbers::pi / 180.0) * marginZ;
+ double marginX = std::tan(Base::toRadians(62.5)) * marginZ;
gp_Pnt p1 = toPnt(
(RmajC - 5 * H / 6 + marginX) * xDir
@@ -2282,7 +2282,7 @@ TopoDS_Shape Hole::makeThread(const gp_Vec& xDir, const gp_Vec& zDir, double len
// | base-sharpV Rmaj
// the little adjustment of p1 and p4 is here to prevent coincidencies
- double marginX = std::tan(60.0 * std::numbers::pi / 180.0) * marginZ;
+ double marginX = std::tan(Base::toRadians(60.0)) * marginZ;
gp_Pnt p1 = toPnt(
(RmajC - h + marginX) * xDir
+ marginZ * zDir
diff --git a/src/Mod/PartDesign/Gui/ViewProviderAddSub.cpp b/src/Mod/PartDesign/Gui/ViewProviderAddSub.cpp
index 66ad7b123d..0cc2fdbefe 100644
--- a/src/Mod/PartDesign/Gui/ViewProviderAddSub.cpp
+++ b/src/Mod/PartDesign/Gui/ViewProviderAddSub.cpp
@@ -40,6 +40,7 @@
#endif
#include
+#include
#include
#include
#include
@@ -121,7 +122,7 @@ void ViewProviderAddSub::updateAddSubShapeIndicator() {
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Deviation.getValue();
// create or use the mesh on the data structure
- Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * std::numbers::pi;
+ Standard_Real AngDeflectionRads = Base::toRadians(AngularDeflection.getValue());
BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True);
// We must reset the location here because the transformation data
diff --git a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp
index b3edfa0efe..9b46447312 100644
--- a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp
+++ b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp
@@ -48,6 +48,7 @@
#include
#include
+#include
#include
#include
#include
@@ -228,7 +229,7 @@ void ViewProviderTransformed::showRejectedShape(TopoDS_Shape shape)
// create or use the mesh on the data structure
// Note: This DOES have an effect on shape
- Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * std::numbers::pi;
+ Standard_Real AngDeflectionRads = Base::toRadians(AngularDeflection.getValue());
BRepMesh_IncrementalMesh(shape, deflection, Standard_False, AngDeflectionRads, Standard_True);
// We must reset the location here because the transformation data
diff --git a/src/Mod/ReverseEngineering/App/RegionGrowing.cpp b/src/Mod/ReverseEngineering/App/RegionGrowing.cpp
index 68ce1df37f..75c98dd08e 100644
--- a/src/Mod/ReverseEngineering/App/RegionGrowing.cpp
+++ b/src/Mod/ReverseEngineering/App/RegionGrowing.cpp
@@ -25,6 +25,7 @@
#include
#endif
+#include
#include
#include "RegionGrowing.h"
@@ -88,7 +89,7 @@ void RegionGrowing::perform(int ksearch)
reg.setInputCloud(cloud);
// reg.setIndices (indices);
reg.setInputNormals(normals);
- reg.setSmoothnessThreshold(3.0 / 180.0 * std::numbers::pi);
+ reg.setSmoothnessThreshold(Base::toRadians(3.0));
reg.setCurvatureThreshold(1.0);
std::vector clusters;
@@ -142,7 +143,7 @@ void RegionGrowing::perform(const std::vector& myNormals)
reg.setInputCloud(cloud);
// reg.setIndices (indices);
reg.setInputNormals(normals);
- reg.setSmoothnessThreshold(3.0 / 180.0 * std::numbers::pi);
+ reg.setSmoothnessThreshold(Base::toRadians(3.0));
reg.setCurvatureThreshold(1.0);
std::vector clusters;
diff --git a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp
index 5b1852c2ba..8373c795eb 100644
--- a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp
+++ b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp
@@ -34,6 +34,7 @@
#include
#endif
+#include
#include
#include
#include
@@ -173,8 +174,6 @@ void ViewProviderRobotObject::onChanged(const App::Property* prop)
void ViewProviderRobotObject::updateData(const App::Property* prop)
{
- using std::numbers::pi;
-
Robot::RobotObject* robObj = static_cast(pcObject);
if (prop == &robObj->RobotVrmlFile) {
// read also from file
@@ -271,33 +270,33 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
}
if (Axis1Node) {
Axis1Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis1.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis1.getValue()));
}
if (Axis2Node) {
Axis2Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis2.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis2.getValue()));
}
if (Axis3Node) {
Axis3Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis3.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis3.getValue()));
}
if (Axis4Node) {
Axis4Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis4.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis4.getValue()));
}
if (Axis5Node) {
Axis5Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis5.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis5.getValue()));
}
if (Axis6Node) {
Axis6Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis6.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis6.getValue()));
}
}
else if (prop == &robObj->Axis1) {
if (Axis1Node) {
Axis1Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis1.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis1.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -307,7 +306,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
else if (prop == &robObj->Axis2) {
if (Axis2Node) {
Axis2Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis2.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis2.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -317,7 +316,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
else if (prop == &robObj->Axis3) {
if (Axis3Node) {
Axis3Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis3.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis3.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -327,7 +326,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
else if (prop == &robObj->Axis4) {
if (Axis4Node) {
Axis4Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis4.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis4.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -337,7 +336,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
else if (prop == &robObj->Axis5) {
if (Axis5Node) {
Axis5Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis5.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis5.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -347,7 +346,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
else if (prop == &robObj->Axis6) {
if (Axis6Node) {
Axis6Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0),
- robObj->Axis6.getValue() * (pi / 180));
+ Base::toRadians(robObj->Axis6.getValue()));
if (toolShape) {
toolShape->setTransformation(
(robObj->Tcp.getValue() * (robObj->ToolBase.getValue().inverse())).toMatrix());
@@ -404,22 +403,22 @@ void ViewProviderRobotObject::setAxisTo(float A1,
if (Axis1Node) {
// FIXME Ugly hack for the wrong transformation of the Kuka 500 robot VRML the minus sign on
// Axis 1
- Axis1Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A1 * (pi / 180));
+ Axis1Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A1));
}
if (Axis2Node) {
- Axis2Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A2 * (pi / 180));
+ Axis2Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A2));
}
if (Axis3Node) {
- Axis3Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A3 * (pi / 180));
+ Axis3Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A3));
}
if (Axis4Node) {
- Axis4Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A4 * (pi / 180));
+ Axis4Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A4));
}
if (Axis5Node) {
- Axis5Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A5 * (pi / 180));
+ Axis5Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A5));
}
if (Axis6Node) {
- Axis6Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), A6 * (pi / 180));
+ Axis6Node->rotation.setValue(SbVec3f(0.0, 1.0, 0.0), Base::toRadians(A6));
}
// update tool position
if (toolShape) {
diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp
index 090ea98dc2..664cf85191 100644
--- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp
+++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp
@@ -113,11 +113,11 @@ void finishDatumConstraint(Gui::Command* cmd,
float labelPositionRandomness = 0.0;
if (lastConstraintType == Radius || lastConstraintType == Diameter) {
- labelPosition = hGrp->GetFloat("RadiusDiameterConstraintDisplayBaseAngle", 15.0)
- * (std::numbers::pi / 180);// Get radius/diameter constraint display angle
+ // Get radius/diameter constraint display angle
+ labelPosition = Base::toRadians(hGrp->GetFloat("RadiusDiameterConstraintDisplayBaseAngle", 15.0));
+ // Get randomness
labelPositionRandomness =
- hGrp->GetFloat("RadiusDiameterConstraintDisplayAngleRandomness", 0.0)
- * (std::numbers::pi / 180);// Get randomness
+ Base::toRadians(hGrp->GetFloat("RadiusDiameterConstraintDisplayAngleRandomness", 0.0));
// Adds a random value around the base angle, so that possibly overlapping labels get likely
// a different position.
diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp
index 6d03b52537..7852e964f5 100644
--- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp
+++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp
@@ -533,7 +533,7 @@ void DrawSketchHandler::seekAlignmentAutoConstraint(
const Base::Vector2d& Dir)
{
using std::numbers::pi;
- const double angleDevRad = 0.035; // 2 degrees in radians
+ constexpr double angleDevRad = Base::toRadians(2);
AutoConstraint constr;
constr.Type = Sketcher::None;
diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h
index f1412f8d7c..635a1192ad 100644
--- a/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h
+++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h
@@ -26,6 +26,8 @@
#include
+#include
+
#include
#include
#include
@@ -585,7 +587,7 @@ void DSHTranslateControllerBase::doEnforceControlParameters(Base::Vector2d& onSk
if (onViewParameters[OnViewParameter::Fourth]->isSet) {
double angle =
- onViewParameters[OnViewParameter::Fourth]->getValue() * std::numbers::pi / 180;
+ Base::toRadians(onViewParameters[OnViewParameter::Fourth]->getValue());
onSketchPos.x = handler->referencePoint.x + cos(angle) * length;
onSketchPos.y = handler->referencePoint.y + sin(angle) * length;
}
@@ -609,7 +611,7 @@ void DSHTranslateControllerBase::doEnforceControlParameters(Base::Vector2d& onSk
if (onViewParameters[OnViewParameter::Sixth]->isSet) {
double angle =
- onViewParameters[OnViewParameter::Sixth]->getValue() * std::numbers::pi / 180;
+ Base::toRadians(onViewParameters[OnViewParameter::Sixth]->getValue());
onSketchPos.x = handler->referencePoint.x + cos(angle) * length;
onSketchPos.y = handler->referencePoint.y + sin(angle) * length;
}
diff --git a/src/Mod/Sketcher/Gui/SnapManager.cpp b/src/Mod/Sketcher/Gui/SnapManager.cpp
index fd34a6df0e..574102257d 100644
--- a/src/Mod/Sketcher/Gui/SnapManager.cpp
+++ b/src/Mod/Sketcher/Gui/SnapManager.cpp
@@ -25,6 +25,7 @@
#include
#endif // #ifndef _PreComp_
+#include
#include
#include "SnapManager.h"
@@ -122,8 +123,8 @@ void SnapManager::ParameterObserver::updateSnapAngleParameter(const std::string&
{
ParameterGrp::handle hGrp = getParameterGrpHandle();
- client.snapAngle = fmod(hGrp->GetFloat(parametername.c_str(), 5.) * std::numbers::pi / 180,
- 2 * std::numbers::pi);
+ client.snapAngle =
+ fmod(Base::toRadians(hGrp->GetFloat(parametername.c_str(), 5.)), 2 * std::numbers::pi);
}
void SnapManager::ParameterObserver::subscribeToParameters()
diff --git a/src/Mod/TechDraw/App/CenterLine.cpp b/src/Mod/TechDraw/App/CenterLine.cpp
index 3ca87f7832..965fffd935 100644
--- a/src/Mod/TechDraw/App/CenterLine.cpp
+++ b/src/Mod/TechDraw/App/CenterLine.cpp
@@ -33,6 +33,7 @@
#include
#include
+#include
#include "CenterLine.h"
#include "DrawUtil.h"
@@ -392,7 +393,7 @@ std::pair CenterLine::rotatePointsAroundMid(cons
const double angleDeg)
{
std::pair result;
- double angleRad = angleDeg * std::numbers::pi / 180.0;
+ double angleRad = Base::toRadians(angleDeg);
result.first.x = ((p1.x - mid.x) * cos(angleRad)) - ((p1.y - mid.y) * sin(angleRad)) + mid.x;
result.first.y = ((p1.x - mid.x) * sin(angleRad)) + ((p1.y - mid.y) * cos(angleRad)) + mid.y;
diff --git a/src/Mod/TechDraw/App/DrawComplexSection.cpp b/src/Mod/TechDraw/App/DrawComplexSection.cpp
index 198d5da1ec..db4bfd8e6c 100644
--- a/src/Mod/TechDraw/App/DrawComplexSection.cpp
+++ b/src/Mod/TechDraw/App/DrawComplexSection.cpp
@@ -114,6 +114,7 @@
#include
#include
#include
+#include
#include
@@ -956,7 +957,7 @@ gp_Vec DrawComplexSection::projectVector(const gp_Vec& vec) const
// being slightly wrong. see https://forum.freecad.org/viewtopic.php?t=79017&sid=612a62a60f5db955ee071a7aaa362dbb
bool DrawComplexSection::validateOffsetProfile(TopoDS_Wire profile, Base::Vector3d direction, double angleThresholdDeg) const
{
- double angleThresholdRad = angleThresholdDeg * std::numbers::pi / 180.0; // 5 degrees
+ double angleThresholdRad = Base::toRadians(angleThresholdDeg); // 5 degrees
TopExp_Explorer explEdges(profile, TopAbs_EDGE);
for (; explEdges.More(); explEdges.Next()) {
std::pair segmentEnds = getSegmentEnds(TopoDS::Edge(explEdges.Current()));
diff --git a/src/Mod/TechDraw/App/DrawGeomHatch.cpp b/src/Mod/TechDraw/App/DrawGeomHatch.cpp
index 7529cb38ee..417b7f386a 100644
--- a/src/Mod/TechDraw/App/DrawGeomHatch.cpp
+++ b/src/Mod/TechDraw/App/DrawGeomHatch.cpp
@@ -53,6 +53,7 @@
#include
#include
#include
+#include
#include "DrawGeomHatch.h"
#include "DrawGeomHatchPy.h" // generated from DrawGeomHatchPy.xml
@@ -402,12 +403,13 @@ std::vector DrawGeomHatch::makeEdgeOverlay(PATLineSpec hatchLine, B
double interval = hatchLine.getInterval() * scale;
double offset = hatchLine.getOffset() * scale;
double angle = hatchLine.getAngle() + rotation;
- origin.RotateZ(rotation * pi / 180.);
+ origin.RotateZ(Base::toRadians(rotation));
if (scale == 0. || interval == 0.)
return {};
- Base::Vector3d hatchDirection(cos(angle * pi / 180.), sin(angle * pi / 180.), 0.);
+ const double hatchAngle = Base::toRadians(angle);
+ Base::Vector3d hatchDirection(cos(hatchAngle), sin(hatchAngle), 0.);
Base::Vector3d hatchPerpendicular(-hatchDirection.y, hatchDirection.x, 0.);
Base::Vector3d hatchIntervalAndOffset = offset * hatchDirection + interval * hatchPerpendicular;
diff --git a/src/Mod/TechDraw/App/DrawUtil.cpp b/src/Mod/TechDraw/App/DrawUtil.cpp
index b09ab5d22f..f3ca7ea551 100644
--- a/src/Mod/TechDraw/App/DrawUtil.cpp
+++ b/src/Mod/TechDraw/App/DrawUtil.cpp
@@ -63,6 +63,7 @@
#include
#include
#include
+#include
#include
#include
@@ -1060,8 +1061,8 @@ Base::Vector3d DrawUtil::toAppSpace(const DrawViewPart& dvp, const Base::Vector
// remove the effect of the Rotation property
double rotDeg = dvp.Rotation.getValue();
- double rotRad = rotDeg * std::numbers::pi / 180.0;
if (rotDeg != 0.0) {
+ double rotRad = Base::toRadians(rotDeg);
// we always rotate around the origin.
appPoint.RotateZ(-rotRad);
}
diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp
index 48ef38fde2..4b77dcff77 100644
--- a/src/Mod/TechDraw/App/DrawViewPart.cpp
+++ b/src/Mod/TechDraw/App/DrawViewPart.cpp
@@ -71,6 +71,7 @@
#include
#include
#include
+#include
#include "Cosmetic.h"
#include "CenterLine.h"
@@ -1105,7 +1106,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(basePoint), unrotated.Direction());
- double angleRad = Rotation.getValue() * std::numbers::pi / 180.0;
+ double angleRad = Base::toRadians(Rotation.getValue());
gp_Ax2 rotated = unrotated.Rotated(rotationAxis, -angleRad);
return rotated;
}
diff --git a/src/Mod/TechDraw/App/Geometry.cpp b/src/Mod/TechDraw/App/Geometry.cpp
index 3321e88f47..3023677532 100644
--- a/src/Mod/TechDraw/App/Geometry.cpp
+++ b/src/Mod/TechDraw/App/Geometry.cpp
@@ -710,8 +710,6 @@ Circle::Circle()
Circle::Circle(Base::Vector3d c, double r)
{
- using std::numbers::pi;
-
geomType = GeomType::CIRCLE;
radius = r;
center = c;
@@ -721,11 +719,9 @@ Circle::Circle(Base::Vector3d c, double r)
gp_Circ circle;
circle.SetAxis(axis);
circle.SetRadius(r);
- double angle1 = 0.0;
- double angle2 = 360.0;
Handle(Geom_Circle) hCircle = new Geom_Circle (circle);
- BRepBuilderAPI_MakeEdge aMakeEdge(hCircle, angle1*(pi/180), angle2*(pi/180));
+ BRepBuilderAPI_MakeEdge aMakeEdge(hCircle, 0.0, 2.0 * std::numbers::pi);
TopoDS_Edge edge = aMakeEdge.Edge();
occEdge = edge;
}
@@ -826,7 +822,7 @@ AOC::AOC(Base::Vector3d c, double r, double sAng, double eAng) : Circle()
circle.SetRadius(r);
Handle(Geom_Circle) hCircle = new Geom_Circle (circle);
- BRepBuilderAPI_MakeEdge aMakeEdge(hCircle, sAng*(std::numbers::pi/180), eAng*(std::numbers::pi/180));
+ BRepBuilderAPI_MakeEdge aMakeEdge(hCircle, Base::toRadians(sAng), Base::toRadians(eAng));
TopoDS_Edge edge = aMakeEdge.Edge();
occEdge = edge;
diff --git a/src/Mod/TechDraw/App/HatchLine.cpp b/src/Mod/TechDraw/App/HatchLine.cpp
index e37626a2d1..c5a6b33975 100644
--- a/src/Mod/TechDraw/App/HatchLine.cpp
+++ b/src/Mod/TechDraw/App/HatchLine.cpp
@@ -35,6 +35,7 @@
#include
#include
+#include
#include
#include "HatchLine.h"
@@ -396,7 +397,7 @@ double PATLineSpec::getSlope()
} else if (angle < -90.0) {
angle = (180 + angle);
}
- return tan(angle * std::numbers::pi/180.0);
+ return tan(Base::toRadians(angle));
}
bool PATLineSpec::isDashed()
@@ -413,7 +414,7 @@ double PATLineSpec::getIntervalX()
return getInterval();
} else {
double perpAngle = fabs(getAngle() - 90.0);
- return fabs(getInterval() / cos(perpAngle * std::numbers::pi/180.0));
+ return fabs(getInterval() / cos(Base::toRadians(perpAngle)));
}
}
@@ -426,7 +427,7 @@ double PATLineSpec::getIntervalY()
return 0.0;
} else {
double perpAngle = fabs(getAngle() - 90.0);
- return fabs(getInterval() * tan(perpAngle * std::numbers::pi/180.0));
+ return fabs(getInterval() * tan(Base::toRadians(perpAngle)));
}
}
diff --git a/src/Mod/TechDraw/App/ShapeUtils.cpp b/src/Mod/TechDraw/App/ShapeUtils.cpp
index 1a02b267da..c5586ab14f 100644
--- a/src/Mod/TechDraw/App/ShapeUtils.cpp
+++ b/src/Mod/TechDraw/App/ShapeUtils.cpp
@@ -65,6 +65,7 @@
#endif// #ifndef _PreComp_
#include
+#include
#include "DrawUtil.h"
#include "ShapeUtils.h"
@@ -266,19 +267,17 @@ TopoDS_Shape ShapeUtils::mirrorShape(const TopoDS_Shape& input, const gp_Pnt& in
//!rotates a shape about a viewAxis
TopoDS_Shape ShapeUtils::rotateShape(const TopoDS_Shape& input, const gp_Ax2& viewAxis,
- double rotAngle)
+ double rotAngle)
{
TopoDS_Shape transShape;
if (input.IsNull()) {
return transShape;
}
- gp_Ax1 rotAxis = viewAxis.Axis();
- double rotation = rotAngle * std::numbers::pi / 180.0;
-
try {
+ gp_Ax1 rotAxis = viewAxis.Axis();
gp_Trsf tempTransform;
- tempTransform.SetRotation(rotAxis, rotation);
+ tempTransform.SetRotation(rotAxis, Base::toRadians(rotAngle));
BRepBuilderAPI_Transform mkTrf(input, tempTransform);
transShape = mkTrf.Shape();
}
diff --git a/src/Mod/TechDraw/Gui/QGIHighlight.cpp b/src/Mod/TechDraw/Gui/QGIHighlight.cpp
index 85d58d9ffc..2195fd08ff 100644
--- a/src/Mod/TechDraw/Gui/QGIHighlight.cpp
+++ b/src/Mod/TechDraw/Gui/QGIHighlight.cpp
@@ -26,6 +26,7 @@
# include
#endif
+#include
#include
#include "QGIHighlight.h"
@@ -125,7 +126,7 @@ void QGIHighlight::makeReference()
QRectF r(m_start, m_end);
double radius = r.width() / 2.0;
QPointF center = r.center();
- double angleRad = m_referenceAngle * std::numbers::pi / 180.0;
+ double angleRad = Base::toRadians(m_referenceAngle);
double posX = center.x() + cos(angleRad) * radius + horizOffset;
double posY = center.y() - sin(angleRad) * radius - vertOffset;
m_reference->setPos(posX, posY);
diff --git a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp
index b1d4258814..042ac26537 100644
--- a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp
+++ b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp
@@ -698,7 +698,7 @@ void QGIViewBalloon::drawBalloon(bool originDrag)
double radius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
radius = radius * scale;
radius += Rez::guiX(3.0);
- offsetLR = (tan(30 * pi / 180) * radius);
+ offsetLR = tan(Base::toRadians(30.0)) * radius;
QPolygonF triangle;
double startAngle = -pi / 2;
double angle = startAngle;
@@ -826,7 +826,7 @@ void QGIViewBalloon::drawBalloon(bool originDrag)
else {
arAngle = 0;
}
- double radAngle = arAngle * pi / 180.0;
+ double radAngle = Base::toRadians(arAngle);
double sinAngle = sin(radAngle);
double cosAngle = cos(radAngle);
xAdj = Rez::guiX(arrowAdj * cosAngle);
diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp
index baa1c20c0b..97cde6babf 100644
--- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp
+++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -1838,9 +1839,9 @@ void QGIViewDimension::drawDistance(TechDraw::DrawViewDimension* dimension,
if (dimension->AngleOverride.getValue()) {
drawDistanceOverride(fromQtApp(linePoints.first()), fromQtApp(linePoints.second()),
- dimension->LineAngle.getValue() * std::numbers::pi / 180.0, labelRectangle,
+ Base::toRadians(dimension->LineAngle.getValue()), labelRectangle,
standardStyle, renderExtent, flipArrows,
- dimension->ExtensionAngle.getValue() * std::numbers::pi / 180.0);
+ Base::toRadians(dimension->ExtensionAngle.getValue()));
}
else {
drawDistanceExecutive(fromQtApp(linePoints.extensionLineFirst()), fromQtApp(linePoints.extensionLineSecond()),
diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp
index 30d395be52..221907bb95 100644
--- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp
+++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -964,7 +965,7 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
highlight->setPos(0.0, 0.0);//sb setPos(center.x, center.y)?
Base::Vector3d center = viewDetail->AnchorPoint.getValue() * viewPart->getScale();
- double rotationRad = viewPart->Rotation.getValue() * std::numbers::pi / 180.0;
+ double rotationRad = Base::toRadians(viewPart->Rotation.getValue());
center.RotateZ(rotationRad);
double radius = viewDetail->Radius.getValue() * viewPart->getScale();
diff --git a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp
index c19a4a500d..5499eddefb 100644
--- a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp
+++ b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -319,7 +320,7 @@ void TaskComplexSection::slotViewDirectionChanged(Base::Vector3d newDirection)
void TaskComplexSection::slotChangeAngle(double newAngle)
{
// Base::Console().Message("TCS::slotAngleChanged(%.3f)\n", newAngle);
- double angleRadians = newAngle * std::numbers::pi / 180.0;
+ double angleRadians = Base::toRadians(newAngle);
double unitX = cos(angleRadians);
double unitY = sin(angleRadians);
Base::Vector3d localUnit(unitX, unitY, 0.0);
diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp b/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp
index 11cea7d77a..a92d86caa9 100644
--- a/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp
+++ b/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp
@@ -113,7 +113,7 @@ void TaskCosmeticLine::setUiPrimary()
setWindowTitle(QObject::tr("Create Cosmetic Line"));
// double rotDeg = m_partFeat->Rotation.getValue();
- // double rotRad = rotDeg * std::numbers::pi / 180.0;
+ // double rotRad = Base::toRadians(rotDeg);
Base::Vector3d centroid = m_partFeat->getCurrentCentroid();
Base::Vector3d p1, p2;
if (m_is3d.front()) {
diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp
index 3169ff543e..6167723e30 100644
--- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp
+++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -281,7 +282,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 * std::numbers::pi / 180.0;
+ double angleRadians = Base::toRadians(newAngle);
double unitX = cos(angleRadians);
double unitY = sin(angleRadians);
Base::Vector3d localUnit(unitX, unitY, 0.0);
diff --git a/tests/src/Mod/Part/App/FeatureExtrusion.cpp b/tests/src/Mod/Part/App/FeatureExtrusion.cpp
index 18c017f0a3..493721ecad 100644
--- a/tests/src/Mod/Part/App/FeatureExtrusion.cpp
+++ b/tests/src/Mod/Part/App/FeatureExtrusion.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include
+#include
#include "Mod/Part/App/FeatureExtrusion.h"
#include
@@ -172,7 +173,7 @@ TEST_F(FeatureExtrusionTest, testExecuteAngled)
{
// Arrange
const double ang = 30;
- const double tangent = tan(ang / 180.0 * std::numbers::pi);
+ const double tangent = tan(Base::toRadians(ang));
// The shape is a truncated pyramid elongated by a truncated triangular prism in the middle.
// Calc the volume of full size pyramid and prism, and subtract top volumes to truncate.
@@ -209,7 +210,7 @@ TEST_F(FeatureExtrusionTest, testExecuteAngledRev)
{
// Arrange
const double ang = 30;
- const double tangent = tan(ang / 180.0 * std::numbers::pi);
+ const double tangent = tan(Base::toRadians(ang));
// The shape is a truncated pyramid elongated by a truncated triangular prism in the middle,
// plus a rectangular prism.
// Calc the volume of full size pyramid and prism, and subtract top volumes to truncate.
@@ -249,7 +250,7 @@ TEST_F(FeatureExtrusionTest, testExecuteEdge)
{
// Arrange
const double ang = 30;
- const double tangent = tan(ang / 180.0 * std::numbers::pi);
+ const double tangent = tan(Base::toRadians(ang));
BRepBuilderAPI_MakeEdge e1(gp_Pnt(0, 0, 0), gp_Pnt(ext1, ext1, ext1));
auto edge = _doc->addObject("Edge");
edge->Shape.setValue(e1);
@@ -270,7 +271,7 @@ TEST_F(FeatureExtrusionTest, testExecuteEdge)
TEST_F(FeatureExtrusionTest, testExecuteDir)
{
// Arrange
- const double sin45 = sin(45 / 180.0 * std::numbers::pi);
+ const double sin45 = sin(Base::toRadians(45.0));
_extrusion->Dir.setValue(Base::Vector3d(0, 1, 1));
_extrusion->DirMode.setValue((long)0);
// Act