Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:17:47

0001 // Copyright (c) 1991-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _gp_XYZ_HeaderFile
0016 #define _gp_XYZ_HeaderFile
0017 
0018 #include <gp.hxx>
0019 #include <gp_Mat.hxx>
0020 #include <Standard_ConstructionError.hxx>
0021 #include <Standard_OutOfRange.hxx>
0022 #include <Standard_OStream.hxx>
0023 #include <Standard_SStream.hxx>
0024 
0025 #include <cmath>
0026 
0027 //! This class describes a cartesian coordinate entity in
0028 //! 3D space {X,Y,Z}. This entity is used for algebraic
0029 //! calculation. This entity can be transformed
0030 //! with a "Trsf" or a "GTrsf" from package "gp".
0031 //! It is used in vectorial computations or for holding this type
0032 //! of information in data structures.
0033 class gp_XYZ
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Creates an XYZ object with zero coordinates (0,0,0)
0039   constexpr gp_XYZ() noexcept
0040       : x(0.),
0041         y(0.),
0042         z(0.)
0043   {
0044   }
0045 
0046   //! creates an XYZ with given coordinates
0047   constexpr gp_XYZ(const double theX, const double theY, const double theZ) noexcept
0048       : x(theX),
0049         y(theY),
0050         z(theZ)
0051   {
0052   }
0053 
0054   //! For this XYZ object, assigns
0055   //! the values theX, theY and theZ to its three coordinates
0056   constexpr void SetCoord(const double theX, const double theY, const double theZ) noexcept
0057   {
0058     x = theX;
0059     y = theY;
0060     z = theZ;
0061   }
0062 
0063   //! modifies the coordinate of range theIndex
0064   //! theIndex = 1 => X is modified
0065   //! theIndex = 2 => Y is modified
0066   //! theIndex = 3 => Z is modified
0067   //! Raises OutOfRange if theIndex != {1, 2, 3}.
0068   constexpr void SetCoord(const int theIndex, const double theXi)
0069   {
0070     Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, nullptr);
0071     if (theIndex == 1)
0072     {
0073       x = theXi;
0074     }
0075     else if (theIndex == 2)
0076     {
0077       y = theXi;
0078     }
0079     else
0080     {
0081       z = theXi;
0082     }
0083   }
0084 
0085   //! Assigns the given value to the X coordinate
0086   constexpr void SetX(const double theX) noexcept { x = theX; }
0087 
0088   //! Assigns the given value to the Y coordinate
0089   constexpr void SetY(const double theY) noexcept { y = theY; }
0090 
0091   //! Assigns the given value to the Z coordinate
0092   constexpr void SetZ(const double theZ) noexcept { z = theZ; }
0093 
0094   //! returns the coordinate of range theIndex :
0095   //! theIndex = 1 => X is returned
0096   //! theIndex = 2 => Y is returned
0097   //! theIndex = 3 => Z is returned
0098   //!
0099   //! Raises OutOfRange if theIndex != {1, 2, 3}.
0100   constexpr double Coord(const int theIndex) const
0101   {
0102     Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, nullptr);
0103     if (theIndex == 1)
0104     {
0105       return x;
0106     }
0107     else if (theIndex == 2)
0108     {
0109       return y;
0110     }
0111     return z;
0112   }
0113 
0114   constexpr double& ChangeCoord(const int theIndex)
0115   {
0116     Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, nullptr);
0117     if (theIndex == 1)
0118     {
0119       return x;
0120     }
0121     else if (theIndex == 2)
0122     {
0123       return y;
0124     }
0125     return z;
0126   }
0127 
0128   constexpr void Coord(double& theX, double& theY, double& theZ) const noexcept
0129   {
0130     theX = x;
0131     theY = y;
0132     theZ = z;
0133   }
0134 
0135   //! Returns a const ptr to coordinates location.
0136   //! Is useful for algorithms, but DOES NOT PERFORM
0137   //! ANY CHECKS!
0138   constexpr const double* GetData() const noexcept { return (&x); }
0139 
0140   //! Returns a ptr to coordinates location.
0141   //! Is useful for algorithms, but DOES NOT PERFORM
0142   //! ANY CHECKS!
0143   double* ChangeData() noexcept { return (&x); }
0144 
0145   //! Returns the X coordinate
0146   constexpr double X() const noexcept { return x; }
0147 
0148   //! Returns the Y coordinate
0149   constexpr double Y() const noexcept { return y; }
0150 
0151   //! Returns the Z coordinate
0152   constexpr double Z() const noexcept { return z; }
0153 
0154   //! Computes std::sqrt(X*X + Y*Y + Z*Z) where X, Y and Z are the three coordinates of this XYZ
0155   //! object.
0156   double Modulus() const { return std::sqrt(x * x + y * y + z * z); }
0157 
0158   //! Computes X*X + Y*Y + Z*Z where X, Y and Z are the three coordinates of this XYZ object.
0159   constexpr double SquareModulus() const noexcept { return (x * x + y * y + z * z); }
0160 
0161   //! Returns True if he coordinates of this XYZ object are
0162   //! equal to the respective coordinates Other,
0163   //! within the specified tolerance theTolerance.
0164   bool IsEqual(const gp_XYZ& theOther, const double theTolerance) const
0165 
0166   {
0167     return (std::abs(x - theOther.x) < theTolerance) && (std::abs(y - theOther.y) < theTolerance)
0168            && (std::abs(z - theOther.z) < theTolerance);
0169   }
0170 
0171   //! @code
0172   //! <me>.X() = <me>.X() + theOther.X()
0173   //! <me>.Y() = <me>.Y() + theOther.Y()
0174   //! <me>.Z() = <me>.Z() + theOther.Z()
0175   //! @endcode
0176   constexpr void Add(const gp_XYZ& theOther) noexcept
0177   {
0178     x += theOther.x;
0179     y += theOther.y;
0180     z += theOther.z;
0181   }
0182 
0183   constexpr void operator+=(const gp_XYZ& theOther) noexcept { Add(theOther); }
0184 
0185   //! @code
0186   //! new.X() = <me>.X() + theOther.X()
0187   //! new.Y() = <me>.Y() + theOther.Y()
0188   //! new.Z() = <me>.Z() + theOther.Z()
0189   //! @endcode
0190   [[nodiscard]] constexpr gp_XYZ Added(const gp_XYZ& theOther) const noexcept
0191   {
0192     return gp_XYZ(x + theOther.x, y + theOther.y, z + theOther.z);
0193   }
0194 
0195   [[nodiscard]] constexpr gp_XYZ operator+(const gp_XYZ& theOther) const noexcept
0196   {
0197     return Added(theOther);
0198   }
0199 
0200   //! @code
0201   //! <me>.X() = <me>.Y() * theOther.Z() - <me>.Z() * theOther.Y()
0202   //! <me>.Y() = <me>.Z() * theOther.X() - <me>.X() * theOther.Z()
0203   //! <me>.Z() = <me>.X() * theOther.Y() - <me>.Y() * theOther.X()
0204   //! @endcode
0205   constexpr void Cross(const gp_XYZ& theOther) noexcept;
0206 
0207   constexpr void operator^=(const gp_XYZ& theOther) noexcept { Cross(theOther); }
0208 
0209   //! @code
0210   //! new.X() = <me>.Y() * theOther.Z() - <me>.Z() * theOther.Y()
0211   //! new.Y() = <me>.Z() * theOther.X() - <me>.X() * theOther.Z()
0212   //! new.Z() = <me>.X() * theOther.Y() - <me>.Y() * theOther.X()
0213   //! @endcode
0214   [[nodiscard]] constexpr gp_XYZ Crossed(const gp_XYZ& theOther) const noexcept
0215   {
0216     return gp_XYZ(y * theOther.z - z * theOther.y,
0217                   z * theOther.x - x * theOther.z,
0218                   x * theOther.y - y * theOther.x);
0219   }
0220 
0221   [[nodiscard]] constexpr gp_XYZ operator^(const gp_XYZ& theOther) const noexcept
0222   {
0223     return Crossed(theOther);
0224   }
0225 
0226   //! Computes the magnitude of the cross product between <me> and
0227   //! theRight. Returns || <me> ^ theRight ||
0228   double CrossMagnitude(const gp_XYZ& theRight) const;
0229 
0230   //! Computes the square magnitude of the cross product between <me> and
0231   //! theRight. Returns || <me> ^ theRight ||**2
0232   constexpr double CrossSquareMagnitude(const gp_XYZ& theRight) const noexcept;
0233 
0234   //! Triple vector product
0235   //! Computes <me> = <me>.Cross(theCoord1.Cross(theCoord2))
0236   constexpr void CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) noexcept;
0237 
0238   //! Triple vector product
0239   //! computes New = <me>.Cross(theCoord1.Cross(theCoord2))
0240   [[nodiscard]] constexpr gp_XYZ CrossCrossed(const gp_XYZ& theCoord1,
0241                                               const gp_XYZ& theCoord2) const noexcept
0242   {
0243     gp_XYZ aCoord0 = *this;
0244     aCoord0.CrossCross(theCoord1, theCoord2);
0245     return aCoord0;
0246   }
0247 
0248   //! divides <me> by a real.
0249   constexpr void Divide(const double theScalar)
0250   {
0251     x /= theScalar;
0252     y /= theScalar;
0253     z /= theScalar;
0254   }
0255 
0256   constexpr void operator/=(const double theScalar) { Divide(theScalar); }
0257 
0258   //! divides <me> by a real.
0259   [[nodiscard]] constexpr gp_XYZ Divided(const double theScalar) const
0260   {
0261     return gp_XYZ(x / theScalar, y / theScalar, z / theScalar);
0262   }
0263 
0264   [[nodiscard]] constexpr gp_XYZ operator/(const double theScalar) const
0265   {
0266     return Divided(theScalar);
0267   }
0268 
0269   //! Computes the scalar product between <me> and theOther.
0270   constexpr double Dot(const gp_XYZ& theOther) const noexcept
0271   {
0272     return (x * theOther.x + y * theOther.y + z * theOther.z);
0273   }
0274 
0275   constexpr double operator*(const gp_XYZ& theOther) const noexcept { return Dot(theOther); }
0276 
0277   //! Computes the triple scalar product.
0278   constexpr double DotCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) const noexcept;
0279 
0280   //! @code
0281   //! <me>.X() = <me>.X() * theScalar;
0282   //! <me>.Y() = <me>.Y() * theScalar;
0283   //! <me>.Z() = <me>.Z() * theScalar;
0284   //! @endcode
0285   constexpr void Multiply(const double theScalar) noexcept
0286   {
0287     x *= theScalar;
0288     y *= theScalar;
0289     z *= theScalar;
0290   }
0291 
0292   constexpr void operator*=(const double theScalar) noexcept { Multiply(theScalar); }
0293 
0294   //! @code
0295   //! <me>.X() = <me>.X() * theOther.X();
0296   //! <me>.Y() = <me>.Y() * theOther.Y();
0297   //! <me>.Z() = <me>.Z() * theOther.Z();
0298   //! @endcode
0299   constexpr void Multiply(const gp_XYZ& theOther) noexcept
0300   {
0301     x *= theOther.x;
0302     y *= theOther.y;
0303     z *= theOther.z;
0304   }
0305 
0306   constexpr void operator*=(const gp_XYZ& theOther) noexcept { Multiply(theOther); }
0307 
0308   //! <me> = theMatrix * <me>
0309   constexpr void Multiply(const gp_Mat& theMatrix) noexcept;
0310 
0311   constexpr void operator*=(const gp_Mat& theMatrix) noexcept { Multiply(theMatrix); }
0312 
0313   //! @code
0314   //! New.X() = <me>.X() * theScalar;
0315   //! New.Y() = <me>.Y() * theScalar;
0316   //! New.Z() = <me>.Z() * theScalar;
0317   //! @endcode
0318   [[nodiscard]] constexpr gp_XYZ Multiplied(const double theScalar) const noexcept
0319   {
0320     return gp_XYZ(x * theScalar, y * theScalar, z * theScalar);
0321   }
0322 
0323   [[nodiscard]] constexpr gp_XYZ operator*(const double theScalar) const noexcept
0324   {
0325     return Multiplied(theScalar);
0326   }
0327 
0328   //! @code
0329   //! new.X() = <me>.X() * theOther.X();
0330   //! new.Y() = <me>.Y() * theOther.Y();
0331   //! new.Z() = <me>.Z() * theOther.Z();
0332   //! @endcode
0333   [[nodiscard]] constexpr gp_XYZ Multiplied(const gp_XYZ& theOther) const noexcept
0334   {
0335     return gp_XYZ(x * theOther.x, y * theOther.y, z * theOther.z);
0336   }
0337 
0338   //! New = theMatrix * <me>
0339   [[nodiscard]] constexpr gp_XYZ Multiplied(const gp_Mat& theMatrix) const noexcept
0340   {
0341     // Direct access to matrix data for optimal performance (gp_XYZ is friend of gp_Mat)
0342     return gp_XYZ(theMatrix.myMat[0][0] * x + theMatrix.myMat[0][1] * y + theMatrix.myMat[0][2] * z,
0343                   theMatrix.myMat[1][0] * x + theMatrix.myMat[1][1] * y + theMatrix.myMat[1][2] * z,
0344                   theMatrix.myMat[2][0] * x + theMatrix.myMat[2][1] * y
0345                     + theMatrix.myMat[2][2] * z);
0346   }
0347 
0348   [[nodiscard]] constexpr gp_XYZ operator*(const gp_Mat& theMatrix) const noexcept
0349   {
0350     return Multiplied(theMatrix);
0351   }
0352 
0353   //! @code
0354   //! <me>.X() = <me>.X()/ <me>.Modulus()
0355   //! <me>.Y() = <me>.Y()/ <me>.Modulus()
0356   //! <me>.Z() = <me>.Z()/ <me>.Modulus()
0357   //! @endcode
0358   //! Raised if <me>.Modulus() <= Resolution from gp
0359   void Normalize();
0360 
0361   //! @code
0362   //! New.X() = <me>.X()/ <me>.Modulus()
0363   //! New.Y() = <me>.Y()/ <me>.Modulus()
0364   //! New.Z() = <me>.Z()/ <me>.Modulus()
0365   //! @endcode
0366   //! Raised if <me>.Modulus() <= Resolution from gp
0367   [[nodiscard]] gp_XYZ Normalized() const
0368   {
0369     const double aD = Modulus();
0370     Standard_ConstructionError_Raise_if(aD <= gp::Resolution(),
0371                                         "gp_XYZ::Normalized() - vector has zero norm");
0372     return gp_XYZ(x / aD, y / aD, z / aD);
0373   }
0374 
0375   //! @code
0376   //! <me>.X() = -<me>.X()
0377   //! <me>.Y() = -<me>.Y()
0378   //! <me>.Z() = -<me>.Z()
0379   //! @endcode
0380   constexpr void Reverse() noexcept
0381   {
0382     x = -x;
0383     y = -y;
0384     z = -z;
0385   }
0386 
0387   //! @code
0388   //! New.X() = -<me>.X()
0389   //! New.Y() = -<me>.Y()
0390   //! New.Z() = -<me>.Z()
0391   //! @endcode
0392   [[nodiscard]] constexpr gp_XYZ Reversed() const noexcept { return gp_XYZ(-x, -y, -z); }
0393 
0394   //! @code
0395   //! <me>.X() = <me>.X() - theOther.X()
0396   //! <me>.Y() = <me>.Y() - theOther.Y()
0397   //! <me>.Z() = <me>.Z() - theOther.Z()
0398   //! @endcode
0399   constexpr void Subtract(const gp_XYZ& theOther) noexcept
0400   {
0401     x -= theOther.x;
0402     y -= theOther.y;
0403     z -= theOther.z;
0404   }
0405 
0406   constexpr void operator-=(const gp_XYZ& theOther) noexcept { Subtract(theOther); }
0407 
0408   //! @code
0409   //! new.X() = <me>.X() - theOther.X()
0410   //! new.Y() = <me>.Y() - theOther.Y()
0411   //! new.Z() = <me>.Z() - theOther.Z()
0412   //! @endcode
0413   [[nodiscard]] constexpr gp_XYZ Subtracted(const gp_XYZ& theOther) const noexcept
0414   {
0415     return gp_XYZ(x - theOther.x, y - theOther.y, z - theOther.z);
0416   }
0417 
0418   [[nodiscard]] constexpr gp_XYZ operator-(const gp_XYZ& theOther) const noexcept
0419   {
0420     return Subtracted(theOther);
0421   }
0422 
0423   //! <me> is set to the following linear form :
0424   //! @code
0425   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theA3 * theXYZ3 + theXYZ4
0426   //! @endcode
0427   constexpr void SetLinearForm(const double  theA1,
0428                                const gp_XYZ& theXYZ1,
0429                                const double  theA2,
0430                                const gp_XYZ& theXYZ2,
0431                                const double  theA3,
0432                                const gp_XYZ& theXYZ3,
0433                                const gp_XYZ& theXYZ4) noexcept
0434   {
0435     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theA3 * theXYZ3.x + theXYZ4.x;
0436     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theA3 * theXYZ3.y + theXYZ4.y;
0437     z = theA1 * theXYZ1.z + theA2 * theXYZ2.z + theA3 * theXYZ3.z + theXYZ4.z;
0438   }
0439 
0440   //! <me> is set to the following linear form :
0441   //! @code
0442   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theA3 * theXYZ3
0443   //! @endcode
0444   constexpr void SetLinearForm(const double  theA1,
0445                                const gp_XYZ& theXYZ1,
0446                                const double  theA2,
0447                                const gp_XYZ& theXYZ2,
0448                                const double  theA3,
0449                                const gp_XYZ& theXYZ3) noexcept
0450   {
0451     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theA3 * theXYZ3.x;
0452     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theA3 * theXYZ3.y;
0453     z = theA1 * theXYZ1.z + theA2 * theXYZ2.z + theA3 * theXYZ3.z;
0454   }
0455 
0456   //! <me> is set to the following linear form :
0457   //! @code
0458   //! theA1 * theXYZ1 + theA2 * theXYZ2 + theXYZ3
0459   //! @endcode
0460   constexpr void SetLinearForm(const double  theA1,
0461                                const gp_XYZ& theXYZ1,
0462                                const double  theA2,
0463                                const gp_XYZ& theXYZ2,
0464                                const gp_XYZ& theXYZ3) noexcept
0465   {
0466     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x + theXYZ3.x;
0467     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y + theXYZ3.y;
0468     z = theA1 * theXYZ1.z + theA2 * theXYZ2.z + theXYZ3.z;
0469   }
0470 
0471   //! <me> is set to the following linear form :
0472   //! @code
0473   //! theA1 * theXYZ1 + theA2 * theXYZ2
0474   //! @endcode
0475   constexpr void SetLinearForm(const double  theA1,
0476                                const gp_XYZ& theXYZ1,
0477                                const double  theA2,
0478                                const gp_XYZ& theXYZ2) noexcept
0479   {
0480     x = theA1 * theXYZ1.x + theA2 * theXYZ2.x;
0481     y = theA1 * theXYZ1.y + theA2 * theXYZ2.y;
0482     z = theA1 * theXYZ1.z + theA2 * theXYZ2.z;
0483   }
0484 
0485   //! <me> is set to the following linear form :
0486   //! @code
0487   //! theA1 * theXYZ1 + theXYZ2
0488   //! @endcode
0489   constexpr void SetLinearForm(const double  theA1,
0490                                const gp_XYZ& theXYZ1,
0491                                const gp_XYZ& theXYZ2) noexcept
0492   {
0493     x = theA1 * theXYZ1.x + theXYZ2.x;
0494     y = theA1 * theXYZ1.y + theXYZ2.y;
0495     z = theA1 * theXYZ1.z + theXYZ2.z;
0496   }
0497 
0498   //! <me> is set to the following linear form :
0499   //! @code
0500   //! theXYZ1 + theXYZ2
0501   //! @endcode
0502   constexpr void SetLinearForm(const gp_XYZ& theXYZ1, const gp_XYZ& theXYZ2) noexcept
0503   {
0504     x = theXYZ1.x + theXYZ2.x;
0505     y = theXYZ1.y + theXYZ2.y;
0506     z = theXYZ1.z + theXYZ2.z;
0507   }
0508 
0509   //! Dumps the content of me into the stream
0510   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0511 
0512   //! Inits the content of me from the stream
0513   Standard_EXPORT bool InitFromJson(const Standard_SStream& theSStream, int& theStreamPos);
0514 
0515 private:
0516   double x;
0517   double y;
0518   double z;
0519 };
0520 
0521 //=================================================================================================
0522 
0523 inline constexpr void gp_XYZ::Cross(const gp_XYZ& theRight) noexcept
0524 {
0525   const double aXresult = y * theRight.z - z * theRight.y;
0526   const double aYresult = z * theRight.x - x * theRight.z;
0527   z                     = x * theRight.y - y * theRight.x;
0528   x                     = aXresult;
0529   y                     = aYresult;
0530 }
0531 
0532 //=================================================================================================
0533 
0534 inline double gp_XYZ::CrossMagnitude(const gp_XYZ& theRight) const
0535 {
0536   return sqrt(CrossSquareMagnitude(theRight));
0537 }
0538 
0539 //=================================================================================================
0540 
0541 inline constexpr double gp_XYZ::CrossSquareMagnitude(const gp_XYZ& theRight) const noexcept
0542 {
0543   const double aXresult = y * theRight.z - z * theRight.y;
0544   const double aYresult = z * theRight.x - x * theRight.z;
0545   const double aZresult = x * theRight.y - y * theRight.x;
0546   return aXresult * aXresult + aYresult * aYresult + aZresult * aZresult;
0547 }
0548 
0549 //=================================================================================================
0550 
0551 inline constexpr void gp_XYZ::CrossCross(const gp_XYZ& theCoord1, const gp_XYZ& theCoord2) noexcept
0552 {
0553   // First compute theCoord1 * theCoord2
0554   const double aCrossX = theCoord1.y * theCoord2.z - theCoord1.z * theCoord2.y;
0555   const double aCrossY = theCoord1.z * theCoord2.x - theCoord1.x * theCoord2.z;
0556   const double aCrossZ = theCoord1.x * theCoord2.y - theCoord1.y * theCoord2.x;
0557 
0558   // Then compute this * (theCoord1 * theCoord2)
0559   const double aXresult = y * aCrossZ - z * aCrossY;
0560   const double aYresult = z * aCrossX - x * aCrossZ;
0561 
0562   z = x * aCrossY - y * aCrossX;
0563   x = aXresult;
0564   y = aYresult;
0565 }
0566 
0567 //=================================================================================================
0568 
0569 inline constexpr double gp_XYZ::DotCross(const gp_XYZ& theCoord1,
0570                                          const gp_XYZ& theCoord2) const noexcept
0571 {
0572   const double aXresult  = theCoord1.y * theCoord2.z - theCoord1.z * theCoord2.y;
0573   const double anYresult = theCoord1.z * theCoord2.x - theCoord1.x * theCoord2.z;
0574   const double aZresult  = theCoord1.x * theCoord2.y - theCoord1.y * theCoord2.x;
0575   return (x * aXresult + y * anYresult + z * aZresult);
0576 }
0577 
0578 //=================================================================================================
0579 
0580 inline constexpr void gp_XYZ::Multiply(const gp_Mat& theMatrix) noexcept
0581 {
0582   // Cache original coordinates to avoid aliasing issues
0583   const double aOrigX = x;
0584   const double aOrigY = y;
0585   const double aOrigZ = z;
0586 
0587   // Matrix-vector multiplication: this = theMatrix * this
0588   x = theMatrix.myMat[0][0] * aOrigX + theMatrix.myMat[0][1] * aOrigY
0589       + theMatrix.myMat[0][2] * aOrigZ;
0590   y = theMatrix.myMat[1][0] * aOrigX + theMatrix.myMat[1][1] * aOrigY
0591       + theMatrix.myMat[1][2] * aOrigZ;
0592   z = theMatrix.myMat[2][0] * aOrigX + theMatrix.myMat[2][1] * aOrigY
0593       + theMatrix.myMat[2][2] * aOrigZ;
0594 }
0595 
0596 //=================================================================================================
0597 
0598 inline void gp_XYZ::Normalize()
0599 {
0600   double aD = Modulus();
0601   Standard_ConstructionError_Raise_if(aD <= gp::Resolution(),
0602                                       "gp_XYZ::Normalize() - vector has zero norm");
0603   x = x / aD;
0604   y = y / aD;
0605   z = z / aD;
0606 }
0607 
0608 //=================================================================================================
0609 
0610 inline constexpr gp_XYZ operator*(const gp_Mat& theMatrix, const gp_XYZ& theCoord1) noexcept
0611 {
0612   return theCoord1.Multiplied(theMatrix);
0613 }
0614 
0615 //=================================================================================================
0616 
0617 inline constexpr gp_XYZ operator*(const double theScalar, const gp_XYZ& theCoord1) noexcept
0618 {
0619   return theCoord1.Multiplied(theScalar);
0620 }
0621 
0622 #endif // _gp_XYZ_HeaderFile