]> OCCT Git - occt.git/commitdiff
Foundation Classes, gp - Mark core types and methods constexpr/noexcept (#790)
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sun, 2 Nov 2025 00:52:32 +0000 (00:52 +0000)
committerGitHub <noreply@github.com>
Sun, 2 Nov 2025 00:52:32 +0000 (00:52 +0000)
Make gp basic types and operations more constexpr-friendly and noexcept:
- Mark gp::Resolution as constexpr.
- Add constexpr and/or noexcept to many constructors and small access/modifier methods.
- Convert several functions to constexpr where safe to allow compile-time evaluation.
- Initialize members via initializer lists for several GTrsf/GTrsf2d/Mat/etc constructors.
- Add noexcept to transformation/serialization helpers and small utilities where appropriate.

This enables better compile-time optimizations and safer noexcept semantics across TKMath gp primitives.

39 files changed:
src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx
src/Draw/TKQADraw/QABugs/QABugs_11.cxx
src/Draw/TKQADraw/QABugs/QABugs_3.cxx
src/Draw/TKQADraw/QABugs/QABugs_9.cxx
src/FoundationClasses/TKMath/gp/gp.hxx
src/FoundationClasses/TKMath/gp/gp_Ax1.hxx
src/FoundationClasses/TKMath/gp/gp_Ax2.hxx
src/FoundationClasses/TKMath/gp/gp_Ax22d.hxx
src/FoundationClasses/TKMath/gp/gp_Ax2d.hxx
src/FoundationClasses/TKMath/gp/gp_Ax3.hxx
src/FoundationClasses/TKMath/gp/gp_Dir.hxx
src/FoundationClasses/TKMath/gp/gp_Dir2d.hxx
src/FoundationClasses/TKMath/gp/gp_GTrsf.hxx
src/FoundationClasses/TKMath/gp/gp_GTrsf2d.hxx
src/FoundationClasses/TKMath/gp/gp_Mat.hxx
src/FoundationClasses/TKMath/gp/gp_Mat2d.hxx
src/FoundationClasses/TKMath/gp/gp_Pnt.hxx
src/FoundationClasses/TKMath/gp/gp_Pnt2d.hxx
src/FoundationClasses/TKMath/gp/gp_Quaternion.hxx
src/FoundationClasses/TKMath/gp/gp_Trsf.hxx
src/FoundationClasses/TKMath/gp/gp_Trsf2d.hxx
src/FoundationClasses/TKMath/gp/gp_Vec.hxx
src/FoundationClasses/TKMath/gp/gp_Vec2d.hxx
src/FoundationClasses/TKMath/gp/gp_XY.hxx
src/FoundationClasses/TKMath/gp/gp_XYZ.hxx
src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/ModelingAlgorithms/TKBO/BOPTools/BOPTools_AlgoTools.cxx
src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_CompatibleWires.cxx
src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_SplitShape.cxx
src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx
src/ModelingAlgorithms/TKGeomAlgo/GeomFill/GeomFill_SectionPlacement.cxx
src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Offset.cxx
src/ModelingAlgorithms/TKOffset/Draft/Draft_Modification.cxx
src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistanceSS.cxx
src/Visualization/TKMeshVS/MeshVS/MeshVS_NodalColorPrsBuilder.cxx
src/Visualization/TKV3d/DsgPrs/DsgPrs_MidPointPresentation.cxx
src/Visualization/TKV3d/DsgPrs/DsgPrs_SymmetricPresentation.cxx
src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx

index c2d921ab0f1044dda19748db575dc703b1783249..30aaa22b44e79a9cb9d2188000d246ee68502a66 100644 (file)
@@ -52,7 +52,6 @@ Standard_Boolean BinMDataXtd_TriangulationDriver::Paste(const BinObjMgt_Persiste
   Standard_Integer n1, n2, n3;
   Standard_Integer nbNodes(0), nbTriangles(0);
   Standard_Boolean hasUV(Standard_False);
-  gp_Pnt           p;
 
   theSource >> nbNodes;
   theSource >> nbTriangles;
index d43db032d4c1ef3092e0353eac29b9b521a9d48f..28a14f40b8cb58e69c6b2b4faa31233129cd1551 100644 (file)
@@ -4935,8 +4935,6 @@ Standard_Integer OCC22736(Draw_Interpretor& di, Standard_Integer argc, const cha
   Standard_Real X_p2                = Draw::Atof(argv[7]);
   Standard_Real Y_p2                = Draw::Atof(argv[8]);
 
-  gp_Trsf2d identityTransformation;
-
   gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint, Y_mirrorFirstPoint);
   gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint, Y_mirrorSecondPoint);
   gp_Ax2d  mirrorAxis(mirrorFirstPoint, gp_Vec2d(mirrorFirstPoint, mirrorSecondPoint));
index 3be2e0f85e2886d81ca6448a143bc6c9e7978b77..7a394f16ad7e38fd155dc0fd95a72e5b0ded99be 100644 (file)
@@ -506,7 +506,7 @@ static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/
 
   gp_Ax2                                 Cone_Ax;
   double                                 R1 = 8, R2 = 16;
-  gp_Pnt                                 P0(0, 0, 0), P1(0, 0, 20), P2(0, 0, 45);
+  gp_Pnt                                 P1(0, 0, 20), P2(0, 0, 45);
   Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone(P1, P2, R1, R2).Value();
   TopoDS_Shape      myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
   Handle(AIS_Shape) ais1    = new AIS_Shape(myshape);
index 89beffb793cc2d7e91e5f804e448a339f4c5de64..6537e1c342953bb75cb18bd960defc736f2cd2d9 100644 (file)
@@ -33,7 +33,7 @@ static Standard_Integer BUC60857(Draw_Interpretor& di, Standard_Integer /*argc*/
 {
   gp_Ax2 Cone_Ax;
   double R1 = 8, R2 = 16;
-  gp_Pnt P0(0, 0, 0), P1(0, 0, 20), P2(0, 0, 45);
+  gp_Pnt P1(0, 0, 20), P2(0, 0, 45);
 
   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
   if (aContext.IsNull())
index 109c35271af843fdcd52af853e8d6dc334551d80..025fdb082b9b6d4da9db58971f9bd8a896727d09 100644 (file)
@@ -52,7 +52,7 @@ public:
   //! example, to avoid division by zero in geometric
   //! computations. In the documentation, tolerance criterion is
   //! always referred to as gp::Resolution().
-  static Standard_Real Resolution() { return RealSmall(); }
+  static constexpr Standard_Real Resolution() { return RealSmall(); }
 
   //! Identifies a Cartesian point with coordinates X = Y = Z = 0.0.0
   Standard_EXPORT static const gp_Pnt& Origin();
index f00c7a89d074be71a0d9d0ff6518ad3ac4008018..347ad4511a6e2d1fbec7d23b2546d4043f5fa27a 100644 (file)
@@ -48,23 +48,23 @@ public:
   }
 
   //! P is the location point and V is the direction of <me>.
-  gp_Ax1(const gp_Pnt& theP, const gp_Dir& theV)
+  constexpr gp_Ax1(const gp_Pnt& theP, const gp_Dir& theV) noexcept
       : loc(theP),
         vdir(theV)
   {
   }
 
   //! Assigns V as the "Direction"  of this axis.
-  void SetDirection(const gp_Dir& theV) { vdir = theV; }
+  constexpr void SetDirection(const gp_Dir& theV) noexcept { vdir = theV; }
 
   //! Assigns  P as the origin of this axis.
-  void SetLocation(const gp_Pnt& theP) { loc = theP; }
+  constexpr void SetLocation(const gp_Pnt& theP) noexcept { loc = theP; }
 
   //! Returns the direction of <me>.
-  const gp_Dir& Direction() const { return vdir; }
+  constexpr const gp_Dir& Direction() const noexcept { return vdir; }
 
   //! Returns the location point of <me>.
-  const gp_Pnt& Location() const { return loc; }
+  constexpr const gp_Pnt& Location() const noexcept { return loc; }
 
   //! Returns True if  :
   //! . the angle between <me> and <Other> is lower or equal
@@ -106,7 +106,7 @@ public:
   Standard_Real Angle(const gp_Ax1& theOther) const { return vdir.Angle(theOther.vdir); }
 
   //! Reverses the unit vector of this axis and assigns the result to this axis.
-  void Reverse() { vdir.Reverse(); }
+  constexpr void Reverse() noexcept { vdir.Reverse(); }
 
   //! Reverses the unit vector of this axis and creates a new one.
   Standard_NODISCARD gp_Ax1 Reversed() const
@@ -167,7 +167,7 @@ public:
   //! Applies a scaling transformation to this axis with:
   //! - scale factor theS, and
   //! - center theP and assigns the result to this axis.
-  void Scale(const gp_Pnt& theP, const Standard_Real theS)
+  constexpr void Scale(const gp_Pnt& theP, const Standard_Real theS) noexcept
   {
     loc.Scale(theP, theS);
     if (theS < 0.0)
@@ -205,7 +205,7 @@ public:
   }
 
   //! Translates this axis by the vector theV, and assigns the result to this axis.
-  void Translate(const gp_Vec& theV) { loc.Translate(theV); }
+  constexpr void Translate(const gp_Vec& theV) noexcept { loc.Translate(theV); }
 
   //! Translates this axis by the vector theV,
   //! and creates a new one.
@@ -219,7 +219,10 @@ public:
   //! Translates this axis by:
   //! the vector (theP1, theP2) defined from point theP1 to point theP2.
   //! and assigns the result to this axis.
-  void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) { loc.Translate(theP1, theP2); }
+  constexpr void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) noexcept
+  {
+    loc.Translate(theP1, theP2);
+  }
 
   //! Translates this axis by:
   //! the vector (theP1, theP2) defined from point theP1 to point theP2.
index 3771f0e1bfe27a9ab0664337b3a3b9a698d895c1..389a67461f1498bf48b6bba6fd97c8d32a76c27b 100644 (file)
@@ -103,7 +103,7 @@ public:
   void SetDirection(const gp_Dir& V);
 
   //! Changes the "Location" point (origin) of <me>.
-  void SetLocation(const gp_Pnt& theP) { axis.SetLocation(theP); }
+  constexpr void SetLocation(const gp_Pnt& theP) noexcept { axis.SetLocation(theP); }
 
   //! Changes the "Xdirection" of <me>. The main direction
   //! "Direction" is not modified, the "Ydirection" is modified.
@@ -139,19 +139,19 @@ public:
 
   //! Returns the main axis of <me>. It is the "Location" point
   //! and the main "Direction".
-  const gp_Ax1& Axis() const { return axis; }
+  constexpr const gp_Ax1& Axis() const noexcept { return axis; }
 
   //! Returns the main direction of <me>.
-  const gp_Dir& Direction() const { return axis.Direction(); }
+  constexpr const gp_Dir& Direction() const noexcept { return axis.Direction(); }
 
   //! Returns the "Location" point (origin) of <me>.
-  const gp_Pnt& Location() const { return axis.Location(); }
+  constexpr const gp_Pnt& Location() const noexcept { return axis.Location(); }
 
   //! Returns the "XDirection" of <me>.
-  const gp_Dir& XDirection() const { return vxdir; }
+  constexpr const gp_Dir& XDirection() const noexcept { return vxdir; }
 
   //! Returns the "YDirection" of <me>.
-  const gp_Dir& YDirection() const { return vydir; }
+  constexpr const gp_Dir& YDirection() const noexcept { return vydir; }
 
   Standard_Boolean IsCoplanar(const gp_Ax2&       Other,
                               const Standard_Real LinearTolerance,
@@ -336,7 +336,7 @@ public:
     return aTemp;
   }
 
-  void Translate(const gp_Vec& theV) { axis.Translate(theV); }
+  constexpr void Translate(const gp_Vec& theV) noexcept { axis.Translate(theV); }
 
   //! Translates an axis plaxement in the direction of the vector <theV>.
   //! The magnitude of the translation is the vector's magnitude.
@@ -347,7 +347,10 @@ public:
     return aTemp;
   }
 
-  void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) { axis.Translate(theP1, theP2); }
+  constexpr void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) noexcept
+  {
+    axis.Translate(theP1, theP2);
+  }
 
   //! Translates an axis placement from the point <theP1> to the point <theP2>.
   Standard_NODISCARD gp_Ax2 Translated(const gp_Pnt& theP1, const gp_Pnt& theP2) const
index 009f30fa86bb10ca7cac53534e7aba0c3020143e..aa852db6e41f694b26540eb5a0ab45951ce98bdb 100644 (file)
@@ -113,7 +113,7 @@ public:
 
   //! Assigns the origin and the two unit vectors of the
   //! coordinate system theA1 to this coordinate system.
-  void SetAxis(const gp_Ax22d& theA1)
+  constexpr void SetAxis(const gp_Ax22d& theA1) noexcept
   {
     point = theA1.Location();
     vxdir = theA1.XDirection();
@@ -130,7 +130,7 @@ public:
   void SetYAxis(const gp_Ax2d& theA1);
 
   //! Changes the "Location" point (origin) of <me>.
-  void SetLocation(const gp_Pnt2d& theP) { point = theP; }
+  constexpr void SetLocation(const gp_Pnt2d& theP) noexcept { point = theP; }
 
   //! Assigns theVx to the "X Direction"  of
   //! this coordinate system. The other unit vector of this
@@ -159,13 +159,13 @@ public:
   gp_Ax2d YAxis() const { return gp_Ax2d(point, vydir); }
 
   //! Returns the "Location" point (origin) of <me>.
-  const gp_Pnt2d& Location() const { return point; }
+  constexpr const gp_Pnt2d& Location() const noexcept { return point; }
 
   //! Returns the "XDirection" of <me>.
-  const gp_Dir2d& XDirection() const { return vxdir; }
+  constexpr const gp_Dir2d& XDirection() const noexcept { return vxdir; }
 
   //! Returns the "YDirection" of <me>.
-  const gp_Dir2d& YDirection() const { return vydir; }
+  constexpr const gp_Dir2d& YDirection() const noexcept { return vydir; }
 
   Standard_EXPORT void Mirror(const gp_Pnt2d& theP);
 
@@ -231,7 +231,7 @@ public:
     return aTemp;
   }
 
-  void Translate(const gp_Vec2d& theV) { point.Translate(theV); }
+  constexpr void Translate(const gp_Vec2d& theV) noexcept { point.Translate(theV); }
 
   //! Translates an axis plaxement in the direction of the vector
   //! <theV>. The magnitude of the translation is the vector's magnitude.
@@ -242,7 +242,10 @@ public:
     return aTemp;
   }
 
-  void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) { point.Translate(theP1, theP2); }
+  constexpr void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) noexcept
+  {
+    point.Translate(theP1, theP2);
+  }
 
   //! Translates an axis placement from the point <theP1> to the
   //! point <theP2>.
index 13630acdf4bffd773eabecba4c86444789400d65..ec8f2f106cd38e79953a4255f5bc0a10e99cf5a2 100644 (file)
@@ -45,7 +45,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates an axis object representing X axis of the reference co-ordinate system.
-  gp_Ax2d()
+  constexpr gp_Ax2d() noexcept
       : loc(0., 0.)
   // vdir(1.,0.) use default ctor of gp_Dir2d, as it creates the same dir (1,0)
   {
@@ -54,23 +54,23 @@ public:
   //! Creates an Ax2d.
   //! <theP> is the "Location" point of the axis placement
   //! and theV is the "Direction" of the axis placement.
-  gp_Ax2d(const gp_Pnt2d& theP, const gp_Dir2d& theV)
+  constexpr gp_Ax2d(const gp_Pnt2d& theP, const gp_Dir2d& theV) noexcept
       : loc(theP),
         vdir(theV)
   {
   }
 
   //! Changes the "Location" point (origin) of <me>.
-  void SetLocation(const gp_Pnt2d& theP) { loc = theP; }
+  constexpr void SetLocation(const gp_Pnt2d& theP) noexcept { loc = theP; }
 
   //! Changes the direction of <me>.
-  void SetDirection(const gp_Dir2d& theV) { vdir = theV; }
+  constexpr void SetDirection(const gp_Dir2d& theV) noexcept { vdir = theV; }
 
   //! Returns the origin of <me>.
-  const gp_Pnt2d& Location() const { return loc; }
+  constexpr const gp_Pnt2d& Location() const noexcept { return loc; }
 
   //! Returns the direction of <me>.
-  const gp_Dir2d& Direction() const { return vdir; }
+  constexpr const gp_Dir2d& Direction() const noexcept { return vdir; }
 
   //! Returns True if  :
   //! . the angle between <me> and <Other> is lower or equal
@@ -115,10 +115,10 @@ public:
   Standard_Real Angle(const gp_Ax2d& theOther) const { return vdir.Angle(theOther.vdir); }
 
   //! Reverses the direction of <me> and assigns the result to this axis.
-  void Reverse() { vdir.Reverse(); }
+  constexpr void Reverse() noexcept { vdir.Reverse(); }
 
   //! Computes a new axis placement with a direction opposite to the direction of <me>.
-  Standard_NODISCARD gp_Ax2d Reversed() const
+  Standard_NODISCARD constexpr gp_Ax2d Reversed() const noexcept
   {
     gp_Ax2d aTemp = *this;
     aTemp.Reverse();
@@ -180,18 +180,21 @@ public:
     return anA;
   }
 
-  void Translate(const gp_Vec2d& theV) { loc.Translate(theV); }
+  constexpr void Translate(const gp_Vec2d& theV) noexcept { loc.Translate(theV); }
 
   //! Translates an axis placement in the direction of the vector theV.
   //! The magnitude of the translation is the vector's magnitude.
-  Standard_NODISCARD gp_Ax2d Translated(const gp_Vec2d& theV) const
+  Standard_NODISCARD constexpr gp_Ax2d Translated(const gp_Vec2d& theV) const noexcept
   {
     gp_Ax2d anA = *this;
     (anA.loc).Translate(theV);
     return anA;
   }
 
-  void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) { loc.Translate(theP1, theP2); }
+  constexpr void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) noexcept
+  {
+    loc.Translate(theP1, theP2);
+  }
 
   //! Translates an axis placement from the point theP1 to the point theP2.
   Standard_NODISCARD gp_Ax2d Translated(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) const
index cb8e7105b1ed011ac48e27c072bd326d66d406b7..4e0e71615a96519b042f2e1ce06fd8eb1b4cdf54 100644 (file)
@@ -94,13 +94,13 @@ public:
   Standard_EXPORT gp_Ax3(const gp_Pnt& theP, const gp_Dir& theV);
 
   //! Reverses the X direction of <me>.
-  void XReverse() { vxdir.Reverse(); }
+  constexpr void XReverse() noexcept { vxdir.Reverse(); }
 
   //! Reverses the Y direction of <me>.
-  void YReverse() { vydir.Reverse(); }
+  constexpr void YReverse() noexcept { vydir.Reverse(); }
 
   //! Reverses the Z direction of <me>.
-  void ZReverse() { axis.Reverse(); }
+  constexpr void ZReverse() noexcept { axis.Reverse(); }
 
   //! Assigns the origin and "main Direction" of the axis theA1 to
   //! this coordinate system, then recomputes its "X Direction" and "Y Direction".
@@ -128,7 +128,7 @@ public:
   void SetDirection(const gp_Dir& theV);
 
   //! Changes the "Location" point (origin) of <me>.
-  void SetLocation(const gp_Pnt& theP) { axis.SetLocation(theP); }
+  constexpr void SetLocation(const gp_Pnt& theP) noexcept { axis.SetLocation(theP); }
 
   //! Changes the "Xdirection" of <me>. The main direction
   //! "Direction" is not modified, the "Ydirection" is modified.
@@ -153,7 +153,7 @@ public:
 
   //! Returns the main axis of <me>. It is the "Location" point
   //! and the main "Direction".
-  const gp_Ax1& Axis() const { return axis; }
+  constexpr const gp_Ax1& Axis() const noexcept { return axis; }
 
   //! Computes a right-handed coordinate system with the
   //! same "X Direction" and "Y Direction" as those of this
@@ -164,16 +164,16 @@ public:
   gp_Ax2 Ax2() const;
 
   //! Returns the main direction of <me>.
-  const gp_Dir& Direction() const { return axis.Direction(); }
+  constexpr const gp_Dir& Direction() const noexcept { return axis.Direction(); }
 
   //! Returns the "Location" point (origin) of <me>.
-  const gp_Pnt& Location() const { return axis.Location(); }
+  constexpr const gp_Pnt& Location() const noexcept { return axis.Location(); }
 
   //! Returns the "XDirection" of <me>.
-  const gp_Dir& XDirection() const { return vxdir; }
+  constexpr const gp_Dir& XDirection() const noexcept { return vxdir; }
 
   //! Returns the "YDirection" of <me>.
-  const gp_Dir& YDirection() const { return vydir; }
+  constexpr const gp_Dir& YDirection() const noexcept { return vydir; }
 
   //! Returns  True if  the  coordinate  system is right-handed. i.e.
   //! XDirection().Crossed(YDirection()).Dot(Direction()) > 0
@@ -294,7 +294,7 @@ public:
     return aTemp;
   }
 
-  void Translate(const gp_Vec& theV) { axis.Translate(theV); }
+  constexpr void Translate(const gp_Vec& theV) noexcept { axis.Translate(theV); }
 
   //! Translates an axis plaxement in the direction of the vector
   //! <theV>. The magnitude of the translation is the vector's magnitude.
index be0c8ad551cded609b308f9db8e46078340cb5bc..3807a12526e4149a18222427a7b78a4f1142ec94 100644 (file)
@@ -38,7 +38,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates a direction corresponding to X axis.
-  gp_Dir()
+  constexpr gp_Dir() noexcept
       : coord(1., 0., 0.)
   {
   }
@@ -103,22 +103,24 @@ public:
   Standard_Real Coord(const Standard_Integer theIndex) const { return coord.Coord(theIndex); }
 
   //! Returns for the  unit vector  its three coordinates theXv, theYv, and theZv.
-  void Coord(Standard_Real& theXv, Standard_Real& theYv, Standard_Real& theZv) const
+  constexpr void Coord(Standard_Real& theXv,
+                       Standard_Real& theYv,
+                       Standard_Real& theZv) const noexcept
   {
     coord.Coord(theXv, theYv, theZv);
   }
 
   //! Returns the X coordinate for a  unit vector.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! Returns the Y coordinate for a  unit vector.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! Returns the Z coordinate for a  unit vector.
-  Standard_Real Z() const { return coord.Z(); }
+  constexpr Standard_Real Z() const noexcept { return coord.Z(); }
 
   //! for this unit vector, returns  its three coordinates as a number triplea.
-  const gp_XYZ& XYZ() const { return coord; }
+  constexpr const gp_XYZ& XYZ() const noexcept { return coord; }
 
   //! Returns True if the angle between the two directions is
   //! lower or equal to theAngularTolerance.
@@ -200,35 +202,38 @@ public:
   Standard_NODISCARD gp_Dir CrossCrossed(const gp_Dir& theV1, const gp_Dir& theV2) const;
 
   //! Computes the scalar product
-  Standard_Real Dot(const gp_Dir& theOther) const { return coord.Dot(theOther.coord); }
+  constexpr Standard_Real Dot(const gp_Dir& theOther) const noexcept
+  {
+    return coord.Dot(theOther.coord);
+  }
 
-  Standard_Real operator*(const gp_Dir& theOther) const { return Dot(theOther); }
+  constexpr Standard_Real operator*(const gp_Dir& theOther) const noexcept { return Dot(theOther); }
 
   //! Computes the triple scalar product <me> * (theV1 ^ theV2).
   //! Warnings :
   //! The computed vector theV1' = theV1 ^ theV2 is not normalized
   //! to create a unitary vector. So this method never
   //! raises an exception even if theV1 and theV2 are parallel.
-  Standard_Real DotCross(const gp_Dir& theV1, const gp_Dir& theV2) const
+  constexpr Standard_Real DotCross(const gp_Dir& theV1, const gp_Dir& theV2) const noexcept
   {
     return coord.Dot(theV1.coord.Crossed(theV2.coord));
   }
 
-  void Reverse() { coord.Reverse(); }
+  constexpr void Reverse() noexcept { coord.Reverse(); }
 
   //! Reverses the orientation of a direction
   //! geometric transformations
   //! Performs the symmetrical transformation of a direction
   //! with respect to the direction V which is the center of
   //! the  symmetry.]
-  Standard_NODISCARD gp_Dir Reversed() const
+  Standard_NODISCARD constexpr gp_Dir Reversed() const noexcept
   {
     gp_Dir aV = *this;
     aV.coord.Reverse();
     return aV;
   }
 
-  Standard_NODISCARD gp_Dir operator-() const { return Reversed(); }
+  Standard_NODISCARD constexpr gp_Dir operator-() const noexcept { return Reversed(); }
 
   Standard_EXPORT void Mirror(const gp_Dir& theV);
 
index 6ce6cbf530fa80c6f131c07376cf1ff6607438b8..a35b82d22bd74c29609e28195f0a93d584432a3e 100644 (file)
@@ -38,7 +38,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates a direction corresponding to X axis.
-  gp_Dir2d()
+  constexpr gp_Dir2d() noexcept
       : coord(1., 0.)
   {
   }
@@ -140,18 +140,21 @@ public:
 
   //! For this unit vector returns its two coordinates theXv and theYv.
   //! Raises OutOfRange if theIndex != {1, 2}.
-  void Coord(Standard_Real& theXv, Standard_Real& theYv) const { coord.Coord(theXv, theYv); }
+  constexpr void Coord(Standard_Real& theXv, Standard_Real& theYv) const noexcept
+  {
+    coord.Coord(theXv, theYv);
+  }
 
   //! For this unit vector, returns its X coordinate.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! For this unit vector, returns its Y coordinate.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! For this unit vector, returns its two coordinates as a number pair.
   //! Comparison between Directions
   //! The precision value is an input data.
-  const gp_XY& XY() const { return coord; }
+  constexpr const gp_XY& XY() const noexcept { return coord; }
 
   //! Returns True if the two vectors have the same direction
   //! i.e. the angle between this unit vector and the
@@ -182,32 +185,38 @@ public:
   Standard_EXPORT Standard_Real Angle(const gp_Dir2d& theOther) const;
 
   //! Computes the cross product between two directions.
-  Standard_NODISCARD Standard_Real Crossed(const gp_Dir2d& theRight) const
+  Standard_NODISCARD constexpr Standard_Real Crossed(const gp_Dir2d& theRight) const noexcept
   {
     return coord.Crossed(theRight.coord);
   }
 
-  Standard_NODISCARD Standard_Real operator^(const gp_Dir2d& theRight) const
+  Standard_NODISCARD constexpr Standard_Real operator^(const gp_Dir2d& theRight) const noexcept
   {
     return Crossed(theRight);
   }
 
   //! Computes the scalar product
-  Standard_Real Dot(const gp_Dir2d& theOther) const { return coord.Dot(theOther.coord); }
+  constexpr Standard_Real Dot(const gp_Dir2d& theOther) const noexcept
+  {
+    return coord.Dot(theOther.coord);
+  }
 
-  Standard_Real operator*(const gp_Dir2d& theOther) const { return Dot(theOther); }
+  constexpr Standard_Real operator*(const gp_Dir2d& theOther) const noexcept
+  {
+    return Dot(theOther);
+  }
 
-  void Reverse() { coord.Reverse(); }
+  constexpr void Reverse() noexcept { coord.Reverse(); }
 
   //! Reverses the orientation of a direction
-  Standard_NODISCARD gp_Dir2d Reversed() const
+  Standard_NODISCARD constexpr gp_Dir2d Reversed() const noexcept
   {
     gp_Dir2d aV = *this;
     aV.coord.Reverse();
     return aV;
   }
 
-  Standard_NODISCARD gp_Dir2d operator-() const { return Reversed(); }
+  Standard_NODISCARD constexpr gp_Dir2d operator-() const noexcept { return Reversed(); }
 
   Standard_EXPORT void Mirror(const gp_Dir2d& theV);
 
index efeafa71ad26165138bc6d3849f921c4b244926c..4a2cc945c3d0f1da70c0448de057116744171941 100644 (file)
@@ -60,12 +60,13 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Returns the Identity transformation.
-  gp_GTrsf()
+  constexpr gp_GTrsf() noexcept
+      : matrix(),
+        loc(0.0, 0.0, 0.0),
+        shape(gp_Identity),
+        scale(1.0)
   {
-    shape = gp_Identity;
     matrix.SetScale(1.0);
-    loc.SetCoord(0.0, 0.0, 0.0);
-    scale = 1.0;
   }
 
   //! Converts the gp_Trsf transformation theT into a
@@ -82,12 +83,12 @@ public:
   //! Creates a transformation based on the matrix theM and the
   //! vector theV where theM defines the vectorial part of
   //! the transformation, and V the translation part, or
-  gp_GTrsf(const gp_Mat& theM, const gp_XYZ& theV)
+  constexpr gp_GTrsf(const gp_Mat& theM, const gp_XYZ& theV) noexcept
       : matrix(theM),
-        loc(theV)
+        loc(theV),
+        shape(gp_Other),
+        scale(0.0)
   {
-    shape = gp_Other;
-    scale = 0.0;
   }
 
   //! Changes this transformation into an affinity of ratio theRatio
@@ -117,7 +118,7 @@ public:
                 const Standard_Real    theValue);
 
   //! Replaces the vectorial part of this transformation by theMatrix.
-  void SetVectorialPart(const gp_Mat& theMatrix)
+  constexpr void SetVectorialPart(const gp_Mat& theMatrix) noexcept
   {
     matrix = theMatrix;
     shape  = gp_Other;
@@ -156,7 +157,7 @@ public:
   //! transformation (relative to a point, an axis or a plane), a
   //! scaling transformation, a compound transformation or
   //! some other type of transformation.
-  gp_TrsfForm Form() const { return shape; }
+  constexpr gp_TrsfForm Form() const noexcept { return shape; }
 
   //! verify and set the shape of the GTrsf Other or CompoundTrsf
   //! Ex :
@@ -169,11 +170,11 @@ public:
   Standard_EXPORT void SetForm();
 
   //! Returns the translation part of the GTrsf.
-  const gp_XYZ& TranslationPart() const { return loc; }
+  constexpr const gp_XYZ& TranslationPart() const noexcept { return loc; }
 
   //! Computes the vectorial part of the GTrsf. The returned Matrix
   //! is a  3*3 matrix.
-  const gp_Mat& VectorialPart() const { return matrix; }
+  constexpr const gp_Mat& VectorialPart() const noexcept { return matrix; }
 
   //! Returns the coefficients of the global matrix of transformation.
   //! Raises OutOfRange if theRow < 1 or theRow > 3 or theCol < 1 or theCol > 4
index 9d8fbd90ff8171cf160cc64449b9276bb4f33d00..23ef036c83bb39343c4fbb1560668b59ddcda5dd 100644 (file)
@@ -51,12 +51,13 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! returns identity transformation.
-  gp_GTrsf2d()
+  constexpr gp_GTrsf2d() noexcept
+      : matrix(),
+        loc(0.0, 0.0),
+        shape(gp_Identity),
+        scale(1.0)
   {
-    shape = gp_Identity;
     matrix.SetScale(1.0);
-    loc.SetCoord(0.0, 0.0);
-    scale = 1.0;
   }
 
   //! Converts the gp_Trsf2d transformation theT into a
@@ -66,12 +67,12 @@ public:
   //! Creates   a transformation based on the matrix theM and the
   //! vector theV where theM defines the vectorial part of the
   //! transformation, and theV the translation part.
-  gp_GTrsf2d(const gp_Mat2d& theM, const gp_XY& theV)
+  constexpr gp_GTrsf2d(const gp_Mat2d& theM, const gp_XY& theV) noexcept
       : matrix(theM),
-        loc(theV)
+        loc(theV),
+        shape(gp_Other),
+        scale(0.0)
   {
-    shape = gp_Other;
-    scale = 0.0;
   }
 
   //! Changes this transformation into an affinity of ratio theRatio
@@ -97,7 +98,7 @@ public:
   void SetTrsf2d(const gp_Trsf2d& theT);
 
   //! Replaces the vectorial part of this transformation by theMatrix.
-  void SetVectorialPart(const gp_Mat2d& theMatrix)
+  constexpr void SetVectorialPart(const gp_Mat2d& theMatrix) noexcept
   {
     matrix = theMatrix;
     shape  = gp_Other;
@@ -123,14 +124,14 @@ public:
   //! transformation (relative to a point or axis), a scaling
   //! transformation, a compound transformation or some
   //! other type of transformation.
-  gp_TrsfForm Form() const { return shape; }
+  constexpr gp_TrsfForm Form() const noexcept { return shape; }
 
   //! Returns the translation part of the GTrsf2d.
-  const gp_XY& TranslationPart() const { return loc; }
+  constexpr const gp_XY& TranslationPart() const noexcept { return loc; }
 
   //! Computes the vectorial part of the GTrsf2d. The returned
   //! Matrix is a 2*2 matrix.
-  const gp_Mat2d& VectorialPart() const { return matrix; }
+  constexpr const gp_Mat2d& VectorialPart() const noexcept { return matrix; }
 
   //! Returns the coefficients of the global matrix of transformation.
   //! Raised OutOfRange if theRow < 1 or theRow > 2 or theCol < 1 or theCol > 3
index 12a56c2f7d665b0c3c0abd3f0ccfbb235984f5e7..3cc810b1f56dd19058d5a36bf9b08919c19d11ed 100644 (file)
@@ -30,21 +30,20 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! creates  a matrix with null coefficients.
-  gp_Mat()
+  constexpr gp_Mat() noexcept
+      : myMat{{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}}
   {
-    myMat[0][0] = myMat[0][1] = myMat[0][2] = myMat[1][0] = myMat[1][1] = myMat[1][2] =
-      myMat[2][0] = myMat[2][1] = myMat[2][2] = 0.0;
   }
 
-  gp_Mat(const Standard_Real theA11,
-         const Standard_Real theA12,
-         const Standard_Real theA13,
-         const Standard_Real theA21,
-         const Standard_Real theA22,
-         const Standard_Real theA23,
-         const Standard_Real theA31,
-         const Standard_Real theA32,
-         const Standard_Real theA33);
+  constexpr gp_Mat(const Standard_Real theA11,
+                   const Standard_Real theA12,
+                   const Standard_Real theA13,
+                   const Standard_Real theA21,
+                   const Standard_Real theA22,
+                   const Standard_Real theA23,
+                   const Standard_Real theA31,
+                   const Standard_Real theA32,
+                   const Standard_Real theA33) noexcept;
 
   //! Creates a matrix.
   //! theCol1, theCol2, theCol3 are the 3 columns of the matrix.
@@ -76,7 +75,9 @@ public:
   //! <me>.Value (3, 3) = theX3
   //! @endcode
   //! The other coefficients of the matrix are not modified.
-  void SetDiagonal(const Standard_Real theX1, const Standard_Real theX2, const Standard_Real theX3)
+  constexpr void SetDiagonal(const Standard_Real theX1,
+                             const Standard_Real theX2,
+                             const Standard_Real theX3) noexcept
   {
     myMat[0][0] = theX1;
     myMat[1][1] = theX2;
@@ -91,7 +92,7 @@ public:
   Standard_EXPORT void SetDot(const gp_XYZ& theRef);
 
   //! Modifies this matrix so that it represents the Identity matrix.
-  void SetIdentity()
+  constexpr void SetIdentity() noexcept
   {
     myMat[0][0] = myMat[1][1] = myMat[2][2] = 1.0;
     myMat[0][1] = myMat[0][2] = myMat[1][0] = myMat[1][2] = myMat[2][0] = myMat[2][1] = 0.0;
@@ -118,7 +119,7 @@ public:
   //! <me> =  | 0.0   theS   0.0 |
   //!         | 0.0  0.0   theS  |
   //! @endcode
-  void SetScale(const Standard_Real theS)
+  constexpr void SetScale(const Standard_Real theS) noexcept
   {
     myMat[0][0] = myMat[1][1] = myMat[2][2] = theS;
     myMat[0][1] = myMat[0][2] = myMat[1][0] = myMat[1][2] = myMat[2][0] = myMat[2][1] = 0.0;
@@ -139,7 +140,7 @@ public:
   Standard_EXPORT gp_XYZ Column(const Standard_Integer theCol) const;
 
   //! Computes the determinant of the matrix.
-  Standard_Real Determinant() const
+  constexpr Standard_Real Determinant() const noexcept
   {
     const Standard_Real a00 = myMat[0][0], a01 = myMat[0][1], a02 = myMat[0][2];
     const Standard_Real a10 = myMat[1][0], a11 = myMat[1][1], a12 = myMat[1][2];
@@ -188,7 +189,7 @@ public:
   //! The Gauss LU decomposition is used to invert the matrix
   //! (see Math package) so the matrix is considered as singular if
   //! the largest pivot found is lower or equal to Resolution from gp.
-  Standard_Boolean IsSingular() const
+  constexpr Standard_Boolean IsSingular() const noexcept
   {
     // Pour etre sur que Gauss va fonctionner, il faut faire Gauss ...
     Standard_Real aVal = Determinant();
@@ -199,25 +200,28 @@ public:
     return aVal <= gp::Resolution();
   }
 
-  void Add(const gp_Mat& theOther);
+  constexpr void Add(const gp_Mat& theOther) noexcept;
 
-  void operator+=(const gp_Mat& theOther) { Add(theOther); }
+  constexpr void operator+=(const gp_Mat& theOther) noexcept { Add(theOther); }
 
   //! Computes the sum of this matrix and
   //! the matrix theOther for each coefficient of the matrix :
   //! <me>.Coef(i,j) + <theOther>.Coef(i,j)
-  Standard_NODISCARD gp_Mat Added(const gp_Mat& theOther) const;
+  Standard_NODISCARD constexpr gp_Mat Added(const gp_Mat& theOther) const noexcept;
 
-  Standard_NODISCARD gp_Mat operator+(const gp_Mat& theOther) const { return Added(theOther); }
+  Standard_NODISCARD constexpr gp_Mat operator+(const gp_Mat& theOther) const noexcept
+  {
+    return Added(theOther);
+  }
 
-  void Divide(const Standard_Real theScalar);
+  constexpr void Divide(const Standard_Real theScalar);
 
-  void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
+  constexpr void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
 
   //! Divides all the coefficients of the matrix by Scalar
-  Standard_NODISCARD gp_Mat Divided(const Standard_Real theScalar) const;
+  Standard_NODISCARD constexpr gp_Mat Divided(const Standard_Real theScalar) const;
 
-  Standard_NODISCARD gp_Mat operator/(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Mat operator/(const Standard_Real theScalar) const
   {
     return Divided(theScalar);
   }
@@ -237,33 +241,36 @@ public:
   Standard_NODISCARD Standard_EXPORT gp_Mat Inverted() const;
 
   //! Computes  the product of two matrices <me> * <Other>
-  Standard_NODISCARD gp_Mat Multiplied(const gp_Mat& theOther) const
+  Standard_NODISCARD constexpr gp_Mat Multiplied(const gp_Mat& theOther) const noexcept
   {
     gp_Mat aNewMat = *this;
     aNewMat.Multiply(theOther);
     return aNewMat;
   }
 
-  Standard_NODISCARD gp_Mat operator*(const gp_Mat& theOther) const { return Multiplied(theOther); }
+  Standard_NODISCARD constexpr gp_Mat operator*(const gp_Mat& theOther) const noexcept
+  {
+    return Multiplied(theOther);
+  }
 
   //! Computes the product of two matrices <me> = <Other> * <me>.
-  void Multiply(const gp_Mat& theOther);
+  constexpr void Multiply(const gp_Mat& theOther) noexcept;
 
-  void operator*=(const gp_Mat& theOther) { Multiply(theOther); }
+  constexpr void operator*=(const gp_Mat& theOther) noexcept { Multiply(theOther); }
 
-  void PreMultiply(const gp_Mat& theOther);
+  constexpr void PreMultiply(const gp_Mat& theOther) noexcept;
 
-  Standard_NODISCARD gp_Mat Multiplied(const Standard_Real theScalar) const;
+  Standard_NODISCARD constexpr gp_Mat Multiplied(const Standard_Real theScalar) const noexcept;
 
-  Standard_NODISCARD gp_Mat operator*(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Mat operator*(const Standard_Real theScalar) const noexcept
   {
     return Multiplied(theScalar);
   }
 
   //! Multiplies all the coefficients of the matrix by Scalar
-  void Multiply(const Standard_Real theScalar);
+  constexpr void Multiply(const Standard_Real theScalar) noexcept;
 
-  void operator*=(const Standard_Real theScalar) { Multiply(theScalar); }
+  constexpr void operator*=(const Standard_Real theScalar) noexcept { Multiply(theScalar); }
 
   Standard_EXPORT void Power(const Standard_Integer N);
 
@@ -279,15 +286,18 @@ public:
     return aMatN;
   }
 
-  void Subtract(const gp_Mat& theOther);
+  constexpr void Subtract(const gp_Mat& theOther) noexcept;
 
-  void operator-=(const gp_Mat& theOther) { Subtract(theOther); }
+  constexpr void operator-=(const gp_Mat& theOther) noexcept { Subtract(theOther); }
 
   //! cOmputes for each coefficient of the matrix :
   //! <me>.Coef(i,j) - <theOther>.Coef(i,j)
-  Standard_NODISCARD gp_Mat Subtracted(const gp_Mat& theOther) const;
+  Standard_NODISCARD constexpr gp_Mat Subtracted(const gp_Mat& theOther) const noexcept;
 
-  Standard_NODISCARD gp_Mat operator-(const gp_Mat& theOther) const { return Subtracted(theOther); }
+  Standard_NODISCARD constexpr gp_Mat operator-(const gp_Mat& theOther) const noexcept
+  {
+    return Subtracted(theOther);
+  }
 
   void Transpose();
 
@@ -312,30 +322,22 @@ private:
 
 //=================================================================================================
 
-inline gp_Mat::gp_Mat(const Standard_Real theA11,
-                      const Standard_Real theA12,
-                      const Standard_Real theA13,
-                      const Standard_Real theA21,
-                      const Standard_Real theA22,
-                      const Standard_Real theA23,
-                      const Standard_Real theA31,
-                      const Standard_Real theA32,
-                      const Standard_Real theA33)
+inline constexpr gp_Mat::gp_Mat(const Standard_Real theA11,
+                                const Standard_Real theA12,
+                                const Standard_Real theA13,
+                                const Standard_Real theA21,
+                                const Standard_Real theA22,
+                                const Standard_Real theA23,
+                                const Standard_Real theA31,
+                                const Standard_Real theA32,
+                                const Standard_Real theA33) noexcept
+    : myMat{{theA11, theA12, theA13}, {theA21, theA22, theA23}, {theA31, theA32, theA33}}
 {
-  myMat[0][0] = theA11;
-  myMat[0][1] = theA12;
-  myMat[0][2] = theA13;
-  myMat[1][0] = theA21;
-  myMat[1][1] = theA22;
-  myMat[1][2] = theA23;
-  myMat[2][0] = theA31;
-  myMat[2][1] = theA32;
-  myMat[2][2] = theA33;
 }
 
 //=================================================================================================
 
-inline void gp_Mat::Add(const gp_Mat& theOther)
+inline constexpr void gp_Mat::Add(const gp_Mat& theOther) noexcept
 {
   myMat[0][0] += theOther.myMat[0][0];
   myMat[0][1] += theOther.myMat[0][1];
@@ -350,7 +352,7 @@ inline void gp_Mat::Add(const gp_Mat& theOther)
 
 //=================================================================================================
 
-inline gp_Mat gp_Mat::Added(const gp_Mat& theOther) const
+inline constexpr gp_Mat gp_Mat::Added(const gp_Mat& theOther) const noexcept
 {
   gp_Mat aNewMat(*this);
   aNewMat.Add(theOther);
@@ -359,7 +361,7 @@ inline gp_Mat gp_Mat::Added(const gp_Mat& theOther) const
 
 //=================================================================================================
 
-inline void gp_Mat::Divide(const Standard_Real theScalar)
+inline constexpr void gp_Mat::Divide(const Standard_Real theScalar)
 {
   Standard_Real aVal = theScalar;
   if (aVal < 0)
@@ -381,7 +383,7 @@ inline void gp_Mat::Divide(const Standard_Real theScalar)
 
 //=================================================================================================
 
-inline gp_Mat gp_Mat::Divided(const Standard_Real theScalar) const
+inline constexpr gp_Mat gp_Mat::Divided(const Standard_Real theScalar) const
 {
   gp_Mat aNewMat(*this);
   aNewMat.Divide(theScalar);
@@ -390,7 +392,7 @@ inline gp_Mat gp_Mat::Divided(const Standard_Real theScalar) const
 
 //=================================================================================================
 
-inline void gp_Mat::Multiply(const gp_Mat& theOther)
+inline constexpr void gp_Mat::Multiply(const gp_Mat& theOther) noexcept
 {
   const Standard_Real aT00 = myMat[0][0] * theOther.myMat[0][0] + myMat[0][1] * theOther.myMat[1][0]
                              + myMat[0][2] * theOther.myMat[2][0];
@@ -423,7 +425,7 @@ inline void gp_Mat::Multiply(const gp_Mat& theOther)
 
 //=================================================================================================
 
-inline void gp_Mat::PreMultiply(const gp_Mat& theOther)
+inline constexpr void gp_Mat::PreMultiply(const gp_Mat& theOther) noexcept
 {
   const Standard_Real aT00 = theOther.myMat[0][0] * myMat[0][0] + theOther.myMat[0][1] * myMat[1][0]
                              + theOther.myMat[0][2] * myMat[2][0];
@@ -456,7 +458,7 @@ inline void gp_Mat::PreMultiply(const gp_Mat& theOther)
 
 //=================================================================================================
 
-inline gp_Mat gp_Mat::Multiplied(const Standard_Real theScalar) const
+inline constexpr gp_Mat gp_Mat::Multiplied(const Standard_Real theScalar) const noexcept
 {
   gp_Mat aNewMat(*this);
   aNewMat.Multiply(theScalar);
@@ -465,7 +467,7 @@ inline gp_Mat gp_Mat::Multiplied(const Standard_Real theScalar) const
 
 //=================================================================================================
 
-inline void gp_Mat::Multiply(const Standard_Real theScalar)
+inline constexpr void gp_Mat::Multiply(const Standard_Real theScalar) noexcept
 {
   myMat[0][0] *= theScalar;
   myMat[0][1] *= theScalar;
@@ -480,7 +482,7 @@ inline void gp_Mat::Multiply(const Standard_Real theScalar)
 
 //=================================================================================================
 
-inline void gp_Mat::Subtract(const gp_Mat& theOther)
+inline constexpr void gp_Mat::Subtract(const gp_Mat& theOther) noexcept
 {
   myMat[0][0] -= theOther.myMat[0][0];
   myMat[0][1] -= theOther.myMat[0][1];
@@ -495,7 +497,7 @@ inline void gp_Mat::Subtract(const gp_Mat& theOther)
 
 //=================================================================================================
 
-inline gp_Mat gp_Mat::Subtracted(const gp_Mat& theOther) const
+inline constexpr gp_Mat gp_Mat::Subtracted(const gp_Mat& theOther) const noexcept
 {
   gp_Mat aNewMat(*this);
   aNewMat.Subtract(theOther);
@@ -524,7 +526,7 @@ inline void
 // function : operator*
 // purpose :
 //=======================================================================
-inline gp_Mat operator*(const Standard_Real theScalar, const gp_Mat& theMat3D)
+inline constexpr gp_Mat operator*(const Standard_Real theScalar, const gp_Mat& theMat3D) noexcept
 {
   return theMat3D.Multiplied(theScalar);
 }
index 1723d3c7e43049ac8bd3113de74b32fcfdff9256..b56e36ad43fb8649fc05a5867b871f7dfe581059 100644 (file)
@@ -29,7 +29,10 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates  a matrix with null coefficients.
-  gp_Mat2d() { myMat[0][0] = myMat[0][1] = myMat[1][0] = myMat[1][1] = 0.0; }
+  constexpr gp_Mat2d() noexcept
+      : myMat{{0.0, 0.0}, {0.0, 0.0}}
+  {
+  }
 
   //! theCol1, theCol2 are the 2 columns of the matrix.
   Standard_EXPORT gp_Mat2d(const gp_XY& theCol1, const gp_XY& theCol2);
@@ -48,14 +51,14 @@ public:
   //! <me>.Value (2, 2) = theX2
   //! @endcode
   //! The other coefficients of the matrix are not modified.
-  void SetDiagonal(const Standard_Real theX1, const Standard_Real theX2)
+  constexpr void SetDiagonal(const Standard_Real theX1, const Standard_Real theX2) noexcept
   {
     myMat[0][0] = theX1;
     myMat[1][1] = theX2;
   }
 
   //! Modifies this matrix, so that it represents the Identity matrix.
-  void SetIdentity()
+  constexpr void SetIdentity() noexcept
   {
     myMat[0][0] = myMat[1][1] = 1.0;
     myMat[0][1] = myMat[1][0] = 0.0;
@@ -78,7 +81,7 @@ public:
   //!         | theS    0.0 |
   //! <me> =  | 0.0   theS  |
   //! @endcode
-  void SetScale(const Standard_Real theS)
+  constexpr void SetScale(const Standard_Real theS) noexcept
   {
     myMat[0][0] = myMat[1][1] = theS;
     myMat[0][1] = myMat[1][0] = 0.0;
@@ -99,7 +102,7 @@ public:
   Standard_EXPORT gp_XY Column(const Standard_Integer theCol) const;
 
   //! Computes the determinant of the matrix.
-  Standard_Real Determinant() const
+  constexpr Standard_Real Determinant() const noexcept
   {
     return myMat[0][0] * myMat[1][1] - myMat[1][0] * myMat[0][1];
   }
@@ -144,7 +147,7 @@ public:
   //! The Gauss LU decomposition is used to invert the matrix
   //! so the matrix is considered as singular if the largest
   //! pivot found is lower or equal to Resolution from gp.
-  Standard_Boolean IsSingular() const
+  constexpr Standard_Boolean IsSingular() const noexcept
   {
     Standard_Real aDet = Determinant();
     if (aDet < 0)
@@ -154,9 +157,9 @@ public:
     return aDet <= gp::Resolution();
   }
 
-  void Add(const gp_Mat2d& Other);
+  constexpr void Add(const gp_Mat2d& Other) noexcept;
 
-  void operator+=(const gp_Mat2d& theOther) { Add(theOther); }
+  constexpr void operator+=(const gp_Mat2d& theOther) noexcept { Add(theOther); }
 
   //! Computes the sum of this matrix and the matrix
   //! theOther.for each coefficient of the matrix :
@@ -166,18 +169,21 @@ public:
   //! Note:
   //! -   operator += assigns the result to this matrix, while
   //! -   operator + creates a new one.
-  Standard_NODISCARD gp_Mat2d Added(const gp_Mat2d& theOther) const;
+  Standard_NODISCARD constexpr gp_Mat2d Added(const gp_Mat2d& theOther) const noexcept;
 
-  Standard_NODISCARD gp_Mat2d operator+(const gp_Mat2d& theOther) const { return Added(theOther); }
+  Standard_NODISCARD constexpr gp_Mat2d operator+(const gp_Mat2d& theOther) const noexcept
+  {
+    return Added(theOther);
+  }
 
-  void Divide(const Standard_Real theScalar);
+  constexpr void Divide(const Standard_Real theScalar);
 
-  void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
+  constexpr void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
 
   //! Divides all the coefficients of the matrix by a scalar.
-  Standard_NODISCARD gp_Mat2d Divided(const Standard_Real theScalar) const;
+  Standard_NODISCARD constexpr gp_Mat2d Divided(const Standard_Real theScalar) const;
 
-  Standard_NODISCARD gp_Mat2d operator/(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Mat2d operator/(const Standard_Real theScalar) const
   {
     return Divided(theScalar);
   }
@@ -193,36 +199,36 @@ public:
     return aNewMat;
   }
 
-  Standard_NODISCARD gp_Mat2d Multiplied(const gp_Mat2d& theOther) const
+  Standard_NODISCARD constexpr gp_Mat2d Multiplied(const gp_Mat2d& theOther) const noexcept
   {
     gp_Mat2d aNewMat2d = *this;
     aNewMat2d.Multiply(theOther);
     return aNewMat2d;
   }
 
-  Standard_NODISCARD gp_Mat2d operator*(const gp_Mat2d& theOther) const
+  Standard_NODISCARD constexpr gp_Mat2d operator*(const gp_Mat2d& theOther) const noexcept
   {
     return Multiplied(theOther);
   }
 
   //! Computes the product of two matrices <me> * <theOther>
-  void Multiply(const gp_Mat2d& theOther);
+  constexpr void Multiply(const gp_Mat2d& theOther) noexcept;
 
   //! Modifies this matrix by premultiplying it by the matrix Other
   //! <me> = theOther * <me>.
-  void PreMultiply(const gp_Mat2d& theOther);
+  constexpr void PreMultiply(const gp_Mat2d& theOther) noexcept;
 
-  Standard_NODISCARD gp_Mat2d Multiplied(const Standard_Real theScalar) const;
+  Standard_NODISCARD constexpr gp_Mat2d Multiplied(const Standard_Real theScalar) const noexcept;
 
-  Standard_NODISCARD gp_Mat2d operator*(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Mat2d operator*(const Standard_Real theScalar) const noexcept
   {
     return Multiplied(theScalar);
   }
 
   //! Multiplies all the coefficients of the matrix by a scalar.
-  void Multiply(const Standard_Real theScalar);
+  constexpr void Multiply(const Standard_Real theScalar) noexcept;
 
-  void operator*=(const Standard_Real theScalar) { Multiply(theScalar); }
+  constexpr void operator*=(const Standard_Real theScalar) noexcept { Multiply(theScalar); }
 
   Standard_EXPORT void Power(const Standard_Integer theN);
 
@@ -238,25 +244,25 @@ public:
     return aMat2dN;
   }
 
-  void Subtract(const gp_Mat2d& theOther);
+  constexpr void Subtract(const gp_Mat2d& theOther) noexcept;
 
-  void operator-=(const gp_Mat2d& theOther) { Subtract(theOther); }
+  constexpr void operator-=(const gp_Mat2d& theOther) noexcept { Subtract(theOther); }
 
   //! Computes for each coefficient of the matrix :
   //! @code
   //! <me>.Coef(i,j) - <theOther>.Coef(i,j)
   //! @endcode
-  Standard_NODISCARD gp_Mat2d Subtracted(const gp_Mat2d& theOther) const;
+  Standard_NODISCARD constexpr gp_Mat2d Subtracted(const gp_Mat2d& theOther) const noexcept;
 
-  Standard_NODISCARD gp_Mat2d operator-(const gp_Mat2d& theOther) const
+  Standard_NODISCARD constexpr gp_Mat2d operator-(const gp_Mat2d& theOther) const noexcept
   {
     return Subtracted(theOther);
   }
 
-  void Transpose();
+  constexpr void Transpose() noexcept;
 
   //! Transposes the matrix. A(j, i) -> A (i, j)
-  Standard_NODISCARD gp_Mat2d Transposed() const;
+  Standard_NODISCARD constexpr gp_Mat2d Transposed() const noexcept;
 
   friend class gp_Trsf2d;
   friend class gp_GTrsf2d;
@@ -279,7 +285,7 @@ inline void gp_Mat2d::SetRotation(const Standard_Real theAng)
 
 //=================================================================================================
 
-inline void gp_Mat2d::Add(const gp_Mat2d& theOther)
+inline constexpr void gp_Mat2d::Add(const gp_Mat2d& theOther) noexcept
 {
   myMat[0][0] += theOther.myMat[0][0];
   myMat[0][1] += theOther.myMat[0][1];
@@ -289,7 +295,7 @@ inline void gp_Mat2d::Add(const gp_Mat2d& theOther)
 
 //=================================================================================================
 
-inline gp_Mat2d gp_Mat2d::Added(const gp_Mat2d& theOther) const
+inline constexpr gp_Mat2d gp_Mat2d::Added(const gp_Mat2d& theOther) const noexcept
 {
   gp_Mat2d aNewMat2d;
   aNewMat2d.myMat[0][0] = myMat[0][0] + theOther.myMat[0][0];
@@ -301,7 +307,7 @@ inline gp_Mat2d gp_Mat2d::Added(const gp_Mat2d& theOther) const
 
 //=================================================================================================
 
-inline void gp_Mat2d::Divide(const Standard_Real theScalar)
+inline constexpr void gp_Mat2d::Divide(const Standard_Real theScalar)
 {
   myMat[0][0] /= theScalar;
   myMat[0][1] /= theScalar;
@@ -311,7 +317,7 @@ inline void gp_Mat2d::Divide(const Standard_Real theScalar)
 
 //=================================================================================================
 
-inline gp_Mat2d gp_Mat2d::Divided(const Standard_Real theScalar) const
+inline constexpr gp_Mat2d gp_Mat2d::Divided(const Standard_Real theScalar) const
 {
   gp_Mat2d aNewMat2d;
   aNewMat2d.myMat[0][0] = myMat[0][0] / theScalar;
@@ -323,7 +329,7 @@ inline gp_Mat2d gp_Mat2d::Divided(const Standard_Real theScalar) const
 
 //=================================================================================================
 
-inline void gp_Mat2d::Multiply(const gp_Mat2d& theOther)
+inline constexpr void gp_Mat2d::Multiply(const gp_Mat2d& theOther) noexcept
 {
   const Standard_Real aT00 =
     myMat[0][0] * theOther.myMat[0][0] + myMat[0][1] * theOther.myMat[1][0];
@@ -337,7 +343,7 @@ inline void gp_Mat2d::Multiply(const gp_Mat2d& theOther)
 
 //=================================================================================================
 
-inline void gp_Mat2d::PreMultiply(const gp_Mat2d& theOther)
+inline constexpr void gp_Mat2d::PreMultiply(const gp_Mat2d& theOther) noexcept
 {
   const Standard_Real aT00 =
     theOther.myMat[0][0] * myMat[0][0] + theOther.myMat[0][1] * myMat[1][0];
@@ -351,7 +357,7 @@ inline void gp_Mat2d::PreMultiply(const gp_Mat2d& theOther)
 
 //=================================================================================================
 
-inline gp_Mat2d gp_Mat2d::Multiplied(const Standard_Real theScalar) const
+inline constexpr gp_Mat2d gp_Mat2d::Multiplied(const Standard_Real theScalar) const noexcept
 {
   gp_Mat2d aNewMat2d;
   aNewMat2d.myMat[0][0] = myMat[0][0] * theScalar;
@@ -363,7 +369,7 @@ inline gp_Mat2d gp_Mat2d::Multiplied(const Standard_Real theScalar) const
 
 //=================================================================================================
 
-inline void gp_Mat2d::Multiply(const Standard_Real theScalar)
+inline constexpr void gp_Mat2d::Multiply(const Standard_Real theScalar) noexcept
 {
   myMat[0][0] *= theScalar;
   myMat[0][1] *= theScalar;
@@ -373,7 +379,7 @@ inline void gp_Mat2d::Multiply(const Standard_Real theScalar)
 
 //=================================================================================================
 
-inline void gp_Mat2d::Subtract(const gp_Mat2d& theOther)
+inline constexpr void gp_Mat2d::Subtract(const gp_Mat2d& theOther) noexcept
 {
   myMat[0][0] -= theOther.myMat[0][0];
   myMat[0][1] -= theOther.myMat[0][1];
@@ -383,7 +389,7 @@ inline void gp_Mat2d::Subtract(const gp_Mat2d& theOther)
 
 //=================================================================================================
 
-inline gp_Mat2d gp_Mat2d::Subtracted(const gp_Mat2d& theOther) const
+inline constexpr gp_Mat2d gp_Mat2d::Subtracted(const gp_Mat2d& theOther) const noexcept
 {
   gp_Mat2d aNewMat2d;
   aNewMat2d.myMat[0][0] = myMat[0][0] - theOther.myMat[0][0];
@@ -395,7 +401,7 @@ inline gp_Mat2d gp_Mat2d::Subtracted(const gp_Mat2d& theOther) const
 
 //=================================================================================================
 
-inline void gp_Mat2d::Transpose()
+inline constexpr void gp_Mat2d::Transpose() noexcept
 {
   const Standard_Real aTemp = myMat[0][1];
   myMat[0][1]               = myMat[1][0];
@@ -404,7 +410,7 @@ inline void gp_Mat2d::Transpose()
 
 //=================================================================================================
 
-inline gp_Mat2d gp_Mat2d::Transposed() const
+inline constexpr gp_Mat2d gp_Mat2d::Transposed() const noexcept
 {
   gp_Mat2d aNewMat2d;
   aNewMat2d.myMat[1][0] = myMat[0][1];
@@ -418,7 +424,8 @@ inline gp_Mat2d gp_Mat2d::Transposed() const
 // function : operator*
 // purpose :
 //=======================================================================
-inline gp_Mat2d operator*(const Standard_Real theScalar, const gp_Mat2d& theMat2D)
+inline constexpr gp_Mat2d operator*(const Standard_Real theScalar,
+                                    const gp_Mat2d&     theMat2D) noexcept
 {
   return theMat2D.Multiplied(theScalar);
 }
index d8f98c02513db9396aa5bb4e0d913f07f0e88055..4f67fe920e4f4397fe79b9ee2b286bbc3413efc7 100644 (file)
@@ -34,16 +34,21 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates a point with zero coordinates.
-  gp_Pnt() {}
+  constexpr gp_Pnt() noexcept
+      : coord()
+  {
+  }
 
   //! Creates a point from a XYZ object.
-  gp_Pnt(const gp_XYZ& theCoord)
+  constexpr gp_Pnt(const gp_XYZ& theCoord) noexcept
       : coord(theCoord)
   {
   }
 
   //! Creates a  point with its 3 cartesian's coordinates : theXp, theYp, theZp.
-  gp_Pnt(const Standard_Real theXp, const Standard_Real theYp, const Standard_Real theZp)
+  constexpr gp_Pnt(const Standard_Real theXp,
+                   const Standard_Real theYp,
+                   const Standard_Real theZp) noexcept
       : coord(theXp, theYp, theZp)
   {
   }
@@ -59,22 +64,24 @@ public:
   }
 
   //! For this point, assigns  the values theXp, theYp and theZp to its three coordinates.
-  void SetCoord(const Standard_Real theXp, const Standard_Real theYp, const Standard_Real theZp)
+  constexpr void SetCoord(const Standard_Real theXp,
+                          const Standard_Real theYp,
+                          const Standard_Real theZp) noexcept
   {
     coord.SetCoord(theXp, theYp, theZp);
   }
 
   //! Assigns the given value to the X coordinate of this point.
-  void SetX(const Standard_Real theX) { coord.SetX(theX); }
+  constexpr void SetX(const Standard_Real theX) noexcept { coord.SetX(theX); }
 
   //! Assigns the given value to the Y coordinate of this point.
-  void SetY(const Standard_Real theY) { coord.SetY(theY); }
+  constexpr void SetY(const Standard_Real theY) noexcept { coord.SetY(theY); }
 
   //! Assigns the given value to the Z coordinate of this point.
-  void SetZ(const Standard_Real theZ) { coord.SetZ(theZ); }
+  constexpr void SetZ(const Standard_Real theZ) noexcept { coord.SetZ(theZ); }
 
   //! Assigns the three coordinates of theCoord to this point.
-  void SetXYZ(const gp_XYZ& theCoord) { coord = theCoord; }
+  constexpr void SetXYZ(const gp_XYZ& theCoord) noexcept { coord = theCoord; }
 
   //! Returns the coordinate of corresponding to the value of theIndex :
   //! theIndex = 1 => X is returned
@@ -85,33 +92,37 @@ public:
   Standard_Real Coord(const Standard_Integer theIndex) const { return coord.Coord(theIndex); }
 
   //! For this point gives its three coordinates theXp, theYp and theZp.
-  void Coord(Standard_Real& theXp, Standard_Real& theYp, Standard_Real& theZp) const
+  constexpr void Coord(Standard_Real& theXp,
+                       Standard_Real& theYp,
+                       Standard_Real& theZp) const noexcept
   {
     coord.Coord(theXp, theYp, theZp);
   }
 
   //! For this point, returns its X coordinate.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! For this point, returns its Y coordinate.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! For this point, returns its Z coordinate.
-  Standard_Real Z() const { return coord.Z(); }
+  constexpr Standard_Real Z() const noexcept { return coord.Z(); }
 
   //! For this point, returns its three coordinates as a XYZ object.
-  const gp_XYZ& XYZ() const { return coord; }
+  constexpr const gp_XYZ& XYZ() const noexcept { return coord; }
 
   //! For this point, returns its three coordinates as a XYZ object.
-  const gp_XYZ& Coord() const { return coord; }
+  constexpr const gp_XYZ& Coord() const noexcept { return coord; }
 
   //! Returns the coordinates of this point.
   //! Note: This syntax allows direct modification of the returned value.
-  gp_XYZ& ChangeCoord() { return coord; }
+  constexpr gp_XYZ& ChangeCoord() noexcept { return coord; }
 
   //! Assigns the result of the following expression to this point
   //! (theAlpha*this + theBeta*theP) / (theAlpha + theBeta)
-  void BaryCenter(const Standard_Real theAlpha, const gp_Pnt& theP, const Standard_Real theBeta)
+  constexpr void BaryCenter(const Standard_Real theAlpha,
+                            const gp_Pnt&       theP,
+                            const Standard_Real theBeta)
   {
     coord.SetLinearForm(theAlpha, coord, theBeta, theP.coord);
     coord.Divide(theAlpha + theBeta);
@@ -129,7 +140,7 @@ public:
   Standard_Real Distance(const gp_Pnt& theOther) const;
 
   //! Computes the square distance between two points.
-  Standard_Real SquareDistance(const gp_Pnt& theOther) const;
+  constexpr Standard_Real SquareDistance(const gp_Pnt& theOther) const noexcept;
 
   //! Performs the symmetrical transformation of a point
   //! with respect to the point theP which is the center of
@@ -164,9 +175,10 @@ public:
   }
 
   //! Scales a point. theS is the scaling value.
-  void Scale(const gp_Pnt& theP, const Standard_Real theS);
+  constexpr void Scale(const gp_Pnt& theP, const Standard_Real theS) noexcept;
 
-  Standard_NODISCARD gp_Pnt Scaled(const gp_Pnt& theP, const Standard_Real theS) const
+  Standard_NODISCARD constexpr gp_Pnt Scaled(const gp_Pnt&       theP,
+                                             const Standard_Real theS) const noexcept
   {
     gp_Pnt aPres = *this;
     aPres.Scale(theP, theS);
@@ -185,18 +197,19 @@ public:
 
   //! Translates a point in the direction of the vector theV.
   //! The magnitude of the translation is the vector's magnitude.
-  void Translate(const gp_Vec& theV);
+  constexpr void Translate(const gp_Vec& theV) noexcept;
 
-  Standard_NODISCARD gp_Pnt Translated(const gp_Vec& theV) const;
+  Standard_NODISCARD constexpr gp_Pnt Translated(const gp_Vec& theV) const noexcept;
 
   //! Translates a point from the point theP1 to the point theP2.
-  void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2)
+  constexpr void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) noexcept
   {
     coord.Add(theP2.coord);
     coord.Subtract(theP1.coord);
   }
 
-  Standard_NODISCARD gp_Pnt Translated(const gp_Pnt& theP1, const gp_Pnt& theP2) const
+  Standard_NODISCARD constexpr gp_Pnt Translated(const gp_Pnt& theP1,
+                                                 const gp_Pnt& theP2) const noexcept
   {
     gp_Pnt aP = *this;
     aP.Translate(theP1, theP2);
@@ -261,7 +274,7 @@ inline Standard_Real gp_Pnt::Distance(const gp_Pnt& theOther) const
 
 //=================================================================================================
 
-inline Standard_Real gp_Pnt::SquareDistance(const gp_Pnt& theOther) const
+inline constexpr Standard_Real gp_Pnt::SquareDistance(const gp_Pnt& theOther) const noexcept
 {
   const gp_XYZ&       aXYZ = theOther.coord;
   const Standard_Real aDx  = coord.X() - aXYZ.X();
@@ -281,7 +294,7 @@ inline void gp_Pnt::Rotate(const gp_Ax1& theA1, const Standard_Real theAng)
 
 //=================================================================================================
 
-inline void gp_Pnt::Scale(const gp_Pnt& theP, const Standard_Real theS)
+inline constexpr void gp_Pnt::Scale(const gp_Pnt& theP, const Standard_Real theS) noexcept
 {
   gp_XYZ aXYZ = theP.coord;
   aXYZ.Multiply(1.0 - theS);
@@ -291,14 +304,14 @@ inline void gp_Pnt::Scale(const gp_Pnt& theP, const Standard_Real theS)
 
 //=================================================================================================
 
-inline void gp_Pnt::Translate(const gp_Vec& theV)
+inline constexpr void gp_Pnt::Translate(const gp_Vec& theV) noexcept
 {
   coord.Add(theV.XYZ());
 }
 
 //=================================================================================================
 
-inline gp_Pnt gp_Pnt::Translated(const gp_Vec& theV) const
+inline constexpr gp_Pnt gp_Pnt::Translated(const gp_Vec& theV) const noexcept
 {
   gp_Pnt aP = *this;
   aP.coord.Add(theV.XYZ());
index 8779350b077d29edf11fbe28a92a770d0bbe9c85..3bb01b02728dc09b8e7455539b2368b51715fde4 100644 (file)
@@ -34,16 +34,19 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates a point with zero coordinates.
-  gp_Pnt2d() {}
+  constexpr gp_Pnt2d() noexcept
+      : coord()
+  {
+  }
 
   //! Creates a point with a doublet of coordinates.
-  gp_Pnt2d(const gp_XY& theCoord)
+  constexpr gp_Pnt2d(const gp_XY& theCoord) noexcept
       : coord(theCoord)
   {
   }
 
   //! Creates a  point with its 2 cartesian's coordinates : theXp, theYp.
-  gp_Pnt2d(const Standard_Real theXp, const Standard_Real theYp)
+  constexpr gp_Pnt2d(const Standard_Real theXp, const Standard_Real theYp) noexcept
       : coord(theXp, theYp)
   {
   }
@@ -58,19 +61,19 @@ public:
   }
 
   //! For this point, assigns the values theXp and theYp to its two coordinates
-  void SetCoord(const Standard_Real theXp, const Standard_Real theYp)
+  constexpr void SetCoord(const Standard_Real theXp, const Standard_Real theYp) noexcept
   {
     coord.SetCoord(theXp, theYp);
   }
 
   //! Assigns the given value to the X  coordinate of this point.
-  void SetX(const Standard_Real theX) { coord.SetX(theX); }
+  constexpr void SetX(const Standard_Real theX) noexcept { coord.SetX(theX); }
 
   //! Assigns the given value to the Y  coordinate of this point.
-  void SetY(const Standard_Real theY) { coord.SetY(theY); }
+  constexpr void SetY(const Standard_Real theY) noexcept { coord.SetY(theY); }
 
   //! Assigns the two coordinates of Coord to this point.
-  void SetXY(const gp_XY& theCoord) { coord = theCoord; }
+  constexpr void SetXY(const gp_XY& theCoord) noexcept { coord = theCoord; }
 
   //! Returns the coordinate of range theIndex :
   //! theIndex = 1 => X is returned
@@ -79,23 +82,26 @@ public:
   Standard_Real Coord(const Standard_Integer theIndex) const { return coord.Coord(theIndex); }
 
   //! For this point returns its two coordinates as a number pair.
-  void Coord(Standard_Real& theXp, Standard_Real& theYp) const { coord.Coord(theXp, theYp); }
+  constexpr void Coord(Standard_Real& theXp, Standard_Real& theYp) const noexcept
+  {
+    coord.Coord(theXp, theYp);
+  }
 
   //! For this point, returns its X  coordinate.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! For this point, returns its Y coordinate.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! For this point, returns its two coordinates as a number pair.
-  const gp_XY& XY() const { return coord; }
+  constexpr const gp_XY& XY() const noexcept { return coord; }
 
   //! For this point, returns its two coordinates as a number pair.
-  const gp_XY& Coord() const { return coord; }
+  constexpr const gp_XY& Coord() const noexcept { return coord; }
 
   //! Returns the coordinates of this point.
   //! Note: This syntax allows direct modification of the returned value.
-  gp_XY& ChangeCoord() { return coord; }
+  constexpr gp_XY& ChangeCoord() noexcept { return coord; }
 
   //! Comparison
   //! Returns True if the distance between the two
@@ -109,7 +115,7 @@ public:
   Standard_Real Distance(const gp_Pnt2d& theOther) const;
 
   //! Computes the square distance between two points.
-  Standard_Real SquareDistance(const gp_Pnt2d& theOther) const;
+  constexpr Standard_Real SquareDistance(const gp_Pnt2d& theOther) const noexcept;
 
   //! Performs the symmetrical transformation of a point
   //! with respect to the point theP which is the center of
@@ -136,9 +142,10 @@ public:
   }
 
   //! Scales a point. theS is the scaling value.
-  void Scale(const gp_Pnt2d& theP, const Standard_Real theS);
+  constexpr void Scale(const gp_Pnt2d& theP, const Standard_Real theS) noexcept;
 
-  Standard_NODISCARD gp_Pnt2d Scaled(const gp_Pnt2d& theP, const Standard_Real theS) const
+  Standard_NODISCARD constexpr gp_Pnt2d Scaled(const gp_Pnt2d&     theP,
+                                               const Standard_Real theS) const noexcept
   {
     gp_Pnt2d aPres = *this;
     aPres.Scale(theP, theS);
@@ -157,18 +164,19 @@ public:
 
   //! Translates a point in the direction of the vector theV.
   //! The magnitude of the translation is the vector's magnitude.
-  void Translate(const gp_Vec2d& theV);
+  constexpr void Translate(const gp_Vec2d& theV) noexcept;
 
-  Standard_NODISCARD gp_Pnt2d Translated(const gp_Vec2d& theV) const;
+  Standard_NODISCARD constexpr gp_Pnt2d Translated(const gp_Vec2d& theV) const noexcept;
 
   //! Translates a point from the point theP1 to the point theP2.
-  void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2)
+  constexpr void Translate(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) noexcept
   {
     coord.Add(theP2.coord);
     coord.Subtract(theP1.coord);
   }
 
-  Standard_NODISCARD gp_Pnt2d Translated(const gp_Pnt2d& theP1, const gp_Pnt2d& theP2) const
+  Standard_NODISCARD constexpr gp_Pnt2d Translated(const gp_Pnt2d& theP1,
+                                                   const gp_Pnt2d& theP2) const noexcept
   {
     gp_Pnt2d aP = *this;
     aP.Translate(theP1, theP2);
@@ -197,7 +205,7 @@ inline Standard_Real gp_Pnt2d::Distance(const gp_Pnt2d& theOther) const
 
 //=================================================================================================
 
-inline Standard_Real gp_Pnt2d::SquareDistance(const gp_Pnt2d& theOther) const
+inline constexpr Standard_Real gp_Pnt2d::SquareDistance(const gp_Pnt2d& theOther) const noexcept
 {
   const gp_XY&  aXY = theOther.coord;
   Standard_Real aX  = coord.X() - aXY.X();
@@ -216,7 +224,7 @@ inline void gp_Pnt2d::Rotate(const gp_Pnt2d& theP, const Standard_Real theAng)
 
 //=================================================================================================
 
-inline void gp_Pnt2d::Scale(const gp_Pnt2d& theP, const Standard_Real theS)
+inline constexpr void gp_Pnt2d::Scale(const gp_Pnt2d& theP, const Standard_Real theS) noexcept
 {
   gp_XY aXY = theP.coord;
   aXY.Multiply(1.0 - theS);
@@ -226,14 +234,14 @@ inline void gp_Pnt2d::Scale(const gp_Pnt2d& theP, const Standard_Real theS)
 
 //=================================================================================================
 
-inline void gp_Pnt2d::Translate(const gp_Vec2d& theV)
+inline constexpr void gp_Pnt2d::Translate(const gp_Vec2d& theV) noexcept
 {
   coord.Add(theV.XY());
 }
 
 //=================================================================================================
 
-inline gp_Pnt2d gp_Pnt2d::Translated(const gp_Vec2d& theV) const
+inline constexpr gp_Pnt2d gp_Pnt2d::Translated(const gp_Vec2d& theV) const noexcept
 {
   gp_Pnt2d aP = *this;
   aP.coord.Add(theV.XY());
index 8577282d788f21aa0b59dbf41554d2a26fa24fcf..ab49cc033925a8e8446748759e6b6147159a1fd7 100644 (file)
@@ -33,7 +33,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates an identity quaternion
-  gp_Quaternion()
+  constexpr gp_Quaternion() noexcept
       : x(0.0),
         y(0.0),
         z(0.0),
@@ -42,10 +42,10 @@ public:
   }
 
   //! Creates quaternion directly from component values
-  gp_Quaternion(const Standard_Real theX,
-                const Standard_Real theY,
-                const Standard_Real theZ,
-                const Standard_Real theW)
+  constexpr gp_Quaternion(const Standard_Real theX,
+                          const Standard_Real theY,
+                          const Standard_Real theZ,
+                          const Standard_Real theW) noexcept
       : x(theX),
         y(theY),
         z(theZ),
@@ -128,30 +128,30 @@ public:
                                       Standard_Real&         theBeta,
                                       Standard_Real&         theGamma) const;
 
-  void Set(const Standard_Real theX,
-           const Standard_Real theY,
-           const Standard_Real theZ,
-           const Standard_Real theW);
+  constexpr void Set(const Standard_Real theX,
+                     const Standard_Real theY,
+                     const Standard_Real theZ,
+                     const Standard_Real theW) noexcept;
 
-  void Set(const gp_Quaternion& theQuaternion);
+  constexpr void Set(const gp_Quaternion& theQuaternion) noexcept;
 
-  Standard_Real X() const { return x; }
+  constexpr Standard_Real X() const noexcept { return x; }
 
-  Standard_Real Y() const { return y; }
+  constexpr Standard_Real Y() const noexcept { return y; }
 
-  Standard_Real Z() const { return z; }
+  constexpr Standard_Real Z() const noexcept { return z; }
 
-  Standard_Real W() const { return w; }
+  constexpr Standard_Real W() const noexcept { return w; }
 
   //! Make identity quaternion (zero-rotation)
-  void SetIdent()
+  constexpr void SetIdent() noexcept
   {
     x = y = z = 0.0;
     w         = 1.0;
   }
 
   //! Reverse direction of rotation (conjugate quaternion)
-  void Reverse()
+  constexpr void Reverse() noexcept
   {
     x = -x;
     y = -y;
@@ -159,41 +159,44 @@ public:
   }
 
   //! Return rotation with reversed direction (conjugated quaternion)
-  Standard_NODISCARD gp_Quaternion Reversed() const { return gp_Quaternion(-x, -y, -z, w); }
+  Standard_NODISCARD constexpr gp_Quaternion Reversed() const noexcept
+  {
+    return gp_Quaternion(-x, -y, -z, w);
+  }
 
   //! Inverts quaternion (both rotation direction and norm)
-  void Invert()
+  constexpr void Invert()
   {
     Standard_Real anIn = 1.0 / SquareNorm();
     Set(-x * anIn, -y * anIn, -z * anIn, w * anIn);
   }
 
   //! Return inversed quaternion q^-1
-  Standard_NODISCARD gp_Quaternion Inverted() const
+  Standard_NODISCARD constexpr gp_Quaternion Inverted() const
   {
     Standard_Real anIn = 1.0 / SquareNorm();
     return gp_Quaternion(-x * anIn, -y * anIn, -z * anIn, w * anIn);
   }
 
   //! Returns square norm of quaternion
-  Standard_Real SquareNorm() const { return x * x + y * y + z * z + w * w; }
+  constexpr Standard_Real SquareNorm() const noexcept { return x * x + y * y + z * z + w * w; }
 
   //! Returns norm of quaternion
   Standard_Real Norm() const { return Sqrt(SquareNorm()); }
 
   //! Scale all components by quaternion by theScale; note that
   //! rotation is not changed by this operation (except 0-scaling)
-  void Scale(const Standard_Real theScale);
+  constexpr void Scale(const Standard_Real theScale) noexcept;
 
   void operator*=(const Standard_Real theScale) { Scale(theScale); }
 
   //! Returns scaled quaternion
-  Standard_NODISCARD gp_Quaternion Scaled(const Standard_Real theScale) const
+  Standard_NODISCARD constexpr gp_Quaternion Scaled(const Standard_Real theScale) const noexcept
   {
     return gp_Quaternion(x * theScale, y * theScale, z * theScale, w * theScale);
   }
 
-  Standard_NODISCARD gp_Quaternion operator*(const Standard_Real theScale) const
+  Standard_NODISCARD constexpr gp_Quaternion operator*(const Standard_Real theScale) const noexcept
   {
     return Scaled(theScale);
   }
@@ -219,28 +222,32 @@ public:
   //! Returns quaternion with all components negated.
   //! Note that this operation does not affect neither
   //! rotation operator defined by quaternion nor its norm.
-  Standard_NODISCARD gp_Quaternion Negated() const { return gp_Quaternion(-x, -y, -z, -w); }
+  Standard_NODISCARD constexpr gp_Quaternion Negated() const noexcept
+  {
+    return gp_Quaternion(-x, -y, -z, -w);
+  }
 
-  Standard_NODISCARD gp_Quaternion operator-() const { return Negated(); }
+  Standard_NODISCARD constexpr gp_Quaternion operator-() const noexcept { return Negated(); }
 
   //! Makes sum of quaternion components; result is "rotations mix"
-  Standard_NODISCARD gp_Quaternion Added(const gp_Quaternion& theOther) const
+  Standard_NODISCARD constexpr gp_Quaternion Added(const gp_Quaternion& theOther) const noexcept
   {
     return gp_Quaternion(x + theOther.x, y + theOther.y, z + theOther.z, w + theOther.w);
   }
 
-  Standard_NODISCARD gp_Quaternion operator+(const gp_Quaternion& theOther) const
+  Standard_NODISCARD constexpr gp_Quaternion operator+(const gp_Quaternion& theOther) const noexcept
   {
     return Added(theOther);
   }
 
   //! Makes difference of quaternion components; result is "rotations mix"
-  Standard_NODISCARD gp_Quaternion Subtracted(const gp_Quaternion& theOther) const
+  Standard_NODISCARD constexpr gp_Quaternion Subtracted(
+    const gp_Quaternion& theOther) const noexcept
   {
     return gp_Quaternion(x - theOther.x, y - theOther.y, z - theOther.z, w - theOther.w);
   }
 
-  Standard_NODISCARD gp_Quaternion operator-(const gp_Quaternion& theOther) const
+  Standard_NODISCARD constexpr gp_Quaternion operator-(const gp_Quaternion& theOther) const noexcept
   {
     return Subtracted(theOther);
   }
@@ -255,20 +262,21 @@ public:
   //! qq' != q'q;
   //! qq^-1 = q;
   //! @endcode
-  Standard_NODISCARD gp_Quaternion Multiplied(const gp_Quaternion& theOther) const;
+  Standard_NODISCARD constexpr gp_Quaternion Multiplied(
+    const gp_Quaternion& theOther) const noexcept;
 
-  Standard_NODISCARD gp_Quaternion operator*(const gp_Quaternion& theOther) const
+  Standard_NODISCARD constexpr gp_Quaternion operator*(const gp_Quaternion& theOther) const noexcept
   {
     return Multiplied(theOther);
   }
 
   //! Adds components of other quaternion; result is "rotations mix"
-  void Add(const gp_Quaternion& theOther);
+  constexpr void Add(const gp_Quaternion& theOther) noexcept;
 
   void operator+=(const gp_Quaternion& theOther) { Add(theOther); }
 
   //! Subtracts components of other quaternion; result is "rotations mix"
-  void Subtract(const gp_Quaternion& theOther);
+  constexpr void Subtract(const gp_Quaternion& theOther) noexcept;
 
   void operator-=(const gp_Quaternion& theOther) { Subtract(theOther); }
 
@@ -281,7 +289,7 @@ public:
   void operator*=(const gp_Quaternion& theOther) { Multiply(theOther); }
 
   //! Computes inner product / scalar product / Dot
-  Standard_Real Dot(const gp_Quaternion& theOther) const
+  constexpr Standard_Real Dot(const gp_Quaternion& theOther) const noexcept
   {
     return x * theOther.x + y * theOther.y + z * theOther.z + w * theOther.w;
   }
@@ -303,10 +311,10 @@ private:
 
 //=================================================================================================
 
-inline void gp_Quaternion::Set(Standard_Real theX,
-                               Standard_Real theY,
-                               Standard_Real theZ,
-                               Standard_Real theW)
+inline constexpr void gp_Quaternion::Set(Standard_Real theX,
+                                         Standard_Real theY,
+                                         Standard_Real theZ,
+                                         Standard_Real theW) noexcept
 {
   this->x = theX;
   this->y = theY;
@@ -316,7 +324,7 @@ inline void gp_Quaternion::Set(Standard_Real theX,
 
 //=================================================================================================
 
-inline void gp_Quaternion::Set(const gp_Quaternion& theQuaternion)
+inline constexpr void gp_Quaternion::Set(const gp_Quaternion& theQuaternion) noexcept
 {
   x = theQuaternion.x;
   y = theQuaternion.y;
@@ -326,7 +334,7 @@ inline void gp_Quaternion::Set(const gp_Quaternion& theQuaternion)
 
 //=================================================================================================
 
-inline void gp_Quaternion::Scale(const Standard_Real theScale)
+inline constexpr void gp_Quaternion::Scale(const Standard_Real theScale) noexcept
 {
   x *= theScale;
   y *= theScale;
@@ -336,7 +344,7 @@ inline void gp_Quaternion::Scale(const Standard_Real theScale)
 
 //=================================================================================================
 
-inline gp_Quaternion gp_Quaternion::Multiplied(const gp_Quaternion& theQ) const
+inline constexpr gp_Quaternion gp_Quaternion::Multiplied(const gp_Quaternion& theQ) const noexcept
 {
   return gp_Quaternion(w * theQ.x + x * theQ.w + y * theQ.z - z * theQ.y,
                        w * theQ.y + y * theQ.w + z * theQ.x - x * theQ.z,
@@ -347,7 +355,7 @@ inline gp_Quaternion gp_Quaternion::Multiplied(const gp_Quaternion& theQ) const
 
 //=================================================================================================
 
-inline void gp_Quaternion::Add(const gp_Quaternion& theQ)
+inline constexpr void gp_Quaternion::Add(const gp_Quaternion& theQ) noexcept
 {
   x += theQ.x;
   y += theQ.y;
@@ -357,7 +365,7 @@ inline void gp_Quaternion::Add(const gp_Quaternion& theQ)
 
 //=================================================================================================
 
-inline void gp_Quaternion::Subtract(const gp_Quaternion& theQ)
+inline constexpr void gp_Quaternion::Subtract(const gp_Quaternion& theQ) noexcept
 {
   x -= theQ.x;
   y -= theQ.y;
index 70cd405789a57cb0e7d5827eb1a0ed582bad0c48..7706bdfd886b5d4aec488c2d14bf5e0fd788e4b2 100644 (file)
@@ -61,7 +61,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Returns the identity transformation.
-  gp_Trsf();
+  constexpr gp_Trsf() noexcept;
 
   //! Creates  a 3D transformation from the 2D transformation theT.
   //! The resulting transformation has a homogeneous
@@ -187,7 +187,7 @@ public:
   //! Raises ConstructionError  If theS is null.
   Standard_EXPORT void SetScaleFactor(const Standard_Real theS);
 
-  void SetForm(const gp_TrsfForm theP) { shape = theP; }
+  constexpr void SetForm(const gp_TrsfForm theP) noexcept { shape = theP; }
 
   //! Sets the coefficients  of the transformation.  The
   //! transformation  of the  point  x,y,z is  the point
@@ -215,19 +215,19 @@ public:
 
   //! Returns true if the determinant of the vectorial part of
   //! this transformation is negative.
-  Standard_Boolean IsNegative() const { return (scale < 0.0); }
+  constexpr Standard_Boolean IsNegative() const noexcept { return (scale < 0.0); }
 
   //! Returns the nature of the transformation. It can be: an
   //! identity transformation, a rotation, a translation, a mirror
   //! transformation (relative to a point, an axis or a plane), a
   //! scaling transformation, or a compound transformation.
-  gp_TrsfForm Form() const { return shape; }
+  constexpr gp_TrsfForm Form() const noexcept { return shape; }
 
   //! Returns the scale factor.
-  Standard_Real ScaleFactor() const { return scale; }
+  constexpr Standard_Real ScaleFactor() const noexcept { return scale; }
 
   //! Returns the translation part of the transformation's matrix
-  const gp_XYZ& TranslationPart() const { return loc; }
+  constexpr const gp_XYZ& TranslationPart() const noexcept { return loc; }
 
   //! Returns the boolean True if there is non-zero rotation.
   //! In the presence of rotation, the output parameters store the axis
@@ -251,7 +251,7 @@ public:
   //! to its homogeneous vectorial part, multiplied by the scale factor.
   //! The coefficients of this matrix must be multiplied by the
   //! scale factor to obtain the coefficients of the transformation.
-  const gp_Mat& HVectorialPart() const { return matrix; }
+  constexpr const gp_Mat& HVectorialPart() const noexcept { return matrix; }
 
   //! Returns the coefficients of the transformation's matrix.
   //! It is a 3 rows * 4 columns matrix.
@@ -318,10 +318,10 @@ public:
     return aT;
   }
 
-  void Transforms(Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const;
+  void Transforms(Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const noexcept;
 
   //! Transformation of a triplet XYZ with a Trsf
-  void Transforms(gp_XYZ& theCoord) const;
+  void Transforms(gp_XYZ& theCoord) const noexcept;
 
   //! Convert transformation to 4x4 matrix.
   template <class T>
@@ -377,7 +377,7 @@ private:
 
 //=================================================================================================
 
-inline gp_Trsf::gp_Trsf()
+inline constexpr gp_Trsf::gp_Trsf() noexcept
     : scale(1.0),
       shape(gp_Identity),
       matrix(1, 0, 0, 0, 1, 0, 0, 0, 1),
@@ -434,7 +434,9 @@ inline Standard_Real gp_Trsf::Value(const Standard_Integer theRow,
 
 //=================================================================================================
 
-inline void gp_Trsf::Transforms(Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const
+inline void gp_Trsf::Transforms(Standard_Real& theX,
+                                Standard_Real& theY,
+                                Standard_Real& theZ) const noexcept
 {
   gp_XYZ aTriplet(theX, theY, theZ);
   aTriplet.Multiply(matrix);
@@ -450,7 +452,7 @@ inline void gp_Trsf::Transforms(Standard_Real& theX, Standard_Real& theY, Standa
 
 //=================================================================================================
 
-inline void gp_Trsf::Transforms(gp_XYZ& theCoord) const
+inline void gp_Trsf::Transforms(gp_XYZ& theCoord) const noexcept
 {
   theCoord.Multiply(matrix);
   if (scale != 1.0)
index e69aac3b2d3ad5fc61b481361f85d8d0d8f224c9..27c67ffa34e14d55aca25936fd5742feb87ab2a3 100644 (file)
@@ -47,7 +47,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Returns identity transformation.
-  gp_Trsf2d();
+  constexpr gp_Trsf2d() noexcept;
 
   //! Creates a 2d transformation in the XY plane from a
   //! 3d transformation .
@@ -97,19 +97,19 @@ public:
 
   //! Returns true if the determinant of the vectorial part of
   //! this transformation is negative..
-  Standard_Boolean IsNegative() const { return (matrix.Determinant() < 0.0); }
+  constexpr Standard_Boolean IsNegative() const noexcept { return (matrix.Determinant() < 0.0); }
 
   //! Returns the nature of the transformation. It can be  an
   //! identity transformation, a rotation, a translation, a mirror
   //! (relative to a point or an axis), a scaling transformation,
   //! or a compound transformation.
-  gp_TrsfForm Form() const { return shape; }
+  constexpr gp_TrsfForm Form() const noexcept { return shape; }
 
   //! Returns the scale factor.
-  Standard_Real ScaleFactor() const { return scale; }
+  constexpr Standard_Real ScaleFactor() const noexcept { return scale; }
 
   //! Returns the translation part of the transformation's matrix
-  const gp_XY& TranslationPart() const { return loc; }
+  constexpr const gp_XY& TranslationPart() const noexcept { return loc; }
 
   //! Returns the vectorial part of the transformation. It is a
   //! 2*2 matrix which includes the scale factor.
@@ -119,7 +119,7 @@ public:
   //! It is a 2*2 matrix which doesn't include the scale factor.
   //! The coefficients of this matrix must be multiplied by the
   //! scale factor to obtain the coefficients of the transformation.
-  const gp_Mat2d& HVectorialPart() const { return matrix; }
+  constexpr const gp_Mat2d& HVectorialPart() const noexcept { return matrix; }
 
   //! Returns the angle corresponding to the rotational component
   //! of the transformation matrix (operation opposite to SetRotation()).
@@ -178,10 +178,10 @@ public:
     return aT;
   }
 
-  void Transforms(Standard_Real& theX, Standard_Real& theY) const;
+  void Transforms(Standard_Real& theX, Standard_Real& theY) const noexcept;
 
   //! Transforms  a doublet XY with a Trsf2d
-  void Transforms(gp_XY& theCoord) const;
+  void Transforms(gp_XY& theCoord) const noexcept;
 
   //! Sets the coefficients  of the transformation. The
   //! transformation  of the  point  x,y is  the point
@@ -218,12 +218,13 @@ private:
 
 //=================================================================================================
 
-inline gp_Trsf2d::gp_Trsf2d()
+inline constexpr gp_Trsf2d::gp_Trsf2d() noexcept
+    : scale(1.0),
+      shape(gp_Identity),
+      matrix(),
+      loc(0.0, 0.0)
 {
-  shape = gp_Identity;
-  scale = 1.0;
   matrix.SetIdentity();
-  loc.SetCoord(0.0, 0.0);
 }
 
 //=================================================================================================
@@ -313,7 +314,7 @@ inline Standard_Real gp_Trsf2d::Value(const Standard_Integer theRow,
 
 //=================================================================================================
 
-inline void gp_Trsf2d::Transforms(Standard_Real& theX, Standard_Real& theY) const
+inline void gp_Trsf2d::Transforms(Standard_Real& theX, Standard_Real& theY) const noexcept
 {
   gp_XY aDoublet(theX, theY);
   aDoublet.Multiply(matrix);
@@ -327,7 +328,7 @@ inline void gp_Trsf2d::Transforms(Standard_Real& theX, Standard_Real& theY) cons
 
 //=================================================================================================
 
-inline void gp_Trsf2d::Transforms(gp_XY& theCoord) const
+inline void gp_Trsf2d::Transforms(gp_XY& theCoord) const noexcept
 {
   theCoord.Multiply(matrix);
   if (scale != 1.0)
index 26f75c26c7e69f3e7f6ce8aa97708ced475c58b5..96b44d4a690957d2b24eff39256ff6b0471f4c8c 100644 (file)
@@ -32,19 +32,21 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates a zero vector.
-  gp_Vec() {}
+  constexpr gp_Vec() noexcept {}
 
   //! Creates a unitary vector from a direction theV.
   gp_Vec(const gp_Dir& theV);
 
   //! Creates a vector with a triplet of coordinates.
-  gp_Vec(const gp_XYZ& theCoord)
+  constexpr gp_Vec(const gp_XYZ& theCoord) noexcept
       : coord(theCoord)
   {
   }
 
   //! Creates a point with its three cartesian coordinates.
-  gp_Vec(const Standard_Real theXv, const Standard_Real theYv, const Standard_Real theZv)
+  constexpr gp_Vec(const Standard_Real theXv,
+                   const Standard_Real theYv,
+                   const Standard_Real theZv) noexcept
       : coord(theXv, theYv, theZv)
   {
   }
@@ -65,7 +67,9 @@ public:
 
   //! For this vector, assigns
   //! -   the values theXv, theYv and theZv to its three coordinates.
-  void SetCoord(const Standard_Real theXv, const Standard_Real theYv, const Standard_Real theZv)
+  constexpr void SetCoord(const Standard_Real theXv,
+                          const Standard_Real theYv,
+                          const Standard_Real theZv) noexcept
   {
     coord.SetX(theXv);
     coord.SetY(theYv);
@@ -73,16 +77,16 @@ public:
   }
 
   //! Assigns the given value to the X coordinate of this vector.
-  void SetX(const Standard_Real theX) { coord.SetX(theX); }
+  constexpr void SetX(const Standard_Real theX) noexcept { coord.SetX(theX); }
 
   //! Assigns the given value to the X coordinate of this vector.
-  void SetY(const Standard_Real theY) { coord.SetY(theY); }
+  constexpr void SetY(const Standard_Real theY) noexcept { coord.SetY(theY); }
 
   //! Assigns the given value to the X coordinate of this vector.
-  void SetZ(const Standard_Real theZ) { coord.SetZ(theZ); }
+  constexpr void SetZ(const Standard_Real theZ) noexcept { coord.SetZ(theZ); }
 
   //! Assigns the three coordinates of theCoord to this vector.
-  void SetXYZ(const gp_XYZ& theCoord) { coord = theCoord; }
+  constexpr void SetXYZ(const gp_XYZ& theCoord) noexcept { coord = theCoord; }
 
   //! Returns the coordinate of range theIndex :
   //! theIndex = 1 => X is returned
@@ -92,7 +96,9 @@ public:
   Standard_Real Coord(const Standard_Integer theIndex) const { return coord.Coord(theIndex); }
 
   //! For this vector returns its three coordinates theXv, theYv, and theZv inline
-  void Coord(Standard_Real& theXv, Standard_Real& theYv, Standard_Real& theZv) const
+  constexpr void Coord(Standard_Real& theXv,
+                       Standard_Real& theYv,
+                       Standard_Real& theZv) const noexcept
   {
     theXv = coord.X();
     theYv = coord.Y();
@@ -100,17 +106,17 @@ public:
   }
 
   //! For this vector, returns its X coordinate.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! For this vector, returns its Y coordinate.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! For this vector, returns its Z  coordinate.
-  Standard_Real Z() const { return coord.Z(); }
+  constexpr Standard_Real Z() const noexcept { return coord.Z(); }
 
   //! For this vector, returns
   //! -   its three coordinates as a number triple
-  const gp_XYZ& XYZ() const { return coord; }
+  constexpr const gp_XYZ& XYZ() const noexcept { return coord; }
 
   //! Returns True if the two vectors have the same magnitude value
   //! and the same direction. The precision values are theLinearTolerance
@@ -172,88 +178,97 @@ public:
   Standard_Real Magnitude() const { return coord.Modulus(); }
 
   //! Computes the square magnitude of this vector.
-  Standard_Real SquareMagnitude() const { return coord.SquareModulus(); }
+  constexpr Standard_Real SquareMagnitude() const noexcept { return coord.SquareModulus(); }
 
   //! Adds two vectors
-  void Add(const gp_Vec& theOther) { coord.Add(theOther.coord); }
+  constexpr void Add(const gp_Vec& theOther) noexcept { coord.Add(theOther.coord); }
 
-  void operator+=(const gp_Vec& theOther) { Add(theOther); }
+  constexpr void operator+=(const gp_Vec& theOther) noexcept { Add(theOther); }
 
   //! Adds two vectors
-  Standard_NODISCARD gp_Vec Added(const gp_Vec& theOther) const
+  Standard_NODISCARD constexpr gp_Vec Added(const gp_Vec& theOther) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Add(theOther.coord);
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator+(const gp_Vec& theOther) const { return Added(theOther); }
+  Standard_NODISCARD constexpr gp_Vec operator+(const gp_Vec& theOther) const noexcept
+  {
+    return Added(theOther);
+  }
 
   //! Subtracts two vectors
-  void Subtract(const gp_Vec& theRight) { coord.Subtract(theRight.coord); }
+  constexpr void Subtract(const gp_Vec& theRight) noexcept { coord.Subtract(theRight.coord); }
 
-  void operator-=(const gp_Vec& theRight) { Subtract(theRight); }
+  constexpr void operator-=(const gp_Vec& theRight) noexcept { Subtract(theRight); }
 
   //! Subtracts two vectors
-  Standard_NODISCARD gp_Vec Subtracted(const gp_Vec& theRight) const
+  Standard_NODISCARD constexpr gp_Vec Subtracted(const gp_Vec& theRight) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Subtract(theRight.coord);
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator-(const gp_Vec& theRight) const { return Subtracted(theRight); }
+  Standard_NODISCARD constexpr gp_Vec operator-(const gp_Vec& theRight) const noexcept
+  {
+    return Subtracted(theRight);
+  }
 
   //! Multiplies a vector by a scalar
-  void Multiply(const Standard_Real theScalar) { coord.Multiply(theScalar); }
+  constexpr void Multiply(const Standard_Real theScalar) noexcept { coord.Multiply(theScalar); }
 
-  void operator*=(const Standard_Real theScalar) { Multiply(theScalar); }
+  constexpr void operator*=(const Standard_Real theScalar) noexcept { Multiply(theScalar); }
 
   //! Multiplies a vector by a scalar
-  Standard_NODISCARD gp_Vec Multiplied(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Vec Multiplied(const Standard_Real theScalar) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Multiply(theScalar);
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator*(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Vec operator*(const Standard_Real theScalar) const noexcept
   {
     return Multiplied(theScalar);
   }
 
   //! Divides a vector by a scalar
-  void Divide(const Standard_Real theScalar) { coord.Divide(theScalar); }
+  constexpr void Divide(const Standard_Real theScalar) { coord.Divide(theScalar); }
 
-  void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
+  constexpr void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
 
   //! Divides a vector by a scalar
-  Standard_NODISCARD gp_Vec Divided(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Vec Divided(const Standard_Real theScalar) const
   {
     gp_Vec aV = *this;
     aV.coord.Divide(theScalar);
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator/(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_Vec operator/(const Standard_Real theScalar) const
   {
     return Divided(theScalar);
   }
 
   //! computes the cross product between two vectors
-  void Cross(const gp_Vec& theRight) { coord.Cross(theRight.coord); }
+  constexpr void Cross(const gp_Vec& theRight) noexcept { coord.Cross(theRight.coord); }
 
-  void operator^=(const gp_Vec& theRight) { Cross(theRight); }
+  constexpr void operator^=(const gp_Vec& theRight) noexcept { Cross(theRight); }
 
   //! computes the cross product between two vectors
-  Standard_NODISCARD gp_Vec Crossed(const gp_Vec& theRight) const
+  Standard_NODISCARD constexpr gp_Vec Crossed(const gp_Vec& theRight) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Cross(theRight.coord);
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator^(const gp_Vec& theRight) const { return Crossed(theRight); }
+  Standard_NODISCARD constexpr gp_Vec operator^(const gp_Vec& theRight) const noexcept
+  {
+    return Crossed(theRight);
+  }
 
   //! Computes the magnitude of the cross
   //! product between <me> and theRight.
@@ -266,21 +281,22 @@ public:
   //! Computes the square magnitude of
   //! the cross product between <me> and theRight.
   //! Returns || <me> ^ theRight ||**2
-  Standard_Real CrossSquareMagnitude(const gp_Vec& theRight) const
+  constexpr Standard_Real CrossSquareMagnitude(const gp_Vec& theRight) const noexcept
   {
     return coord.CrossSquareMagnitude(theRight.coord);
   }
 
   //! Computes the triple vector product.
   //! <me> ^= (theV1 ^ theV2)
-  void CrossCross(const gp_Vec& theV1, const gp_Vec& theV2)
+  constexpr void CrossCross(const gp_Vec& theV1, const gp_Vec& theV2) noexcept
   {
     coord.CrossCross(theV1.coord, theV2.coord);
   }
 
   //! Computes the triple vector product.
   //! <me> ^ (theV1 ^ theV2)
-  Standard_NODISCARD gp_Vec CrossCrossed(const gp_Vec& theV1, const gp_Vec& theV2) const
+  Standard_NODISCARD constexpr gp_Vec CrossCrossed(const gp_Vec& theV1,
+                                                   const gp_Vec& theV2) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.CrossCross(theV1.coord, theV2.coord);
@@ -288,12 +304,15 @@ public:
   }
 
   //! computes the scalar product
-  Standard_Real Dot(const gp_Vec& theOther) const { return coord.Dot(theOther.coord); }
+  constexpr Standard_Real Dot(const gp_Vec& theOther) const noexcept
+  {
+    return coord.Dot(theOther.coord);
+  }
 
-  Standard_Real operator*(const gp_Vec& theOther) const { return Dot(theOther); }
+  constexpr Standard_Real operator*(const gp_Vec& theOther) const noexcept { return Dot(theOther); }
 
   //! Computes the triple scalar product <me> * (theV1 ^ theV2).
-  Standard_Real DotCross(const gp_Vec& theV1, const gp_Vec& theV2) const
+  constexpr Standard_Real DotCross(const gp_Vec& theV1, const gp_Vec& theV2) const noexcept
   {
     return coord.DotCross(theV1.coord, theV2.coord);
   }
@@ -315,72 +334,74 @@ public:
   Standard_NODISCARD gp_Vec Normalized() const;
 
   //! Reverses the direction of a vector
-  void Reverse() { coord.Reverse(); }
+  constexpr void Reverse() noexcept { coord.Reverse(); }
 
   //! Reverses the direction of a vector
-  Standard_NODISCARD gp_Vec Reversed() const
+  Standard_NODISCARD constexpr gp_Vec Reversed() const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Reverse();
     return aV;
   }
 
-  Standard_NODISCARD gp_Vec operator-() const { return Reversed(); }
+  Standard_NODISCARD constexpr gp_Vec operator-() const noexcept { return Reversed(); }
 
   //! <me> is set to the following linear form :
   //! theA1 * theV1 + theA2 * theV2 + theA3 * theV3 + theV4
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_Vec&       theV1,
-                     const Standard_Real theA2,
-                     const gp_Vec&       theV2,
-                     const Standard_Real theA3,
-                     const gp_Vec&       theV3,
-                     const gp_Vec&       theV4)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_Vec&       theV1,
+                               const Standard_Real theA2,
+                               const gp_Vec&       theV2,
+                               const Standard_Real theA3,
+                               const gp_Vec&       theV3,
+                               const gp_Vec&       theV4) noexcept
   {
     coord.SetLinearForm(theA1, theV1.coord, theA2, theV2.coord, theA3, theV3.coord, theV4.coord);
   }
 
   //! <me> is set to the following linear form :
   //! theA1 * theV1 + theA2 * theV2 + theA3 * theV3
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_Vec&       theV1,
-                     const Standard_Real theA2,
-                     const gp_Vec&       theV2,
-                     const Standard_Real theA3,
-                     const gp_Vec&       theV3)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_Vec&       theV1,
+                               const Standard_Real theA2,
+                               const gp_Vec&       theV2,
+                               const Standard_Real theA3,
+                               const gp_Vec&       theV3) noexcept
   {
     coord.SetLinearForm(theA1, theV1.coord, theA2, theV2.coord, theA3, theV3.coord);
   }
 
   //! <me> is set to the following linear form :
   //! theA1 * theV1 + theA2 * theV2 + theV3
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_Vec&       theV1,
-                     const Standard_Real theA2,
-                     const gp_Vec&       theV2,
-                     const gp_Vec&       theV3)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_Vec&       theV1,
+                               const Standard_Real theA2,
+                               const gp_Vec&       theV2,
+                               const gp_Vec&       theV3) noexcept
   {
     coord.SetLinearForm(theA1, theV1.coord, theA2, theV2.coord, theV3.coord);
   }
 
   //! <me> is set to the following linear form :
   //! theA1 * theV1 + theA2 * theV2
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_Vec&       theV1,
-                     const Standard_Real theA2,
-                     const gp_Vec&       theV2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_Vec&       theV1,
+                               const Standard_Real theA2,
+                               const gp_Vec&       theV2) noexcept
   {
     coord.SetLinearForm(theA1, theV1.coord, theA2, theV2.coord);
   }
 
   //! <me> is set to the following linear form : theA1 * theV1 + theV2
-  void SetLinearForm(const Standard_Real theA1, const gp_Vec& theV1, const gp_Vec& theV2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_Vec&       theV1,
+                               const gp_Vec&       theV2) noexcept
   {
     coord.SetLinearForm(theA1, theV1.coord, theV2.coord);
   }
 
   //! <me> is set to the following linear form : theV1 + theV2
-  void SetLinearForm(const gp_Vec& theV1, const gp_Vec& theV2)
+  constexpr void SetLinearForm(const gp_Vec& theV1, const gp_Vec& theV2) noexcept
   {
     coord.SetLinearForm(theV1.coord, theV2.coord);
   }
@@ -417,10 +438,10 @@ public:
     return aVres;
   }
 
-  void Scale(const Standard_Real theS) { coord.Multiply(theS); }
+  constexpr void Scale(const Standard_Real theS) noexcept { coord.Multiply(theS); }
 
   //! Scales a vector. theS is the scaling value.
-  Standard_NODISCARD gp_Vec Scaled(const Standard_Real theS) const
+  Standard_NODISCARD constexpr gp_Vec Scaled(const Standard_Real theS) const noexcept
   {
     gp_Vec aV = *this;
     aV.coord.Multiply(theS);
@@ -518,7 +539,7 @@ inline void gp_Vec::Rotate(const gp_Ax1& theA1, const Standard_Real theAng)
 // function :  operator*
 // purpose :
 //=======================================================================
-inline gp_Vec operator*(const Standard_Real theScalar, const gp_Vec& theV)
+inline constexpr gp_Vec operator*(const Standard_Real theScalar, const gp_Vec& theV) noexcept
 {
   return theV.Multiplied(theScalar);
 }
index b9540beded2b6014df2f09c692d07f02fcf8894c..8ce21202139a09f975678968abb673db961020be 100644 (file)
@@ -86,13 +86,13 @@ public:
   void Coord(Standard_Real& theXv, Standard_Real& theYv) const { coord.Coord(theXv, theYv); }
 
   //! For this vector, returns its X  coordinate.
-  Standard_Real X() const { return coord.X(); }
+  constexpr Standard_Real X() const noexcept { return coord.X(); }
 
   //! For this vector, returns its Y  coordinate.
-  Standard_Real Y() const { return coord.Y(); }
+  constexpr Standard_Real Y() const noexcept { return coord.Y(); }
 
   //! For this vector, returns its two coordinates as a number pair
-  const gp_XY& XY() const { return coord; }
+  constexpr const gp_XY& XY() const noexcept { return coord; }
 
   //! Returns True if the two vectors have the same magnitude value
   //! and the same direction. The precision values are theLinearTolerance
index 40a42eaa4507758e8acdcc43fe6c6ba29fcf7481..57f2bf70a66868a7b712135c825971af1bb7ad5b 100644 (file)
@@ -32,14 +32,14 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates XY object with zero coordinates (0,0).
-  gp_XY()
+  constexpr gp_XY() noexcept
       : x(0.),
         y(0.)
   {
   }
 
   //! a number pair defined by the XY coordinates
-  gp_XY(const Standard_Real theX, const Standard_Real theY)
+  constexpr gp_XY(const Standard_Real theX, const Standard_Real theY) noexcept
       : x(theX),
         y(theY)
   {
@@ -57,17 +57,17 @@ public:
 
   //! For this number pair, assigns
   //! the values theX and theY to its coordinates
-  inline void SetCoord(const Standard_Real theX, const Standard_Real theY)
+  constexpr void SetCoord(const Standard_Real theX, const Standard_Real theY) noexcept
   {
     x = theX;
     y = theY;
   }
 
   //! Assigns the given value to the X coordinate of this number pair.
-  void SetX(const Standard_Real theX) { x = theX; }
+  constexpr void SetX(const Standard_Real theX) noexcept { x = theX; }
 
   //! Assigns the given value to the Y  coordinate of this number pair.
-  void SetY(const Standard_Real theY) { y = theY; }
+  constexpr void SetY(const Standard_Real theY) noexcept { y = theY; }
 
   //! returns the coordinate of range theIndex :
   //! theIndex = 1 => X is returned
@@ -86,23 +86,23 @@ public:
   }
 
   //! For this number pair, returns its coordinates X and Y.
-  inline void Coord(Standard_Real& theX, Standard_Real& theY) const
+  constexpr void Coord(Standard_Real& theX, Standard_Real& theY) const noexcept
   {
     theX = x;
     theY = y;
   }
 
   //! Returns the X coordinate of this number pair.
-  Standard_Real X() const { return x; }
+  constexpr Standard_Real X() const noexcept { return x; }
 
   //! Returns the Y coordinate of this number pair.
-  Standard_Real Y() const { return y; }
+  constexpr Standard_Real Y() const noexcept { return y; }
 
   //! Computes Sqrt (X*X + Y*Y) where X and Y are the two coordinates of this number pair.
   Standard_Real Modulus() const { return sqrt(SquareModulus()); }
 
   //! Computes X*X + Y*Y where X and Y are the two coordinates of this number pair.
-  Standard_Real SquareModulus() const { return x * x + y * y; }
+  constexpr Standard_Real SquareModulus() const noexcept { return x * x + y * y; }
 
   //! Returns true if the coordinates of this number pair are
   //! equal to the respective coordinates of the number pair
@@ -117,118 +117,124 @@ public:
   //! <me>.X() = <me>.X() + theOther.X()
   //! <me>.Y() = <me>.Y() + theOther.Y()
   //! @endcode
-  inline void Add(const gp_XY& theOther)
+  constexpr void Add(const gp_XY& theOther) noexcept
   {
     x += theOther.x;
     y += theOther.y;
   }
 
-  void operator+=(const gp_XY& theOther) { Add(theOther); }
+  constexpr void operator+=(const gp_XY& theOther) noexcept { Add(theOther); }
 
   //! Computes the sum of this number pair and number pair theOther
   //! @code
   //! new.X() = <me>.X() + theOther.X()
   //! new.Y() = <me>.Y() + theOther.Y()
   //! @endcode
-  Standard_NODISCARD gp_XY Added(const gp_XY& theOther) const
+  Standard_NODISCARD constexpr gp_XY Added(const gp_XY& theOther) const noexcept
   {
     return gp_XY(x + theOther.X(), y + theOther.Y());
   }
 
-  Standard_NODISCARD gp_XY operator+(const gp_XY& theOther) const { return Added(theOther); }
+  Standard_NODISCARD constexpr gp_XY operator+(const gp_XY& theOther) const noexcept
+  {
+    return Added(theOther);
+  }
 
   //! @code
   //! double D = <me>.X() * theOther.Y() - <me>.Y() * theOther.X()
   //! @endcode
-  Standard_NODISCARD Standard_Real Crossed(const gp_XY& theOther) const
+  Standard_NODISCARD constexpr Standard_Real Crossed(const gp_XY& theOther) const noexcept
   {
     return x * theOther.y - y * theOther.x;
   }
 
-  Standard_NODISCARD Standard_Real operator^(const gp_XY& theOther) const
+  Standard_NODISCARD constexpr Standard_Real operator^(const gp_XY& theOther) const noexcept
   {
     return Crossed(theOther);
   }
 
   //! computes the magnitude of the cross product between <me> and
   //! theRight. Returns || <me> ^ theRight ||
-  inline Standard_Real CrossMagnitude(const gp_XY& theRight) const
+  Standard_Real CrossMagnitude(const gp_XY& theRight) const
   {
     return Abs(x * theRight.y - y * theRight.x);
   }
 
   //! computes the square magnitude of the cross product between <me> and
   //! theRight. Returns || <me> ^ theRight ||**2
-  inline Standard_Real CrossSquareMagnitude(const gp_XY& theRight) const
+  constexpr Standard_Real CrossSquareMagnitude(const gp_XY& theRight) const noexcept
   {
     const Standard_Real aZresult = x * theRight.y - y * theRight.x;
     return aZresult * aZresult;
   }
 
   //! divides <me> by a real.
-  void Divide(const Standard_Real theScalar)
+  constexpr void Divide(const Standard_Real theScalar)
   {
     x /= theScalar;
     y /= theScalar;
   }
 
-  void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
+  constexpr void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
 
   //! Divides <me> by a real.
-  Standard_NODISCARD gp_XY Divided(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XY Divided(const Standard_Real theScalar) const
   {
     return gp_XY(x / theScalar, y / theScalar);
   }
 
-  Standard_NODISCARD gp_XY operator/(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XY operator/(const Standard_Real theScalar) const
   {
     return Divided(theScalar);
   }
 
   //! Computes the scalar product between <me> and theOther
-  Standard_Real Dot(const gp_XY& theOther) const { return x * theOther.x + y * theOther.y; }
+  constexpr Standard_Real Dot(const gp_XY& theOther) const noexcept
+  {
+    return x * theOther.x + y * theOther.y;
+  }
 
-  Standard_Real operator*(const gp_XY& theOther) const { return Dot(theOther); }
+  constexpr Standard_Real operator*(const gp_XY& theOther) const noexcept { return Dot(theOther); }
 
   //! @code
   //! <me>.X() = <me>.X() * theScalar;
   //! <me>.Y() = <me>.Y() * theScalar;
   //! @endcode
-  void Multiply(const Standard_Real theScalar)
+  constexpr void Multiply(const Standard_Real theScalar) noexcept
   {
     x *= theScalar;
     y *= theScalar;
   }
 
-  void operator*=(const Standard_Real theScalar) { Multiply(theScalar); }
+  constexpr void operator*=(const Standard_Real theScalar) noexcept { Multiply(theScalar); }
 
   //! @code
   //! <me>.X() = <me>.X() * theOther.X();
   //! <me>.Y() = <me>.Y() * theOther.Y();
   //! @endcode
-  void Multiply(const gp_XY& theOther)
+  constexpr void Multiply(const gp_XY& theOther) noexcept
   {
     x *= theOther.x;
     y *= theOther.y;
   }
 
-  void operator*=(const gp_XY& theOther) { Multiply(theOther); }
+  constexpr void operator*=(const gp_XY& theOther) noexcept { Multiply(theOther); }
 
   //! <me> = theMatrix * <me>
-  void Multiply(const gp_Mat2d& theMatrix);
+  void Multiply(const gp_Mat2d& theMatrix) noexcept;
 
-  void operator*=(const gp_Mat2d& theMatrix) { Multiply(theMatrix); }
+  void operator*=(const gp_Mat2d& theMatrix) noexcept { Multiply(theMatrix); }
 
   //! @code
   //! New.X() = <me>.X() * theScalar;
   //! New.Y() = <me>.Y() * theScalar;
   //! @endcode
-  Standard_NODISCARD gp_XY Multiplied(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XY Multiplied(const Standard_Real theScalar) const noexcept
   {
     return gp_XY(x * theScalar, y * theScalar);
   }
 
-  Standard_NODISCARD gp_XY operator*(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XY operator*(const Standard_Real theScalar) const noexcept
   {
     return Multiplied(theScalar);
   }
@@ -237,19 +243,19 @@ public:
   //! new.X() = <me>.X() * theOther.X();
   //! new.Y() = <me>.Y() * theOther.Y();
   //! @endcode
-  Standard_NODISCARD gp_XY Multiplied(const gp_XY& theOther) const
+  Standard_NODISCARD constexpr gp_XY Multiplied(const gp_XY& theOther) const noexcept
   {
     return gp_XY(x * theOther.X(), y * theOther.Y());
   }
 
   //! New = theMatrix * <me>
-  Standard_NODISCARD gp_XY Multiplied(const gp_Mat2d& theMatrix) const
+  Standard_NODISCARD gp_XY Multiplied(const gp_Mat2d& theMatrix) const noexcept
   {
     return gp_XY(theMatrix.myMat[0][0] * x + theMatrix.myMat[0][1] * y,
                  theMatrix.myMat[1][0] * x + theMatrix.myMat[1][1] * y);
   }
 
-  Standard_NODISCARD gp_XY operator*(const gp_Mat2d& theMatrix) const
+  Standard_NODISCARD gp_XY operator*(const gp_Mat2d& theMatrix) const noexcept
   {
     return Multiplied(theMatrix);
   }
@@ -277,7 +283,7 @@ public:
   //! @code
   //! <me>.X() = -<me>.X()
   //! <me>.Y() = -<me>.Y()
-  inline void Reverse()
+  constexpr void Reverse() noexcept
   {
     x = -x;
     y = -y;
@@ -287,24 +293,19 @@ public:
   //! New.X() = -<me>.X()
   //! New.Y() = -<me>.Y()
   //! @endcode
-  Standard_NODISCARD gp_XY Reversed() const
-  {
-    gp_XY aCoord2D = *this;
-    aCoord2D.Reverse();
-    return aCoord2D;
-  }
+  Standard_NODISCARD constexpr gp_XY Reversed() const noexcept { return gp_XY(-x, -y); }
 
-  Standard_NODISCARD gp_XY operator-() const { return Reversed(); }
+  Standard_NODISCARD constexpr gp_XY operator-() const noexcept { return Reversed(); }
 
   //! Computes  the following linear combination and
   //! assigns the result to this number pair:
   //! @code
   //! theA1 * theXY1 + theA2 * theXY2
   //! @endcode
-  inline void SetLinearForm(const Standard_Real theA1,
-                            const gp_XY&        theXY1,
-                            const Standard_Real theA2,
-                            const gp_XY&        theXY2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XY&        theXY1,
+                               const Standard_Real theA2,
+                               const gp_XY&        theXY2) noexcept
   {
     x = theA1 * theXY1.x + theA2 * theXY2.x;
     y = theA1 * theXY1.y + theA2 * theXY2.y;
@@ -315,11 +316,11 @@ public:
   //! @code
   //! theA1 * theXY1 + theA2 * theXY2 + theXY3
   //! @endcode
-  inline void SetLinearForm(const Standard_Real theA1,
-                            const gp_XY&        theXY1,
-                            const Standard_Real theA2,
-                            const gp_XY&        theXY2,
-                            const gp_XY&        theXY3)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XY&        theXY1,
+                               const Standard_Real theA2,
+                               const gp_XY&        theXY2,
+                               const gp_XY&        theXY3) noexcept
   {
     x = theA1 * theXY1.x + theA2 * theXY2.x + theXY3.x;
     y = theA1 * theXY1.y + theA2 * theXY2.y + theXY3.y;
@@ -330,7 +331,9 @@ public:
   //! @code
   //! theA1 * theXY1 + theXY2
   //! @endcode
-  inline void SetLinearForm(const Standard_Real theA1, const gp_XY& theXY1, const gp_XY& theXY2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XY&        theXY1,
+                               const gp_XY&        theXY2) noexcept
   {
     x = theA1 * theXY1.x + theXY2.x;
     y = theA1 * theXY1.y + theXY2.y;
@@ -341,7 +344,7 @@ public:
   //! @code
   //! theXY1 + theXY2
   //! @endcode
-  inline void SetLinearForm(const gp_XY& theXY1, const gp_XY& theXY2)
+  constexpr void SetLinearForm(const gp_XY& theXY1, const gp_XY& theXY2) noexcept
   {
     x = theXY1.x + theXY2.x;
     y = theXY1.y + theXY2.y;
@@ -351,26 +354,27 @@ public:
   //! <me>.X() = <me>.X() - theOther.X()
   //! <me>.Y() = <me>.Y() - theOther.Y()
   //! @endcode
-  inline void Subtract(const gp_XY& theOther)
+  constexpr void Subtract(const gp_XY& theOther) noexcept
   {
     x -= theOther.x;
     y -= theOther.y;
   }
 
-  void operator-=(const gp_XY& theOther) { Subtract(theOther); }
+  constexpr void operator-=(const gp_XY& theOther) noexcept { Subtract(theOther); }
 
   //! @code
   //! new.X() = <me>.X() - theOther.X()
   //! new.Y() = <me>.Y() - theOther.Y()
   //! @endcode
-  Standard_NODISCARD gp_XY Subtracted(const gp_XY& theOther) const
+  Standard_NODISCARD constexpr gp_XY Subtracted(const gp_XY& theOther) const noexcept
   {
-    gp_XY aCoord2D = *this;
-    aCoord2D.Subtract(theOther);
-    return aCoord2D;
+    return gp_XY(x - theOther.x, y - theOther.y);
   }
 
-  Standard_NODISCARD gp_XY operator-(const gp_XY& theOther) const { return Subtracted(theOther); }
+  Standard_NODISCARD constexpr gp_XY operator-(const gp_XY& theOther) const noexcept
+  {
+    return Subtracted(theOther);
+  }
 
 private:
   Standard_Real x;
@@ -379,7 +383,7 @@ private:
 
 //=================================================================================================
 
-inline void gp_XY::Multiply(const gp_Mat2d& theMatrix)
+inline void gp_XY::Multiply(const gp_Mat2d& theMatrix) noexcept
 {
   const Standard_Real aXresult = theMatrix.myMat[0][0] * x + theMatrix.myMat[0][1] * y;
   y                            = theMatrix.myMat[1][0] * x + theMatrix.myMat[1][1] * y;
@@ -401,7 +405,7 @@ inline void gp_XY::Normalize()
 // function :  operator*
 // purpose :
 //=======================================================================
-inline gp_XY operator*(const gp_Mat2d& theMatrix, const gp_XY& theCoord1)
+inline gp_XY operator*(const gp_Mat2d& theMatrix, const gp_XY& theCoord1) noexcept
 {
   return theCoord1.Multiplied(theMatrix);
 }
@@ -410,7 +414,7 @@ inline gp_XY operator*(const gp_Mat2d& theMatrix, const gp_XY& theCoord1)
 // function :  operator*
 // purpose :
 //=======================================================================
-inline gp_XY operator*(const Standard_Real theScalar, const gp_XY& theCoord1)
+inline constexpr gp_XY operator*(const Standard_Real theScalar, const gp_XY& theCoord1) noexcept
 {
   return theCoord1.Multiplied(theScalar);
 }
index 29140e98facb68b2baf23e5db81d5218c8dfd22d..d6613ed5c6a30f80da3bc16fa5433c6aabba0ab8 100644 (file)
@@ -34,7 +34,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Creates an XYZ object with zero coordinates (0,0,0)
-  gp_XYZ()
+  constexpr gp_XYZ() noexcept
       : x(0.),
         y(0.),
         z(0.)
@@ -42,7 +42,9 @@ public:
   }
 
   //! creates an XYZ with given coordinates
-  gp_XYZ(const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
+  constexpr gp_XYZ(const Standard_Real theX,
+                   const Standard_Real theY,
+                   const Standard_Real theZ) noexcept
       : x(theX),
         y(theY),
         z(theZ)
@@ -51,7 +53,9 @@ public:
 
   //! For this XYZ object, assigns
   //! the values theX, theY and theZ to its three coordinates
-  void SetCoord(const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
+  constexpr void SetCoord(const Standard_Real theX,
+                          const Standard_Real theY,
+                          const Standard_Real theZ) noexcept
   {
     x = theX;
     y = theY;
@@ -70,13 +74,13 @@ public:
   }
 
   //! Assigns the given value to the X coordinate
-  void SetX(const Standard_Real theX) { x = theX; }
+  constexpr void SetX(const Standard_Real theX) noexcept { x = theX; }
 
   //! Assigns the given value to the Y coordinate
-  void SetY(const Standard_Real theY) { y = theY; }
+  constexpr void SetY(const Standard_Real theY) noexcept { y = theY; }
 
   //! Assigns the given value to the Z coordinate
-  void SetZ(const Standard_Real theZ) { z = theZ; }
+  constexpr void SetZ(const Standard_Real theZ) noexcept { z = theZ; }
 
   //! returns the coordinate of range theIndex :
   //! theIndex = 1 => X is returned
@@ -96,7 +100,7 @@ public:
     return (&x)[theIndex - 1];
   }
 
-  void Coord(Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const
+  constexpr void Coord(Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const noexcept
   {
     theX = x;
     theY = y;
@@ -106,27 +110,27 @@ public:
   //! Returns a const ptr to coordinates location.
   //! Is useful for algorithms, but DOES NOT PERFORM
   //! ANY CHECKS!
-  const Standard_Real* GetData() const { return (&x); }
+  constexpr const Standard_Real* GetData() const noexcept { return (&x); }
 
   //! Returns a ptr to coordinates location.
   //! Is useful for algorithms, but DOES NOT PERFORM
   //! ANY CHECKS!
-  Standard_Real* ChangeData() { return (&x); }
+  Standard_Real* ChangeData() noexcept { return (&x); }
 
   //! Returns the X coordinate
-  Standard_Real X() const { return x; }
+  constexpr Standard_Real X() const noexcept { return x; }
 
   //! Returns the Y coordinate
-  Standard_Real Y() const { return y; }
+  constexpr Standard_Real Y() const noexcept { return y; }
 
   //! Returns the Z coordinate
-  Standard_Real Z() const { return z; }
+  constexpr Standard_Real Z() const noexcept { return z; }
 
   //! computes Sqrt (X*X + Y*Y + Z*Z) where X, Y and Z are the three coordinates of this XYZ object.
   Standard_Real Modulus() const { return sqrt(x * x + y * y + z * z); }
 
   //! Computes X*X + Y*Y + Z*Z where X, Y and Z are the three coordinates of this XYZ object.
-  Standard_Real SquareModulus() const { return (x * x + y * y + z * z); }
+  constexpr Standard_Real SquareModulus() const noexcept { return (x * x + y * y + z * z); }
 
   //! Returns True if he coordinates of this XYZ object are
   //! equal to the respective coordinates Other,
@@ -143,49 +147,55 @@ public:
   //! <me>.Y() = <me>.Y() + theOther.Y()
   //! <me>.Z() = <me>.Z() + theOther.Z()
   //! @endcode
-  void Add(const gp_XYZ& theOther)
+  constexpr void Add(const gp_XYZ& theOther) noexcept
   {
     x += theOther.x;
     y += theOther.y;
     z += theOther.z;
   }
 
-  void operator+=(const gp_XYZ& theOther) { Add(theOther); }
+  constexpr void operator+=(const gp_XYZ& theOther) noexcept { Add(theOther); }
 
   //! @code
   //! new.X() = <me>.X() + theOther.X()
   //! new.Y() = <me>.Y() + theOther.Y()
   //! new.Z() = <me>.Z() + theOther.Z()
   //! @endcode
-  Standard_NODISCARD gp_XYZ Added(const gp_XYZ& theOther) const
+  Standard_NODISCARD constexpr gp_XYZ Added(const gp_XYZ& theOther) const noexcept
   {
     return gp_XYZ(x + theOther.x, y + theOther.y, z + theOther.z);
   }
 
-  Standard_NODISCARD gp_XYZ operator+(const gp_XYZ& theOther) const { return Added(theOther); }
+  Standard_NODISCARD constexpr gp_XYZ operator+(const gp_XYZ& theOther) const noexcept
+  {
+    return Added(theOther);
+  }
 
   //! @code
   //! <me>.X() = <me>.Y() * theOther.Z() - <me>.Z() * theOther.Y()
   //! <me>.Y() = <me>.Z() * theOther.X() - <me>.X() * theOther.Z()
   //! <me>.Z() = <me>.X() * theOther.Y() - <me>.Y() * theOther.X()
   //! @endcode
-  void Cross(const gp_XYZ& theOther);
+  constexpr void Cross(const gp_XYZ& theOther) noexcept;
 
-  void operator^=(const gp_XYZ& theOther) { Cross(theOther); }
+  constexpr void operator^=(const gp_XYZ& theOther) noexcept { Cross(theOther); }
 
   //! @code
   //! new.X() = <me>.Y() * theOther.Z() - <me>.Z() * theOther.Y()
   //! new.Y() = <me>.Z() * theOther.X() - <me>.X() * theOther.Z()
   //! new.Z() = <me>.X() * theOther.Y() - <me>.Y() * theOther.X()
   //! @endcode
-  Standard_NODISCARD gp_XYZ Crossed(const gp_XYZ& theOther) const
+  Standard_NODISCARD constexpr gp_XYZ Crossed(const gp_XYZ& theOther) const noexcept
   {
     return gp_XYZ(y * theOther.z - z * theOther.y,
                   z * theOther.x - x * theOther.z,
                   x * theOther.y - y * theOther.x);
   }
 
-  Standard_NODISCARD gp_XYZ operator^(const gp_XYZ& theOther) const { return Crossed(theOther); }
+  Standard_NODISCARD constexpr gp_XYZ operator^(const gp_XYZ& theOther) const noexcept
+  {
+    return Crossed(theOther);
+  }
 
   //! Computes the magnitude of the cross product between <me> and
   //! theRight. Returns || <me> ^ theRight ||
@@ -193,15 +203,16 @@ public:
 
   //! Computes the square magnitude of the cross product between <me> and
   //! theRight. Returns || <me> ^ theRight ||**2
-  Standard_Real CrossSquareMagnitude(const gp_XYZ& theRight) const;
+  constexpr Standard_Real CrossSquareMagnitude(const gp_XYZ& theRight) const noexcept;
 
   //! Triple vector product
   //! Computes <me> = <me>.Cross(theCoord1.Cross(theCoord2))
-  void CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2);
+  constexpr void CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) noexcept;
 
   //! Triple vector product
   //! computes New = <me>.Cross(theCoord1.Cross(theCoord2))
-  Standard_NODISCARD gp_XYZ CrossCrossed(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) const
+  Standard_NODISCARD constexpr gp_XYZ CrossCrossed(const gp_XYZ& theCoord1,
+                                                   const gp_XYZ& theCoord2) const noexcept
   {
     gp_XYZ aCoord0 = *this;
     aCoord0.CrossCross(theCoord1, theCoord2);
@@ -209,81 +220,81 @@ public:
   }
 
   //! divides <me> by a real.
-  void Divide(const Standard_Real theScalar)
+  constexpr void Divide(const Standard_Real theScalar)
   {
     x /= theScalar;
     y /= theScalar;
     z /= theScalar;
   }
 
-  void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
+  constexpr void operator/=(const Standard_Real theScalar) { Divide(theScalar); }
 
   //! divides <me> by a real.
-  Standard_NODISCARD gp_XYZ Divided(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XYZ Divided(const Standard_Real theScalar) const
   {
     return gp_XYZ(x / theScalar, y / theScalar, z / theScalar);
   }
 
-  Standard_NODISCARD gp_XYZ operator/(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XYZ operator/(const Standard_Real theScalar) const
   {
     return Divided(theScalar);
   }
 
   //! computes the scalar product between <me> and theOther
-  Standard_Real Dot(const gp_XYZ& theOther) const
+  constexpr Standard_Real Dot(const gp_XYZ& theOther) const noexcept
   {
     return (x * theOther.x + y * theOther.y + z * theOther.z);
   }
 
-  Standard_Real operator*(const gp_XYZ& theOther) const { return Dot(theOther); }
+  constexpr Standard_Real operator*(const gp_XYZ& theOther) const noexcept { return Dot(theOther); }
 
   //! computes the triple scalar product
-  Standard_Real DotCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) const;
+  constexpr Standard_Real DotCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) const noexcept;
 
   //! @code
   //! <me>.X() = <me>.X() * theScalar;
   //! <me>.Y() = <me>.Y() * theScalar;
   //! <me>.Z() = <me>.Z() * theScalar;
   //! @endcode
-  void Multiply(const Standard_Real theScalar)
+  constexpr void Multiply(const Standard_Real theScalar) noexcept
   {
     x *= theScalar;
     y *= theScalar;
     z *= theScalar;
   }
 
-  void operator*=(const Standard_Real theScalar) { Multiply(theScalar); }
+  constexpr void operator*=(const Standard_Real theScalar) noexcept { Multiply(theScalar); }
 
   //! @code
   //! <me>.X() = <me>.X() * theOther.X();
   //! <me>.Y() = <me>.Y() * theOther.Y();
   //! <me>.Z() = <me>.Z() * theOther.Z();
   //! @endcode
-  void Multiply(const gp_XYZ& theOther)
+  constexpr void Multiply(const gp_XYZ& theOther) noexcept
   {
     x *= theOther.x;
     y *= theOther.y;
     z *= theOther.z;
   }
 
-  void operator*=(const gp_XYZ& theOther) { Multiply(theOther); }
+  constexpr void operator*=(const gp_XYZ& theOther) noexcept { Multiply(theOther); }
 
   //! <me> = theMatrix * <me>
-  void Multiply(const gp_Mat& theMatrix);
+  void Multiply(const gp_Mat& theMatrix) noexcept;
 
-  void operator*=(const gp_Mat& theMatrix) { Multiply(theMatrix); }
+  void operator*=(const gp_Mat& theMatrix) noexcept { Multiply(theMatrix); }
 
   //! @code
   //! New.X() = <me>.X() * theScalar;
   //! New.Y() = <me>.Y() * theScalar;
   //! New.Z() = <me>.Z() * theScalar;
   //! @endcode
-  Standard_NODISCARD gp_XYZ Multiplied(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XYZ Multiplied(const Standard_Real theScalar) const noexcept
   {
     return gp_XYZ(x * theScalar, y * theScalar, z * theScalar);
   }
 
-  Standard_NODISCARD gp_XYZ operator*(const Standard_Real theScalar) const
+  Standard_NODISCARD constexpr gp_XYZ operator*(const Standard_Real theScalar) const noexcept
   {
     return Multiplied(theScalar);
   }
@@ -293,13 +304,13 @@ public:
   //! new.Y() = <me>.Y() * theOther.Y();
   //! new.Z() = <me>.Z() * theOther.Z();
   //! @endcode
-  Standard_NODISCARD gp_XYZ Multiplied(const gp_XYZ& theOther) const
+  Standard_NODISCARD constexpr gp_XYZ Multiplied(const gp_XYZ& theOther) const noexcept
   {
     return gp_XYZ(x * theOther.x, y * theOther.y, z * theOther.z);
   }
 
   //! New = theMatrix * <me>
-  Standard_NODISCARD gp_XYZ Multiplied(const gp_Mat& theMatrix) const
+  Standard_NODISCARD gp_XYZ Multiplied(const gp_Mat& theMatrix) const noexcept
   {
     // Direct access to matrix data for optimal performance (gp_XYZ is friend of gp_Mat)
     return gp_XYZ(theMatrix.myMat[0][0] * x + theMatrix.myMat[0][1] * y + theMatrix.myMat[0][2] * z,
@@ -308,7 +319,7 @@ public:
                     + theMatrix.myMat[2][2] * z);
   }
 
-  Standard_NODISCARD gp_XYZ operator*(const gp_Mat& theMatrix) const
+  Standard_NODISCARD gp_XYZ operator*(const gp_Mat& theMatrix) const noexcept
   {
     return Multiplied(theMatrix);
   }
@@ -340,7 +351,7 @@ public:
   //! <me>.Y() = -<me>.Y()
   //! <me>.Z() = -<me>.Z()
   //! @endcode
-  void Reverse()
+  constexpr void Reverse() noexcept
   {
     x = -x;
     y = -y;
@@ -352,45 +363,48 @@ public:
   //! New.Y() = -<me>.Y()
   //! New.Z() = -<me>.Z()
   //! @endcode
-  Standard_NODISCARD gp_XYZ Reversed() const { return gp_XYZ(-x, -y, -z); }
+  Standard_NODISCARD constexpr gp_XYZ Reversed() const noexcept { return gp_XYZ(-x, -y, -z); }
 
   //! @code
   //! <me>.X() = <me>.X() - theOther.X()
   //! <me>.Y() = <me>.Y() - theOther.Y()
   //! <me>.Z() = <me>.Z() - theOther.Z()
   //! @endcode
-  void Subtract(const gp_XYZ& theOther)
+  constexpr void Subtract(const gp_XYZ& theOther) noexcept
   {
     x -= theOther.x;
     y -= theOther.y;
     z -= theOther.z;
   }
 
-  void operator-=(const gp_XYZ& theOther) { Subtract(theOther); }
+  constexpr void operator-=(const gp_XYZ& theOther) noexcept { Subtract(theOther); }
 
   //! @code
   //! new.X() = <me>.X() - theOther.X()
   //! new.Y() = <me>.Y() - theOther.Y()
   //! new.Z() = <me>.Z() - theOther.Z()
   //! @endcode
-  Standard_NODISCARD gp_XYZ Subtracted(const gp_XYZ& theOther) const
+  Standard_NODISCARD constexpr gp_XYZ Subtracted(const gp_XYZ& theOther) const noexcept
   {
     return gp_XYZ(x - theOther.x, y - theOther.y, z - theOther.z);
   }
 
-  Standard_NODISCARD gp_XYZ operator-(const gp_XYZ& theOther) const { return Subtracted(theOther); }
+  Standard_NODISCARD constexpr gp_XYZ operator-(const gp_XYZ& theOther) const noexcept
+  {
+    return Subtracted(theOther);
+  }
 
   //! <me> is set to the following linear form :
   //! @code
   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theA3 * theXYZ3 + theXYZ4
   //! @endcode
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_XYZ&       theXYZ1,
-                     const Standard_Real theA2,
-                     const gp_XYZ&       theXYZ2,
-                     const Standard_Real theA3,
-                     const gp_XYZ&       theXYZ3,
-                     const gp_XYZ&       theXYZ4)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XYZ&       theXYZ1,
+                               const Standard_Real theA2,
+                               const gp_XYZ&       theXYZ2,
+                               const Standard_Real theA3,
+                               const gp_XYZ&       theXYZ3,
+                               const gp_XYZ&       theXYZ4) noexcept
   {
     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theA3 * theXYZ3.x + theXYZ4.x;
     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theA3 * theXYZ3.y + theXYZ4.y;
@@ -401,12 +415,12 @@ public:
   //! @code
   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theA3 * theXYZ3
   //! @endcode
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_XYZ&       theXYZ1,
-                     const Standard_Real theA2,
-                     const gp_XYZ&       theXYZ2,
-                     const Standard_Real theA3,
-                     const gp_XYZ&       theXYZ3)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XYZ&       theXYZ1,
+                               const Standard_Real theA2,
+                               const gp_XYZ&       theXYZ2,
+                               const Standard_Real theA3,
+                               const gp_XYZ&       theXYZ3) noexcept
   {
     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theA3 * theXYZ3.x;
     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theA3 * theXYZ3.y;
@@ -417,11 +431,11 @@ public:
   //! @code
   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theXYZ3
   //! @endcode
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_XYZ&       theXYZ1,
-                     const Standard_Real theA2,
-                     const gp_XYZ&       theXYZ2,
-                     const gp_XYZ&       theXYZ3)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XYZ&       theXYZ1,
+                               const Standard_Real theA2,
+                               const gp_XYZ&       theXYZ2,
+                               const gp_XYZ&       theXYZ3) noexcept
   {
     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theXYZ3.x;
     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theXYZ3.y;
@@ -432,10 +446,10 @@ public:
   //! @code
   //! theA1 * theXYZ1 + theA2 * theXYZ2
   //! @endcode
-  void SetLinearForm(const Standard_Real theA1,
-                     const gp_XYZ&       theXYZ1,
-                     const Standard_Real theA2,
-                     const gp_XYZ&       theXYZ2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XYZ&       theXYZ1,
+                               const Standard_Real theA2,
+                               const gp_XYZ&       theXYZ2) noexcept
   {
     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x;
     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y;
@@ -446,7 +460,9 @@ public:
   //! @code
   //! theA1 * theXYZ1 + theXYZ2
   //! @endcode
-  void SetLinearForm(const Standard_Real theA1, const gp_XYZ& theXYZ1, const gp_XYZ& theXYZ2)
+  constexpr void SetLinearForm(const Standard_Real theA1,
+                               const gp_XYZ&       theXYZ1,
+                               const gp_XYZ&       theXYZ2) noexcept
   {
     x = theA1 * theXYZ1.x + theXYZ2.x;
     y = theA1 * theXYZ1.y + theXYZ2.y;
@@ -457,7 +473,7 @@ public:
   //! @code
   //! theXYZ1 + theXYZ2
   //! @endcode
-  void SetLinearForm(const gp_XYZ& theXYZ1, const gp_XYZ& theXYZ2)
+  constexpr void SetLinearForm(const gp_XYZ& theXYZ1, const gp_XYZ& theXYZ2) noexcept
   {
     x = theXYZ1.x + theXYZ2.x;
     y = theXYZ1.y + theXYZ2.y;
@@ -479,7 +495,7 @@ private:
 
 //=================================================================================================
 
-inline void gp_XYZ::Cross(const gp_XYZ& theRight)
+inline constexpr void gp_XYZ::Cross(const gp_XYZ& theRight) noexcept
 {
   const Standard_Real aXresult = y * theRight.z - z * theRight.y;
   const Standard_Real aYresult = z * theRight.x - x * theRight.z;
@@ -497,7 +513,7 @@ inline Standard_Real gp_XYZ::CrossMagnitude(const gp_XYZ& theRight) const
 
 //=================================================================================================
 
-inline Standard_Real gp_XYZ::CrossSquareMagnitude(const gp_XYZ& theRight) const
+inline constexpr Standard_Real gp_XYZ::CrossSquareMagnitude(const gp_XYZ& theRight) const noexcept
 {
   const Standard_Real aXresult = y * theRight.z - z * theRight.y;
   const Standard_Real aYresult = z * theRight.x - x * theRight.z;
@@ -507,7 +523,7 @@ inline Standard_Real gp_XYZ::CrossSquareMagnitude(const gp_XYZ& theRight) const
 
 //=================================================================================================
 
-inline void gp_XYZ::CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2)
+inline constexpr void gp_XYZ::CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) noexcept
 {
   // First compute theCoord1 * theCoord2
   const Standard_Real aCrossX = theCoord1.y * theCoord2.z - theCoord1.z * theCoord2.y;
@@ -525,7 +541,8 @@ inline void gp_XYZ::CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2)
 
 //=================================================================================================
 
-inline Standard_Real gp_XYZ::DotCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) const
+inline constexpr Standard_Real gp_XYZ::DotCross(const gp_XYZ& theCoord1,
+                                                const gp_XYZ& theCoord2) const noexcept
 {
   const Standard_Real aXresult  = theCoord1.y * theCoord2.z - theCoord1.z * theCoord2.y;
   const Standard_Real anYresult = theCoord1.z * theCoord2.x - theCoord1.x * theCoord2.z;
@@ -535,7 +552,7 @@ inline Standard_Real gp_XYZ::DotCross(const gp_XYZ& theCoord1, const gp_XYZ& the
 
 //=================================================================================================
 
-inline void gp_XYZ::Multiply(const gp_Mat& theMatrix)
+inline void gp_XYZ::Multiply(const gp_Mat& theMatrix) noexcept
 {
   // Cache original coordinates to avoid aliasing issues
   const Standard_Real aOrigX = x;
@@ -567,7 +584,7 @@ inline void gp_XYZ::Normalize()
 // function : operator*
 // purpose :
 //=======================================================================
-inline gp_XYZ operator*(const gp_Mat& theMatrix, const gp_XYZ& theCoord1)
+inline gp_XYZ operator*(const gp_Mat& theMatrix, const gp_XYZ& theCoord1) noexcept
 {
   return theCoord1.Multiplied(theMatrix);
 }
@@ -576,7 +593,7 @@ inline gp_XYZ operator*(const gp_Mat& theMatrix, const gp_XYZ& theCoord1)
 // function : operator*
 // purpose :
 //=======================================================================
-inline gp_XYZ operator*(const Standard_Real theScalar, const gp_XYZ& theCoord1)
+inline constexpr gp_XYZ operator*(const Standard_Real theScalar, const gp_XYZ& theCoord1) noexcept
 {
   return theCoord1.Multiplied(theScalar);
 }
index 99022a516829d9a555326b15b2f3ce7ade022efa..7651e022eabcacd903a6334be87dd8ddc807344a 100644 (file)
@@ -1873,7 +1873,6 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex(const gp_Pnt&
   Standard_Boolean                  bRet;
   Standard_Integer                  nV, iFlag;
   Standard_Real                     aTolCheck;
-  gp_Pnt                            aPV;
   Bnd_Box                           aBoxP;
   TColStd_MapIteratorOfMapOfInteger aIt;
   //
index c998a97d681becf21c7fd01dc6168248facf49bc..e96c6b631512e6ea6dcc3835cefa2cc6fc527bc2 100644 (file)
@@ -968,7 +968,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff(const TopoDS_Edge&
   Standard_Boolean                           bRet, bIsComputed;
   Standard_Real                              aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
   Standard_Real                              aUmin, aUsup, aVmin, aVsup;
-  gp_Pnt                                     aPn1, aPn2, aPx;
+  gp_Pnt                                     aPx;
   gp_Dir                                     aDN1, aDN2, aDBF, aDBF2, aDTF;
   gp_Vec                                     aVTgt;
   TopAbs_Orientation                         aOr;
index b4253e0b636dc5ef621699505733fa3fc9c34d90..99a2c7c035b1e8ea1b3c1db1a7d1ef18d036e0a9 100644 (file)
@@ -1648,7 +1648,6 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/)
   // reorganize the wires respecting orientation and origin
 
   TopoDS_Vertex Vdeb, Vfin;
-  gp_Pnt        Pdeb, Psuiv, PPs;
 
   BRepTools_WireExplorer anExp;
 
@@ -1979,6 +1978,9 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/)
   }
 #ifdef OCCT_DEBUG_EFV
 
+  gp_Pnt PPs;
+  gp_Pnt Pdeb, Psuiv;
+
   for (i = ideb; i <= myWork.Length(); i++)
   {
 
index 369230b3428aa9e72f5121b4df2dc8e761adad76..c075d0ff28b932a4806828deb940026ee574d5e6 100644 (file)
@@ -1504,7 +1504,6 @@ static void GetDirection(const TopoDS_Edge& theEdge,
     ((anOr == TopAbs_FORWARD && isFirstEnd) || (anOr == TopAbs_REVERSED && !isFirstEnd));
 
   Standard_Real dpar = (aLast - aFirst) * 0.01;
-  gp_Pnt2d      aP2d;
   if (takeFirst)
   {
     aC2d->D0(aFirst, thePnt);
index 10a59c7a13be394687b619a8748b64b6a0e04ac9..027b88f7a9f018fb4a91d6fc47a5b4f1967738ed 100644 (file)
@@ -779,9 +779,6 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::SeekPoint(const Standard_Real u1,
                                                        const Standard_Real v2,
                                                        IntSurf_PntOn2S&    Point)
 {
-  gp_Pnt                 aP;
-  gp_Vec                 aT;
-  gp_Vec2d               aTS1, aTS2;
   const IntSurf_Quadric& aQSurf = MyZerImpFunc.ISurface();
   const ThePSurface&     aPSurf = MyZerImpFunc.PSurface();
 
index b5887b36bb2aab5d3a4e36db0e8599124c66e37d..741726c8c4091511ec77af6113b343dfd804ad37 100644 (file)
@@ -758,7 +758,7 @@ gp_Trsf GeomFill_SectionPlacement::Transformation(const Standard_Boolean WithTra
 {
   gp_Vec V;
   gp_Mat M;
-  gp_Dir DT, DN, D;
+  gp_Dir DN, D;
   // modified by NIZHNY-MKK  Fri Oct 17 15:27:07 2003
   gp_Pnt P(0., 0., 0.), PSection(0., 0., 0.);
 
index 67c4d76d46e629bd4a7d3eb9e3390064add4fd4f..fdad28d107596b372a4d0a3dd4e2ed1fcef6154f 100644 (file)
@@ -1445,7 +1445,6 @@ void BRepOffset_Offset::Init(const TopoDS_Vertex&        Vertex,
   // evaluate the Ax3 of the Sphere
   // find 3 different vertices in LEdge
   TopTools_ListIteratorOfListOfShape it;
-  gp_Pnt                             P, P1, P2, P3;
   TopoDS_Vertex                      V1, V2, V3, V4;
 
 #ifdef OCCT_DEBUG
index 3125bdaf60a983561630541a87cecea79f2bf105..15764758807cc061a1e25ca8374bcf676b68c5bf 100644 (file)
@@ -382,7 +382,7 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
   {
     Standard_Boolean     bTranslate;
     Standard_Real        aD2, aT1, aT2;
-    gp_Pnt2d             PF, NewPF, aP2DT;
+    gp_Pnt2d             PF, NewPF;
     gp_Vec2d             aV2DT, vectra(2. * M_PI, 0.);
     Handle(Geom2d_Curve) aC2DE;
     //
index ed1c55d1f5ad70a6a0f8b05b4929c70f14567414..d83ad2fb42cfa3921b8e602e9eeea57efb6ff654 100644 (file)
@@ -3642,8 +3642,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(
                            > Vperiod / 2)) // end of parametric space
               {
                 //<edges> do not contain seams => we must reconstruct the seam up to <NextEdge>
-                gp_Pnt2d      StartOfNextEdge;
-                TopoDS_Vertex LastVertexOfSeam;
                 ReconstructMissedSeam(RemovedEdges,
                                       F_RefFace,
                                       CurEdge,
index 192b8b806690e7566cfbe40c30de5617a4867bb7..6c159dee27670d4068004e2dbeb9246f102f6c15 100644 (file)
@@ -457,7 +457,7 @@ static void PERFORM_C0(const TopoDS_Edge&         S1,
       Standard_Real Udeb, Ufin;
       BRep_Tool::Range(Eother, Udeb, Ufin);
 
-      gp_Pnt                   P1, Pt;
+      gp_Pnt                   Pt;
       Standard_Integer         i, ii;
       BRepClass_FaceClassifier classifier;
       for (i = 1; i <= arrInter.Length(); i++)
@@ -992,7 +992,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge&         theS1,
     TColStd_Array1OfReal arrInter(1, 1 + nbIntervals);
     aAdaptorCurve.Intervals(arrInter, GeomAbs_C1);
 
-    gp_Pnt              Pt;
     Standard_Real       U, V;
     const Standard_Real tol = BRep_Tool::Tolerance(theS2);
 
index f5f8a2378da19620160f8d20f67c33f962a9d17f..075e94f43674652c4d35f0eca4679cf12bf122db 100644 (file)
@@ -268,7 +268,6 @@ void MeshVS_NodalColorPrsBuilder::Build(const Handle(Prs3d_Presentation)& Prs,
   Handle(Graphic3d_ArrayOfSegments) anEdgeSegments =
     new Graphic3d_ArrayOfSegments(aNbEdgePrimitives * 2);
 
-  gp_Pnt        P, Start;
   Standard_Real aMin = gp::Resolution() * gp::Resolution();
   gp_Dir        aDefNorm(0., 0., 1.);
 
index 4372291ed355dd2c9ea6a717e87254df4ee629ea..4fd04892611b8a015bc1853eb4bf972d48c60264 100644 (file)
@@ -265,8 +265,6 @@ void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresent
 
   Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
 
-  gp_Pnt Ptmp, ptcur;
-
   gp_Ax2 ax = aCircle.Position();
   ax.SetLocation(MidPoint);
   gp_Circ aCircleM(ax, rad);
index 00036507373954ce6ce6c1dfcfc592373d9929b5..0497301d0c41462445836365f7e6cf9020876e37 100644 (file)
@@ -560,7 +560,6 @@ void DsgPrs_SymmetricPresentation::Add(const Handle(Prs3d_Presentation)& aPresen
   aPrims = new Graphic3d_ArrayOfPolylines(nbp);
   aPrims->AddVertex(AttachmentPoint1);
   alphaIter = Dalpha;
-  gp_Pnt           PntIter;
   Standard_Integer i;
   for (i = 2; i <= nbp; i++, alphaIter += Dalpha)
     aPrims->AddVertex(ElCLib::Value(ParamPAttach1 + alphaIter, aCircle1));
index edcb01b6a7fc1d0aa7475a0c289c89e845e03f13..efb53f7d8579f700cd631fedee86cb0790cea587 100644 (file)
@@ -960,7 +960,6 @@ Standard_Boolean PrsDim_AngleDimension::InitTwoFacesAngle()
   TopoDS_Face aFirstFace  = TopoDS::Face(myFirstShape);
   TopoDS_Face aSecondFace = TopoDS::Face(mySecondShape);
 
-  gp_Dir               aFirstDir, aSecondDir;
   gp_Pln               aFirstPln, aSecondPln;
   Handle(Geom_Surface) aFirstBasisSurf, aSecondBasisSurf;
   PrsDim_KindOfSurface aFirstSurfType, aSecondSurfType;
@@ -1009,7 +1008,6 @@ Standard_Boolean PrsDim_AngleDimension::InitTwoFacesAngle(const gp_Pnt& thePoint
   TopoDS_Face aFirstFace  = TopoDS::Face(myFirstShape);
   TopoDS_Face aSecondFace = TopoDS::Face(mySecondShape);
 
-  gp_Dir               aFirstDir, aSecondDir;
   gp_Pln               aFirstPln, aSecondPln;
   Handle(Geom_Surface) aFirstBasisSurf, aSecondBasisSurf;
   PrsDim_KindOfSurface aFirstSurfType, aSecondSurfType;