Open CASCADE Technology 7.8.0
Public Member Functions
gp_Dir Class Reference

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 Member Functions

 gp_Dir ()
 Creates a direction corresponding to X axis.
 
 gp_Dir (const gp_Vec &theV)
 Normalizes the vector theV and creates a direction. Raises ConstructionError if theV.Magnitude() <= Resolution.
 
 gp_Dir (const gp_XYZ &theCoord)
 Creates a direction from a triplet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp.
 
 gp_Dir (const Standard_Real theXv, const Standard_Real theYv, const Standard_Real theZv)
 Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if Sqrt(theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution Modification of the direction's coordinates If 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.
 
void SetCoord (const Standard_Integer theIndex, const Standard_Real theXi)
 For this unit vector, assigns the value Xi to:
 
void SetCoord (const Standard_Real theXv, const Standard_Real theYv, const Standard_Real 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.
 
void SetX (const Standard_Real theX)
 Assigns the given value to the X coordinate of this unit vector.
 
void SetY (const Standard_Real theY)
 Assigns the given value to the Y coordinate of this unit vector.
 
void SetZ (const Standard_Real theZ)
 Assigns the given value to the Z coordinate of this unit vector.
 
void SetXYZ (const gp_XYZ &theCoord)
 Assigns the three coordinates of theCoord to this unit vector.
 
Standard_Real Coord (const Standard_Integer theIndex) const
 Returns the coordinate of range theIndex : theIndex = 1 => X is returned Ithendex = 2 => Y is returned theIndex = 3 => Z is returned Exceptions Standard_OutOfRange if theIndex is not 1, 2, or 3.
 
void Coord (Standard_Real &theXv, Standard_Real &theYv, Standard_Real &theZv) const
 Returns for the unit vector its three coordinates theXv, theYv, and theZv.
 
Standard_Real X () const
 Returns the X coordinate for a unit vector.
 
Standard_Real Y () const
 Returns the Y coordinate for a unit vector.
 
Standard_Real Z () const
 Returns the Z coordinate for a unit vector.
 
const gp_XYZXYZ () const
 for this unit vector, returns its three coordinates as a number triplea.
 
Standard_Boolean IsEqual (const gp_Dir &theOther, const Standard_Real theAngularTolerance) const
 Returns True if the angle between the two directions is lower or equal to theAngularTolerance.
 
Standard_Boolean IsNormal (const gp_Dir &theOther, const Standard_Real theAngularTolerance) const
 Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 (normal).
 
Standard_Boolean IsOpposite (const gp_Dir &theOther, const Standard_Real theAngularTolerance) const
 Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi (opposite).
 
Standard_Boolean IsParallel (const gp_Dir &theOther, const Standard_Real 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.
 
Standard_Real 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].
 
Standard_Real 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.
 
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.
 
void operator^= (const gp_Dir &theRight)
 
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.
 
gp_Dir operator^ (const gp_Dir &theRight) const
 
void CrossCross (const gp_Dir &theV1, const gp_Dir &theV2)
 
gp_Dir CrossCrossed (const gp_Dir &theV1, const gp_Dir &theV2) const
 Computes the double vector product this ^ (theV1 ^ theV2).
 
Standard_Real Dot (const gp_Dir &theOther) const
 Computes the scalar product.
 
Standard_Real operator* (const gp_Dir &theOther) const
 
Standard_Real DotCross (const gp_Dir &theV1, const gp_Dir &theV2) const
 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 Reverse ()
 
gp_Dir Reversed () const
 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.].
 
gp_Dir operator- () const
 
void Mirror (const gp_Dir &theV)
 
gp_Dir Mirrored (const gp_Dir &theV) const
 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)
 
gp_Dir Mirrored (const gp_Ax1 &theA1) const
 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)
 
gp_Dir Mirrored (const gp_Ax2 &theA2) const
 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 Standard_Real theAng)
 
