Foundation Classes, gp - Add constexpr/noexcept constructors and standard direction enums (#803)

- Addition of `gp_Dir::D` and `gp_Dir2d::D` enums for standard directions (X, Y, Z, NX, NY, NZ)
- Constexpr/noexcept constructors for geometric primitives (circles, cones, cylinders, etc.)
- Enhanced axis placement classes with enum-based constructors
- Replacement of hardcoded direction values throughout the codebase
This commit is contained in:
Pasukhin Dmitry
2025-11-04 16:21:59 +00:00
committed by GitHub
parent 0763d96209
commit 2cc2bfdd27
203 changed files with 1169 additions and 793 deletions
@@ -1206,22 +1206,22 @@ Standard_Boolean BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,
TColGeom2d_SequenceOfCurve BoundLines;
if (!Precision::IsInfinite(Vmin))
{
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(0., Vmin), gp_Dir2d(1., 0.));
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(0., Vmin), gp_Dir2d(gp_Dir2d::D::X));
BoundLines.Append(aLine);
}
if (!Precision::IsInfinite(Umin))
{
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(Umin, 0.), gp_Dir2d(0., 1.));
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(Umin, 0.), gp_Dir2d(gp_Dir2d::D::Y));
BoundLines.Append(aLine);
}
if (!Precision::IsInfinite(Vmax))
{
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(0., Vmax), gp_Dir2d(1., 0.));
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(0., Vmax), gp_Dir2d(gp_Dir2d::D::X));
BoundLines.Append(aLine);
}
if (!Precision::IsInfinite(Umax))
{
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(Umax, 0.), gp_Dir2d(0., 1.));
Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(Umax, 0.), gp_Dir2d(gp_Dir2d::D::Y));
BoundLines.Append(aLine);
}
@@ -3340,10 +3340,10 @@ void BRepOffset_MakeOffset::MakeMissingWalls(const Message_ProgressRange& theRan
if (!IsPlanar)
{
TopLoc_Location Loc;
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., 0.), gp_Dir2d(1., 0.));
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., 0.), gp_Dir2d(gp_Dir2d::D::X));
BB.UpdateEdge(anEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion());
Standard_Real Coeff = (OffsetDir * CircAxisDir > 0.) ? 1. : -1.;
OELine2d = new Geom2d_Line(gp_Pnt2d(0., OffsetVal * Coeff), gp_Dir2d(1., 0.));
OELine2d = new Geom2d_Line(gp_Pnt2d(0., OffsetVal * Coeff), gp_Dir2d(gp_Dir2d::D::X));
BB.UpdateEdge(OE, OELine2d, theSurf, Loc, Precision::Confusion());
aLine2d = new Geom2d_Line(gp_Pnt2d(ParV2, 0.), gp_Dir2d(0., Coeff));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(ParV1, 0.), gp_Dir2d(0., Coeff));
@@ -3427,14 +3427,14 @@ void BRepOffset_MakeOffset::MakeMissingWalls(const Message_ProgressRange& theRan
Standard_Real Uf, Ul, Vf, Vl;
theSurf->Bounds(Uf, Ul, Vf, Vl);
TopLoc_Location Loc;
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., Vf), gp_Dir2d(1., 0.));
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., Vf), gp_Dir2d(gp_Dir2d::D::X));
BB.UpdateEdge(anEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion());
OELine2d = new Geom2d_Line(gp_Pnt2d(0., Vl), gp_Dir2d(1., 0.));
OELine2d = new Geom2d_Line(gp_Pnt2d(0., Vl), gp_Dir2d(gp_Dir2d::D::X));
BB.UpdateEdge(OE, OELine2d, theSurf, Loc, Precision::Confusion());
Standard_Real UonV1 = (ToReverse) ? Ul : Uf;
Standard_Real UonV2 = (ToReverse) ? Uf : Ul;
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(0., 1.));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(0., 1.));
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(gp_Dir2d::D::Y));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(gp_Dir2d::D::Y));
if (E3.IsSame(E4))
{
BB.UpdateEdge(E3, aLine2d, aLine2d2, theSurf, Loc, Precision::Confusion());
@@ -582,14 +582,14 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
theSurf->Bounds(Uf, Ul, Vf, Vl);
TopLoc_Location Loc;
Handle(Geom2d_Line) EdgeLine2d, OELine2d, aLine2d, aLine2d2;
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., Vf), gp_Dir2d(1., 0.));
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., Vf), gp_Dir2d(gp_Dir2d::D::X));
aBB.UpdateEdge(theOrigEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion());
OELine2d = new Geom2d_Line(gp_Pnt2d(0., Vl), gp_Dir2d(1., 0.));
OELine2d = new Geom2d_Line(gp_Pnt2d(0., Vl), gp_Dir2d(gp_Dir2d::D::X));
aBB.UpdateEdge(aNewEdge, OELine2d, theSurf, Loc, Precision::Confusion());
Standard_Real UonV1 = (ToReverse) ? Ul : Uf;
Standard_Real UonV2 = (ToReverse) ? Uf : Ul;
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(0., 1.));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(0., 1.));
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(gp_Dir2d::D::Y));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(gp_Dir2d::D::Y));
if (aWall1.IsSame(aWall2))
{
aBB.UpdateEdge(aWall1, aLine2d, aLine2d2, theSurf, Loc, Precision::Confusion());
@@ -1125,7 +1125,7 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
Handle(Geom2d_Curve) PC;
if (ExchUV)
{
PC = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(1, 0));
PC = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(gp_Dir2d::D::X));
U1 = f1;
U2 = l1;
if (!C1is3D)
@@ -1133,7 +1133,7 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
}
else
{
PC = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(0, 1));
PC = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(gp_Dir2d::D::Y));
U1 = f2;
U2 = l2;
if (!C1is3D)
@@ -1172,7 +1172,7 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
// Update de edge2. (Rem : has already a 3d curve)
if (ExchUV)
{
PC = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(1, 0));
PC = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(gp_Dir2d::D::X));
U1 = f1;
U2 = l1;
if (!C2is3D)
@@ -1180,7 +1180,7 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
}
else
{
PC = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(0, 1));
PC = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(gp_Dir2d::D::Y));
U1 = f2;
U2 = l2;
if (!C2is3D)
@@ -1275,15 +1275,15 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
{
// rem : si ExchUv, il faut reverser le Wire.
// donc l'edge Forward dans la face sera E4 : d'ou L1 et L2
L2 = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(0, 1));
L1 = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(0, 1));
L2 = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(gp_Dir2d::D::Y));
L1 = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(gp_Dir2d::D::Y));
U1 = f2;
U2 = l2;
}
else
{
L1 = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(1, 0));
L2 = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(1, 0));
L1 = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(gp_Dir2d::D::X));
L2 = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(gp_Dir2d::D::X));
U1 = f1;
U2 = l1;
}
@@ -1340,13 +1340,13 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
if (ExchUV)
{
L1 = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(0, 1));
L1 = new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(gp_Dir2d::D::Y));
U1 = f2;
U2 = l2;
}
else
{
L1 = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(1, 0));
L1 = new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(gp_Dir2d::D::X));
U1 = f1;
U2 = l1;
}
@@ -1366,13 +1366,13 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Path,
if (ExchUV)
{
L2 = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(0, 1));
L2 = new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(gp_Dir2d::D::Y));
U1 = f2;
U2 = l2;
}
else
{
L2 = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(1, 0));
L2 = new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(gp_Dir2d::D::X));
U1 = f1;
U2 = l1;
}
@@ -2618,13 +2618,13 @@ static void MakeFace(const Handle(Geom_Surface)& S,
// make the lines
Handle(Geom2d_Line) Lumin, Lumax, Lvmin, Lvmax;
if (!umininf)
Lumin = new Geom2d_Line(gp_Pnt2d(UMin, 0), gp_Dir2d(0, 1));
Lumin = new Geom2d_Line(gp_Pnt2d(UMin, 0), gp_Dir2d(gp_Dir2d::D::Y));
if (!umaxinf)
Lumax = new Geom2d_Line(gp_Pnt2d(UMax, 0), gp_Dir2d(0, 1));
Lumax = new Geom2d_Line(gp_Pnt2d(UMax, 0), gp_Dir2d(gp_Dir2d::D::Y));
if (!vmininf)
Lvmin = new Geom2d_Line(gp_Pnt2d(0, VMin), gp_Dir2d(1, 0));
Lvmin = new Geom2d_Line(gp_Pnt2d(0, VMin), gp_Dir2d(gp_Dir2d::D::X));
if (!vmaxinf)
Lvmax = new Geom2d_Line(gp_Pnt2d(0, VMax), gp_Dir2d(1, 0));
Lvmax = new Geom2d_Line(gp_Pnt2d(0, VMax), gp_Dir2d(gp_Dir2d::D::X));
Handle(Geom_Curve) Cumin, Cumax, Cvmin, Cvmax;
Standard_Real TolApex = 1.e-5;
@@ -906,8 +906,8 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
if (vClosed)
{
B.UpdateEdge(edge1,
new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(1, 0)),
new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(1, 0)),
new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(gp_Dir2d::D::X)),
new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(gp_Dir2d::D::X)),
face,
Precision::Confusion());
B.Range(edge1, face, f1, l1);
@@ -915,12 +915,12 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
else
{
B.UpdateEdge(edge1,
new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(1, 0)),
new Geom2d_Line(gp_Pnt2d(0, f2), gp_Dir2d(gp_Dir2d::D::X)),
face,
Precision::Confusion());
B.Range(edge1, face, f1, l1);
B.UpdateEdge(edge2,
new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(1, 0)),
new Geom2d_Line(gp_Pnt2d(0, l2), gp_Dir2d(gp_Dir2d::D::X)),
face,
Precision::Confusion());
B.Range(edge2, face, f1, l1);
@@ -929,8 +929,8 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
if (uClosed && nbEdges == 1)
{
B.UpdateEdge(edge3,
new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(0, 1)),
new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(0, 1)),
new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(gp_Dir2d::D::Y)),
new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(gp_Dir2d::D::Y)),
face,
Precision::Confusion());
B.Range(edge3, face, f2, l2);
@@ -938,12 +938,12 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
else
{
B.UpdateEdge(edge3,
new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(0, 1)),
new Geom2d_Line(gp_Pnt2d(f1, 0), gp_Dir2d(gp_Dir2d::D::Y)),
face,
Precision::Confusion());
B.Range(edge3, face, f2, l2);
B.UpdateEdge(edge4,
new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(0, 1)),
new Geom2d_Line(gp_Pnt2d(l1, 0), gp_Dir2d(gp_Dir2d::D::Y)),
face,
Precision::Confusion());
B.Range(edge4, face, f2, l2);