![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Describes a unit vector in 3D space. This unit vector is also called "Direction". See Also gce_MakeDir which provides functions for more complex unit vector constructions Geom_Direction which provides additional functions for constructing unit vectors and works, in particular, with the parametric equations of unit vectors. More...
#include <gp_Dir.hxx>
Public Types | |
| enum class | D { X , Y , Z , NX , NY , NZ } |
| Standard directions in 3D space for optimized constexpr construction. More... | |
Public Member Functions | |
| constexpr | gp_Dir () noexcept |
| Creates a direction corresponding to X axis. | |
| constexpr | gp_Dir (const D theDir) noexcept |
| Creates a direction from a standard direction enumeration. | |
| constexpr | gp_Dir (const gp_Vec &theV) |
| Normalizes the vector theV and creates a direction. Raises ConstructionError if theV.Magnitude() <= Resolution. | |
| constexpr | gp_Dir (const gp_XYZ &theCoord) |
| Creates a direction from a triplet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp. | |
| constexpr | gp_Dir (const double theXv, const double theYv, const double theZv) |
| Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if std::sqrt(theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution Modification of the direction's coordinates If std::sqrt (theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution from gp where theXv, theYv ,theZv are the new coordinates it is not possible to construct the direction and the method raises the exception ConstructionError. | |
| constexpr | gp_Dir (const gp_Dir &) noexcept=default |
| constexpr | gp_Dir (gp_Dir &&) noexcept=default |
| constexpr gp_Dir & | operator= (const gp_Dir &) noexcept=default |
| constexpr gp_Dir & | operator= (gp_Dir &&) noexcept=default |
| constexpr void | SetCoord (const int theIndex, const double theXi) |
| For this unit vector, assigns the value Xi to: | |
| constexpr void | SetCoord (const double theXv, const double theYv, const double theZv) |
| For this unit vector, assigns the values theXv, theYv and theZv to its three coordinates. Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. | |
| constexpr void | SetX (const double theX) |
| Assigns the given value to the X coordinate of this unit vector. | |
| constexpr void | SetY (const double theY) |
| Assigns the given value to the Y coordinate of this unit vector. | |
| constexpr void | SetZ (const double theZ) |
| Assigns the given value to the Z coordinate of this unit vector. | |
| constexpr void | SetXYZ (const gp_XYZ &theCoord) |
| Assigns the three coordinates of theCoord to this unit vector. | |
| constexpr double | Coord (const int theIndex) const |
| Returns the coordinate of range theIndex : theIndex = 1 => X is returned theIndex = 2 => Y is returned theIndex = 3 => Z is returned Exceptions Standard_OutOfRange if theIndex is not 1, 2, or 3. | |
| constexpr void | Coord (double &theXv, double &theYv, double &theZv) const noexcept |
| Returns for the unit vector its three coordinates theXv, theYv, and theZv. | |
| constexpr double | X () const noexcept |
| Returns the X coordinate for a unit vector. | |
| constexpr double | Y () const noexcept |
| Returns the Y coordinate for a unit vector. | |
| constexpr double | Z () const noexcept |
| Returns the Z coordinate for a unit vector. | |
| constexpr const gp_XYZ & | XYZ () const noexcept |
| for this unit vector, returns its three coordinates as a number triple. | |
| bool | IsEqual (const gp_Dir &theOther, const double theAngularTolerance) const |
| Returns True if the angle between the two directions is lower or equal to theAngularTolerance. | |
| bool | IsNormal (const gp_Dir &theOther, const double theAngularTolerance) const |
| Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 (normal). | |
| bool | IsOpposite (const gp_Dir &theOther, const double theAngularTolerance) const |
| Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi (opposite). | |
| bool | IsParallel (const gp_Dir &theOther, const double theAngularTolerance) const |
| Returns true if the angle between this unit vector and the unit vector theOther is equal to 0 or to Pi. Note: the tolerance criterion is given by theAngularTolerance. | |
| double | Angle (const gp_Dir &theOther) const |
| Computes the angular value in radians between <me> and <theOther>. This value is always positive in 3D space. Returns the angle in the range [0, PI]. | |
| double | AngleWithRef (const gp_Dir &theOther, const gp_Dir &theVRef) const |
| Computes the angular value between <me> and <theOther>. <theVRef> is the direction of reference normal to <me> and <theOther> and its orientation gives the positive sense of rotation. If the cross product <me> ^ <theOther> has the same orientation as <theVRef> the angular value is positive else negative. Returns the angular value in the range -PI and PI (in radians). Raises DomainError if <me> and <theOther> are not parallel this exception is raised when <theVRef> is in the same plane as <me> and <theOther> The tolerance criterion is Resolution from package gp. | |
| constexpr void | Cross (const gp_Dir &theRight) |
| Computes the cross product between two directions Raises the exception ConstructionError if the two directions are parallel because the computed vector cannot be normalized to create a direction. | |
| constexpr void | operator^= (const gp_Dir &theRight) |
| constexpr gp_Dir | Crossed (const gp_Dir &theRight) const |
| Computes the triple vector product. <me> ^ (V1 ^ V2) Raises the exception ConstructionError if V1 and V2 are parallel or <me> and (V1^V2) are parallel because the computed vector can't be normalized to create a direction. | |
| constexpr gp_Dir | operator^ (const gp_Dir &theRight) const |
| constexpr void | CrossCross (const gp_Dir &theV1, const gp_Dir &theV2) |
| constexpr gp_Dir | CrossCrossed (const gp_Dir &theV1, const gp_Dir &theV2) const |
| Computes the double vector product this ^ (theV1 ^ theV2). | |
| constexpr double | Dot (const gp_Dir &theOther) const noexcept |
| Computes the scalar product. | |
| constexpr double | operator* (const gp_Dir &theOther) const noexcept |
| constexpr double | DotCross (const gp_Dir &theV1, const gp_Dir &theV2) const noexcept |
| 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. | |
| constexpr void | Reverse () noexcept |
| constexpr gp_Dir | Reversed () const noexcept |
| 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. | |
| constexpr gp_Dir | operator- () const noexcept |
| void | Mirror (const gp_Dir &theV) noexcept |
| gp_Dir | Mirrored (const gp_Dir &theV) const noexcept |
| Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry. | |
| void | Mirror (const gp_Ax1 &theA1) noexcept |
| gp_Dir | Mirrored (const gp_Ax1 &theA1) const noexcept |
| Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry. | |
| void | Mirror (const gp_Ax2 &theA2) noexcept |
| gp_Dir | Mirrored (const gp_Ax2 &theA2) const noexcept |
| Performs the symmetrical transformation of a direction with respect to a plane. The axis placement theA2 locates the plane of the symmetry : (Location, XDirection, YDirection). | |
| void | Rotate (const gp_Ax1 &theA1, const double theAng) |
| gp_Dir | Rotated (const gp_Ax1 &theA1, const double theAng) const |
| Rotates a direction. theA1 is the axis of the rotation. theAng is the angular value of the rotation in radians. | |
| void | Transform (const gp_Trsf &theT) |
| gp_Dir | Transformed (const gp_Trsf &theT) const |
| Transforms a direction with a "Trsf" from gp. Warnings : If the scale factor of the "Trsf" theT is negative then the direction <me> is reversed. | |
| void | DumpJson (Standard_OStream &theOStream, int theDepth=-1) const |
| Dumps the content of me into the stream. | |
| bool | InitFromJson (const Standard_SStream &theSStream, int &theStreamPos) |
| Inits the content of me from the stream. | |
Describes a unit vector in 3D space. This unit vector is also called "Direction". See Also gce_MakeDir which provides functions for more complex unit vector constructions Geom_Direction which provides additional functions for constructing unit vectors and works, in particular, with the parametric equations of unit vectors.
Standard directions in 3D space for optimized constexpr construction.
|
inlineconstexprnoexcept |
Creates a direction corresponding to X axis.
Creates a direction from a standard direction enumeration.
Normalizes the vector theV and creates a direction. Raises ConstructionError if theV.Magnitude() <= Resolution.
Creates a direction from a triplet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp.
|
inlineconstexpr |
Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if std::sqrt(theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution Modification of the direction's coordinates If std::sqrt (theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution from gp where theXv, theYv ,theZv are the new coordinates it is not possible to construct the direction and the method raises the exception ConstructionError.
Computes the angular value in radians between <me> and <theOther>. This value is always positive in 3D space. Returns the angle in the range [0, PI].
Computes the angular value between <me> and <theOther>. <theVRef> is the direction of reference normal to <me> and <theOther> and its orientation gives the positive sense of rotation. If the cross product <me> ^ <theOther> has the same orientation as <theVRef> the angular value is positive else negative. Returns the angular value in the range -PI and PI (in radians). Raises DomainError if <me> and <theOther> are not parallel this exception is raised when <theVRef> is in the same plane as <me> and <theOther> The tolerance criterion is Resolution from package gp.
Returns the coordinate of range theIndex : theIndex = 1 => X is returned theIndex = 2 => Y is returned theIndex = 3 => Z is returned Exceptions Standard_OutOfRange if theIndex is not 1, 2, or 3.
|
inlineconstexprnoexcept |
Returns for the unit vector its three coordinates theXv, theYv, and theZv.
Computes the cross product between two directions Raises the exception ConstructionError if the two directions are parallel because the computed vector cannot be normalized to create a direction.
|
inlineconstexpr |
Computes the double vector product this ^ (theV1 ^ theV2).
Computes the triple vector product. <me> ^ (V1 ^ V2) Raises the exception ConstructionError if V1 and V2 are parallel or <me> and (V1^V2) are parallel because the computed vector can't be normalized to create a direction.
Computes the scalar product.
|
inlineconstexprnoexcept |
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.
| void gp_Dir::DumpJson | ( | Standard_OStream & | theOStream, |
| int | theDepth = -1 ) const |
Dumps the content of me into the stream.
| bool gp_Dir::InitFromJson | ( | const Standard_SStream & | theSStream, |
| int & | theStreamPos ) |
Inits the content of me from the stream.
Returns True if the angle between the two directions is lower or equal to theAngularTolerance.
Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 (normal).
Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi (opposite).
Returns true if the angle between this unit vector and the unit vector theOther is equal to 0 or to Pi. Note: the tolerance criterion is given by theAngularTolerance.
Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry.
Performs the symmetrical transformation of a direction with respect to a plane. The axis placement theA2 locates the plane of the symmetry : (Location, XDirection, YDirection).
Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry.
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.
Rotates a direction. theA1 is the axis of the rotation. theAng is the angular value of the rotation in radians.
|
inlineconstexpr |
For this unit vector, assigns the values theXv, theYv and theZv to its three coordinates. Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly.
For this unit vector, assigns the value Xi to:
Assigns the given value to the X coordinate of this unit vector.
Assigns the three coordinates of theCoord to this unit vector.
Assigns the given value to the Y coordinate of this unit vector.
Assigns the given value to the Z coordinate of this unit vector.
Transforms a direction with a "Trsf" from gp. Warnings : If the scale factor of the "Trsf" theT is negative then the direction <me> is reversed.
Returns the X coordinate for a unit vector.
for this unit vector, returns its three coordinates as a number triple.
Returns the Y coordinate for a unit vector.
Returns the Z coordinate for a unit vector.