gp_Dir Rotated (const gp_Ax1 &theA1, const Standard_Real 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, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream.
 
Standard_Boolean InitFromJson (const Standard_SStream &theSStream, Standard_Integer &theStreamPos)
 Inits the content of me from the stream.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ gp_Dir() [1/4]

gp_Dir::gp_Dir ( )
inline

Creates a direction corresponding to X axis.

◆ gp_Dir() [2/4]

gp_Dir::gp_Dir ( const gp_Vec theV)
inline

Normalizes the vector theV and creates a direction. Raises ConstructionError if theV.Magnitude() <= Resolution.

◆ gp_Dir() [3/4]

gp_Dir::gp_Dir ( const gp_XYZ theCoord)
inline

Creates a direction from a triplet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp.

◆ gp_Dir() [4/4]

gp_Dir::gp_Dir ( const Standard_Real  theXv,
const Standard_Real  theYv,
const Standard_Real  theZv 
)
inline

Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if Sqrt(theXv*theXv + theYv*theYv + theZv*theZv) <= Resolution Modification of the direction's coordinates If 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.

Member Function Documentation

◆ Angle()

Standard_Real gp_Dir::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].

◆ AngleWithRef()

Standard_Real gp_Dir::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.

◆ Coord() [1/2]

Standard_Real gp_Dir::Coord ( const Standard_Integer  theIndex) const
inline

Returns the coordinate of range theIndex : theIndex = 1 => X is returned Ithendex = 2 => Y is returned theIndex = 3 => Z is returned Exceptions Standard_OutOfRange if theIndex is not 1, 2, or 3.

◆ Coord() [2/2]

void gp_Dir::Coord ( Standard_Real theXv,
Standard_Real theYv,
Standard_Real theZv 
) const
inline

Returns for the unit vector its three coordinates theXv, theYv, and theZv.

◆ Cross()

void gp_Dir::Cross ( const gp_Dir theRight)
inline

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.

◆ CrossCross()

void gp_Dir::CrossCross ( const gp_Dir theV1,
const gp_Dir theV2 
)
inline

◆ CrossCrossed()

gp_Dir gp_Dir::CrossCrossed ( const gp_Dir theV1,
const gp_Dir theV2 
) const
inline

Computes the double vector product this ^ (theV1 ^ theV2).

  • CrossCrossed creates a new unit vector. Exceptions Standard_ConstructionError if:
  • theV1 and theV2 are parallel, or
  • this unit vector and (theV1 ^ theV2) are parallel. This is because, in these conditions, the computed vector is null and cannot be normalized.

◆ Crossed()

gp_Dir gp_Dir::Crossed ( const gp_Dir theRight) const
inline

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.

◆ Dot()

Standard_Real gp_Dir::Dot ( const gp_Dir theOther) const
inline

Computes the scalar product.

◆ DotCross()

Standard_Real gp_Dir::DotCross ( const gp_Dir theV1,
const gp_Dir theV2 
) const
inline

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.

◆ DumpJson()

void gp_Dir::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const

Dumps the content of me into the stream.

◆ InitFromJson()

Standard_Boolean gp_Dir::InitFromJson ( const Standard_SStream theSStream,
Standard_Integer theStreamPos 
)

Inits the content of me from the stream.

◆ IsEqual()

Standard_Boolean gp_Dir::IsEqual ( const gp_Dir theOther,
const Standard_Real  theAngularTolerance 
) const
inline

Returns True if the angle between the two directions is lower or equal to theAngularTolerance.

◆ IsNormal()

Standard_Boolean gp_Dir::IsNormal ( const gp_Dir theOther,
const Standard_Real  theAngularTolerance 
) const
inline

Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 (normal).

◆ IsOpposite()

Standard_Boolean gp_Dir::IsOpposite ( const gp_Dir theOther,
const Standard_Real  theAngularTolerance 
) const
inline

Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi (opposite).

◆ IsParallel()

Standard_Boolean gp_Dir::IsParallel ( const gp_Dir theOther,
const Standard_Real  theAngularTolerance 
) const
inline

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.

