Coding - Rework of Math global functions to stl (#833)

Majority of functions now simply call same functions from std namespace.
Functions that duplicate std namespace functionality are declared
deprecated.
Calls of deprecated functions are replaced with std functions calls.
This commit is contained in:
Dmitrii Kulikov
2025-11-17 14:20:24 +00:00
committed by GitHub
parent 1a246afa2e
commit c479f6e000
1205 changed files with 12672 additions and 11286 deletions
@@ -31,9 +31,9 @@ void BRepPreviewAPI_MakeBox::Build(const Message_ProgressRange& /*theRange*/)
anLocation.Y() + myWedge.GetYMax(),
anLocation.Z() + myWedge.GetZMax());
Standard_Boolean aThinOnX = Abs(aFirstPoint.X() - aSecondPoint.X()) < Precision::Confusion();
Standard_Boolean aThinOnY = Abs(aFirstPoint.Y() - aSecondPoint.Y()) < Precision::Confusion();
Standard_Boolean aThinOnZ = Abs(aFirstPoint.Z() - aSecondPoint.Z()) < Precision::Confusion();
Standard_Boolean aThinOnX = std::abs(aFirstPoint.X() - aSecondPoint.X()) < Precision::Confusion();
Standard_Boolean aThinOnY = std::abs(aFirstPoint.Y() - aSecondPoint.Y()) < Precision::Confusion();
Standard_Boolean aThinOnZ = std::abs(aFirstPoint.Z() - aSecondPoint.Z()) < Precision::Confusion();
Standard_Integer aPreviewType = (int)aThinOnX + (int)aThinOnY + (int)aThinOnZ;
@@ -44,7 +44,7 @@ BRepPrim_Cone::BRepPrim_Cone(const Standard_Real Angle,
throw Standard_DomainError("cone with angle > PI/2");
// cut at top
VMax(Height / Cos(myHalfAngle));
VMax(Height / std::cos(myHalfAngle));
VMin(0.);
SetMeridian();
}
@@ -141,7 +141,7 @@ void BRepPrim_Cone::SetMeridian()
A.Translate(V);
Handle(Geom_Line) L = new Geom_Line(A);
Handle(Geom2d_Line) L2d =
new Geom2d_Line(gp_Pnt2d(myRadius, 0), gp_Dir2d(Sin(myHalfAngle), Cos(myHalfAngle)));
new Geom2d_Line(gp_Pnt2d(myRadius, 0), gp_Dir2d(std::sin(myHalfAngle), std::cos(myHalfAngle)));
Meridian(L, L2d);
}
@@ -153,15 +153,15 @@ void BRepPrim_Cone::SetParameters(const Standard_Real R1,
{
if (((R1 != 0) && (R1 < Precision::Confusion())) || ((R2 != 0) && (R2 < Precision::Confusion())))
throw Standard_DomainError("cone with negative or too small radius");
if (Abs(R1 - R2) < Precision::Confusion())
if (std::abs(R1 - R2) < Precision::Confusion())
throw Standard_DomainError("cone with two identic radii");
if (H < Precision::Confusion())
throw Standard_DomainError("cone with negative or null height");
myRadius = R1;
myHalfAngle = ATan((R2 - R1) / H);
myHalfAngle = std::atan((R2 - R1) / H);
// cut top and bottom
VMin(0.);
VMax(Sqrt(H * H + (R2 - R1) * (R2 - R1)));
VMax(std::sqrt(H * H + (R2 - R1) * (R2 - R1)));
}
@@ -64,7 +64,7 @@ public:
//!
//! Error : R1 and R2 < Resolution
//! R1 or R2 negative
//! Abs(R1-R2) < Resolution
//! std::abs(R1-R2) < Resolution
//! H < Resolution
//! H negative
Standard_EXPORT BRepPrim_Cone(const Standard_Real R1,
@@ -180,7 +180,7 @@ void BRepPrim_OneAxis::VMax(const Standard_Real V)
Standard_Boolean BRepPrim_OneAxis::MeridianOnAxis(const Standard_Real V) const
{
return Abs(MeridianValue(V).X()) < Precision::Confusion();
return std::abs(MeridianValue(V).X()) < Precision::Confusion();
}
//=================================================================================================
@@ -381,7 +381,7 @@ const TopoDS_Face& BRepPrim_OneAxis::TopFace()
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(gp_Dir2d::D::X)));
myBuilder.SetPCurve(myEdges[ETOPEND],
myFaces[FTOP],
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(Cos(myAngle), Sin(myAngle))));
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(std::cos(myAngle), std::sin(myAngle))));
}
myBuilder.CompleteFace(myFaces[FTOP]);
@@ -422,7 +422,7 @@ const TopoDS_Face& BRepPrim_OneAxis::BottomFace()
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(gp_Dir2d::D::X)));
myBuilder.SetPCurve(myEdges[EBOTEND],
myFaces[FBOTTOM],
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(Cos(myAngle), Sin(myAngle))));
gp_Lin2d(gp_Pnt2d(0, 0), gp_Dir2d(std::cos(myAngle), std::sin(myAngle))));
}
myBuilder.CompleteFace(myFaces[FBOTTOM]);
@@ -110,7 +110,7 @@ public:
//! Returns True if the point of parameter <V> on the
//! meridian is on the Axis. Default implementation is
//! Abs(MeridianValue(V).X()) < Precision::Confusion()
//! std::abs(MeridianValue(V).X()) < Precision::Confusion()
Standard_EXPORT virtual Standard_Boolean MeridianOnAxis(const Standard_Real V) const;
//! Returns True if the meridian is closed.
@@ -43,9 +43,9 @@ BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz)
: myWedge(gp_Ax2(pmin(gp_Pnt(0, 0, 0), dx, dy, dz), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(dx),
Abs(dy),
Abs(dz))
std::abs(dx),
std::abs(dy),
std::abs(dz))
{
}
@@ -56,9 +56,9 @@ BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Pnt& P,
const Standard_Real dy,
const Standard_Real dz)
: myWedge(gp_Ax2(pmin(P, dx, dy, dz), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(dx),
Abs(dy),
Abs(dz))
std::abs(dx),
std::abs(dy),
std::abs(dz))
{
}
@@ -66,14 +66,14 @@ BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Pnt& P,
inline gp_Pnt pmin(const gp_Pnt& p1, const gp_Pnt& p2)
{
return gp_Pnt(Min(p1.X(), p2.X()), Min(p1.Y(), p2.Y()), Min(p1.Z(), p2.Z()));
return gp_Pnt(std::min(p1.X(), p2.X()), std::min(p1.Y(), p2.Y()), std::min(p1.Z(), p2.Z()));
}
BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Pnt& P1, const gp_Pnt& P2)
: myWedge(gp_Ax2(pmin(P1, P2), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(P2.X() - P1.X()),
Abs(P2.Y() - P1.Y()),
Abs(P2.Z() - P1.Z()))
std::abs(P2.X() - P1.X()),
std::abs(P2.Y() - P1.Y()),
std::abs(P2.Z() - P1.Z()))
{
}
@@ -95,9 +95,9 @@ void BRepPrimAPI_MakeBox::Init(const Standard_Real theDX,
{
myWedge = BRepPrim_Wedge(
gp_Ax2(pmin(gp_Pnt(0, 0, 0), theDX, theDY, theDZ), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(theDX),
Abs(theDY),
Abs(theDZ));
std::abs(theDX),
std::abs(theDY),
std::abs(theDZ));
}
//=================================================================================================
@@ -109,9 +109,9 @@ void BRepPrimAPI_MakeBox::Init(const gp_Pnt& thePnt,
{
myWedge = BRepPrim_Wedge(
gp_Ax2(pmin(thePnt, theDX, theDY, theDZ), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(theDX),
Abs(theDY),
Abs(theDZ));
std::abs(theDX),
std::abs(theDY),
std::abs(theDZ));
}
//=================================================================================================
@@ -120,9 +120,9 @@ void BRepPrimAPI_MakeBox::Init(const gp_Pnt& thePnt1, const gp_Pnt& thePnt2)
{
myWedge =
BRepPrim_Wedge(gp_Ax2(pmin(thePnt1, thePnt2), gp_Dir(gp_Dir::D::Z), gp_Dir(gp_Dir::D::X)),
Abs(thePnt2.X() - thePnt1.X()),
Abs(thePnt2.Y() - thePnt1.Y()),
Abs(thePnt2.Z() - thePnt1.Z()));
std::abs(thePnt2.X() - thePnt1.X()),
std::abs(thePnt2.Y() - thePnt1.Y()),
std::abs(thePnt2.Z() - thePnt1.Z()));
}
//=================================================================================================
@@ -33,7 +33,7 @@ BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R)
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R, const Standard_Real angle)
: mySphere(gp_Ax2(gp::Origin(), (angle < 0. ? -1 : 1) * gp::DZ(), gp::DX()), R)
{
mySphere.Angle(Abs(angle));
mySphere.Angle(std::abs(angle));
}
//=================================================================================================
@@ -96,7 +96,7 @@ TopoDS_Shape BRepSweep_Revol::LastShape(const TopoDS_Shape& aGenS)
Sweep_NumShape BRepSweep_Revol::NumShape(const Standard_Real D) const
{
Sweep_NumShape N;
if (Abs(Angle(D) - 2 * M_PI) <= Precision::Angular())
if (std::abs(Angle(D) - 2 * M_PI) <= Precision::Angular())
{
N.Init(2, TopAbs_EDGE, Standard_True, Standard_False, Standard_False);
}
@@ -131,7 +131,7 @@ gp_Ax1 BRepSweep_Revol::Axe(const gp_Ax1& Ax, const Standard_Real D) const
Standard_Real BRepSweep_Revol::Angle(const Standard_Real D) const
{
Standard_Real d = Abs(D);
Standard_Real d = std::abs(D);
while (d > (2 * M_PI + Precision::Angular()))
{
d = d - 2 * M_PI;
@@ -714,7 +714,7 @@ Standard_Boolean BRepSweep_Rotation::GDDShapeIsToAdd(const TopoDS_Shape& aNewS
&& aGenS.ShapeType() == TopAbs_FACE && aDirS.Type() == TopAbs_EDGE
&& aSubDirS.Type() == TopAbs_VERTEX)
{
return (Abs(myAng - 2 * M_PI) > Precision::Angular());
return (std::abs(myAng - 2 * M_PI) > Precision::Angular());
}
else if (aNewShape.ShapeType() == TopAbs_FACE && aNewSubShape.ShapeType() == TopAbs_EDGE
&& aGenS.ShapeType() == TopAbs_EDGE && aDirS.Type() == TopAbs_EDGE
@@ -724,7 +724,7 @@ Standard_Boolean BRepSweep_Rotation::GDDShapeIsToAdd(const TopoDS_Shape& aNewS
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewShape), Loc));
if (AS.GetType() == GeomAbs_Plane)
{
return (Abs(myAng - 2 * M_PI) > Precision::Angular());
return (std::abs(myAng - 2 * M_PI) > Precision::Angular());
}
else
{
@@ -753,7 +753,7 @@ Standard_Boolean BRepSweep_Rotation::SeparatedWires(const TopoDS_Shape& aNewSh
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewShape), Loc));
if (AS.GetType() == GeomAbs_Plane)
{
return (Abs(myAng - 2 * M_PI) <= Precision::Angular());
return (std::abs(myAng - 2 * M_PI) <= Precision::Angular());
}
else
{
@@ -831,8 +831,8 @@ Standard_Boolean BRepSweep_Rotation::IsInvariant(const TopoDS_Shape& aGenS) cons
if (aC.GetType() == GeomAbs_Line)
return Standard_True;
Standard_Real aTol = Max(BRep_Tool::Tolerance(V1), BRep_Tool::Tolerance(V2));
gp_Lin Lin(myAxe.Location(), myAxe.Direction());
Standard_Real aTol = std::max(BRep_Tool::Tolerance(V1), BRep_Tool::Tolerance(V2));
gp_Lin Lin(myAxe.Location(), myAxe.Direction());
const TColgp_Array1OfPnt& aPoles =
(aC.GetType() == GeomAbs_BSplineCurve ? aC.BSpline()->Poles() : aC.Bezier()->Poles());
@@ -107,8 +107,9 @@ void BRepSweep_Trsf::SetContinuity(const TopoDS_Shape& aGenS, const Sweep_NumSha
TopExp::Vertices(E, d, f);
if (d.IsSame(f))
{
// tol3d = Max(tl,BRep_Tool::Tolerance(d));
const Standard_Real tol3d = Max(tl, 2. * BRep_Tool::Tolerance(d)); // IFV 24.05.00 buc60684
// tol3d = std::max(tl,BRep_Tool::Tolerance(d));
const Standard_Real tol3d =
std::max(tl, 2. * BRep_Tool::Tolerance(d)); // IFV 24.05.00 buc60684
e.Initialize(E);
ud = BRep_Tool::Parameter(d, TopoDS::Edge(aGenS));
uf = BRep_Tool::Parameter(f, TopoDS::Edge(aGenS));
@@ -169,9 +170,9 @@ void BRepSweep_Trsf::SetContinuity(const TopoDS_Shape& aGenS, const Sweep_NumSha
{
u1 = BRep_Tool::Parameter(V, E1);
u2 = BRep_Tool::Parameter(V, E2);
// tol3d = Max(tl,BRep_Tool::Tolerance(V));
// tol3d = std::max(tl,BRep_Tool::Tolerance(V));
const Standard_Real tol3d =
Max(tl, 2. * BRep_Tool::Tolerance(V)); // IFV 24.05.00 buc60684
std::max(tl, 2. * BRep_Tool::Tolerance(V)); // IFV 24.05.00 buc60684
e1.Initialize(E1);
e2.Initialize(E2);
cont = BRepLProp::Continuity(e1, e2, u1, u2, tol3d, ta);