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

@@ -100,7 +100,6 @@
#include <gp_Pnt.hxx>
#endif
#define _USE_MATH_DEFINES
#include <cmath>
#include <sstream>
@@ -387,7 +386,7 @@ void DrawComplexSection::makeAlignedPieces(const TopoDS_Shape& rawShape)
}
//we only want to reverse the segment normal if it is not perpendicular to section normal
if (segmentNormal.Dot(gProjectionUnit) != 0.0
&& segmentNormal.Angle(gProjectionUnit) <= M_PI_2) {
&& segmentNormal.Angle(gProjectionUnit) <= std::numbers::pi/2) {
segmentNormal.Reverse();
}
@@ -957,7 +956,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 * M_PI / 180.0; // 5 degrees
double angleThresholdRad = angleThresholdDeg * std::numbers::pi / 180.0; // 5 degrees
TopExp_Explorer explEdges(profile, TopAbs_EDGE);
for (; explEdges.More(); explEdges.Next()) {
std::pair<Base::Vector3d, Base::Vector3d> segmentEnds = getSegmentEnds(TopoDS::Edge(explEdges.Current()));