◆ Mirror() [1/3]

void gp_Dir::Mirror ( const gp_Ax1 theA1)

◆ Mirror() [2/3]

void gp_Dir::Mirror ( const gp_Ax2 theA2)

◆ Mirror() [3/3]

void gp_Dir::Mirror ( const gp_Dir theV)

◆ Mirrored() [1/3]

gp_Dir gp_Dir::Mirrored ( const gp_Ax1 theA1) const

Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry.

◆ Mirrored() [2/3]

gp_Dir gp_Dir::Mirrored ( const gp_Ax2 theA2) const

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).

◆ Mirrored() [3/3]

gp_Dir gp_Dir::Mirrored ( const gp_Dir theV) const

Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry.

◆ operator*()

Standard_Real gp_Dir::operator* ( const gp_Dir theOther) const
inline

◆ operator-()

gp_Dir gp_Dir::operator- ( ) const
inline

◆ operator^()

gp_Dir gp_Dir::operator^ ( const gp_Dir theRight) const
inline

◆ operator^=()

void gp_Dir::operator^= ( const gp_Dir theRight)
inline

◆ Reverse()

void gp_Dir::Reverse ( )
inline

◆ Reversed()

gp_Dir gp_Dir::Reversed ( ) const
inline

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.].

◆ Rotate()

void gp_Dir::Rotate ( const gp_Ax1 theA1,
const Standard_Real  theAng 
)
inline

◆ Rotated()

gp_Dir gp_Dir::Rotated ( const gp_Ax1 theA1,
const Standard_Real  theAng 
) const
inline

Rotates a direction. theA1 is the axis of the rotation. theAng is the angular value of the rotation in radians.

◆ SetCoord() [1/2]

void gp_Dir::SetCoord ( const Standard_Integer  theIndex,
const Standard_Real  theXi 
)
inline

For this unit vector, assigns the value Xi to:

  • the X coordinate if theIndex is 1, or
  • the Y coordinate if theIndex is 2, or
  • the Z coordinate if theIndex is 3, and then normalizes it. Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_OutOfRange if theIndex is not 1, 2, or 3. Standard_ConstructionError if either of the following is less than or equal to gp::Resolution():
  • Sqrt(Xv*Xv + Yv*Yv + Zv*Zv), or
  • the modulus of the number triple formed by the new value theXi and the two other coordinates of this vector that were not directly modified.

◆ SetCoord() [2/2]

void gp_Dir::SetCoord ( const Standard_Real  theXv,
const Standard_Real  theYv,
const Standard_Real  theZv 
)
inline

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.

◆ SetX()

void gp_Dir::SetX ( const Standard_Real  theX)
inline

Assigns the given value to the X coordinate of this unit vector.

◆ SetXYZ()

void gp_Dir::SetXYZ ( const gp_XYZ theCoord)
inline

Assigns the three coordinates of theCoord to this unit vector.

◆ SetY()

void gp_Dir::SetY ( const Standard_Real  theY)
inline

Assigns the given value to the Y coordinate of this unit vector.

◆ SetZ()

void gp_Dir::SetZ ( const Standard_Real  theZ)
inline

Assigns the given value to the Z coordinate of this unit vector.

◆ Transform()

void gp_Dir::Transform ( const gp_Trsf theT)

◆ Transformed()

gp_Dir gp_Dir::Transformed ( const gp_Trsf theT) const
inline

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.

◆ X()

Standard_Real gp_Dir::X ( ) const
inline

Returns the X coordinate for a unit vector.

◆ XYZ()

const gp_XYZ & gp_Dir::XYZ ( ) const
inline

for this unit vector, returns its three coordinates as a number triplea.

◆ Y()

Standard_Real gp_Dir::Y ( ) const
inline

Returns the Y coordinate for a unit vector.

◆ Z()

Standard_Real gp_Dir::Z ( ) const
inline

Returns the Z coordinate for a unit vector.


The documentation for this class was generated from the following file: