OpenLexocad  27.1
Geom::Dir Class Reference

#include <Dir.h>

Public Member Functions

 Dir ()
 Creates an indefinite direction.
More...
 
 Dir (const Geom::Vec &V)
 Normalizes the vector V and creates a direction. Raises ConstructionError if V.Magnitude() <= Resolution.
More...
 
 Dir (const Geom::XYZ &Coord)
 Creates a direction from a triplet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
More...
 
 Dir (const double Xv, const double Yv, const double Zv)
 
 Dir (const Dir &rhs)
 Copy constructor. More...
 
void setCoord (const int Index, const double Xi)
 
void setCoord (const double Xv, const double Yv, const double Zv)
 
void setX (const double X)
 Assigns the given value to the X coordinate of this unit vector.
More...
 
void setY (const double Y)
 Assigns the given value to the Y coordinate of this unit vector.
More...
 
void setZ (const double Z)
 Assigns the given value to the Z coordinate of this unit vector.
More...
 
void setXYZ (const Geom::XYZ &Coord)
 Assigns the three coordinates of Coord to this unit vector.
More...
 
double coord (const int Index) const
 
void coord (double &Xv, double &Yv, double &Zv) const
 Returns for the unit vector its three coordinates Xv, Yv, and Zv.
More...
 
double x () const
 Returns the X coordinate for a unit vector.
More...
 
double y () const
 Returns the Y coordinate for a unit vector.
More...
 
double z () const
 Returns the Z coordinate for a unit vector.
More...
 
const Geom::XYZxyz () const
 for this unit vector, returns its three coordinates as a number triplea.
More...
 
bool isEqual (const Dir &Other, const double AngularTolerance) const
 
bool isNormal (const Dir &Other, const double AngularTolerance) const
 Returns True if the angle between this unit vector and the unit vector Other is equal to Pi/2 (normal).
More...
 
bool isOpposite (const Dir &Other, const double AngularTolerance) const
 Returns True if the angle between this unit vector and the unit vector Other is equal to Pi (opposite).
More...
 
bool isParallel (const Dir &Other, const double AngularTolerance) const
 
double angle (const Dir &Other) const
 
double angleWithRef (const Dir &Other, const Dir &VRef) const
 
void cross (const Dir &Right)
 
void operator^= (const Dir &Right)
 
Dir crossed (const Dir &Right) const
 
Dir operator^ (const Dir &Right) const
 
void crossCross (const Dir &V1, const Dir &V2)
 
Dir crossCrossed (const Dir &V1, const Dir &V2) const
 
double dot (const Dir &Other) const
 Computes the scalar product
More...
 
double operator * (const Dir &Other) const
 
double dotCross (const Dir &V1, const Dir &V2) const
 
void reverse ()
 
Dir reversed () const
 
Dir operator- () const
 
void mirror (const Dir &V)
 
Dir mirrored (const Dir &V) const
 
void mirror (const Geom::Ax1 &A1)
 
Dir mirrored (const Geom::Ax1 &A1) const
 
void mirror (const Geom::Ax2 &A2)
 
Dir mirrored (const Geom::Ax2 &A2) const
 
void rotate (const Geom::Ax1 &A1, const double Ang)
 
Dir rotated (const Geom::Ax1 &A1, const double Ang) const
 
void transform (const Geom::Trsf &T)
 
Dir transformed (const Geom::Trsf &T) const
 
bool operator== (const Geom::Dir &other) const
 Checks whether two points are equal within linear tolerance (default 1E-07) More...
 
double & operator[] (int i)
 
const double & operator[] (int i) const
 

Static Public Member Functions

static Dir XDir ()
 
static Dir YDir ()
 
static Dir ZDir ()
 

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

◆ Dir() [1/5]

Geom::Dir::Dir ( )

Creates an indefinite direction.

◆ Dir() [2/5]

Geom::Dir::Dir ( const Geom::Vec V)

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

◆ Dir() [3/5]

Geom::Dir::Dir ( const Geom::XYZ Coord)

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

◆ Dir() [4/5]

Geom::Dir::Dir ( const double  Xv,
const double  Yv,
const double  Zv 
)

Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv) <= Resolution
//! Modification of the direction's coordinates
If Sqrt (X*X + Y*Y + Z*Z) <= Resolution from gp where
X, Y ,Z are the new coordinates it is not possible to
construct the direction and the method raises the
exception ConstructionError.

◆ Dir() [5/5]

Geom::Dir::Dir ( const Dir rhs)

Copy constructor.

Member Function Documentation

◆ angle()

double Geom::Dir::angle ( const Dir Other) const

Computes the angular value in radians between <me> and
<Other>. This value is always positive in 3D space.
Returns the angle in the range [0, PI]

◆ angleWithRef()

double Geom::Dir::angleWithRef ( const Dir Other,
const Dir VRef 
) const

Computes the angular value between <me> and <Other>.
<VRef> is the direction of reference normal to <me> and <Other>
and its orientation gives the positive sense of rotation.
If the cross product <me> ^ <Other> has the same orientation
as <VRef> the angular value is positive else negative.
Returns the angular value in the range -PI and PI (in radians). Raises DomainError if <me> and <Other> are not parallel this exception is raised
when <VRef> is in the same plane as <me> and <Other>
The tolerance criterion is Resolution from package gp.

◆ coord() [1/2]

double Geom::Dir::coord ( const int  Index) const

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

◆ coord() [2/2]

void Geom::Dir::coord ( double &  Xv,
double &  Yv,
double &  Zv 
) const

Returns for the unit vector its three coordinates Xv, Yv, and Zv.

◆ cross()

void Geom::Dir::cross ( const Dir Right)

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 Geom::Dir::crossCross ( const Dir V1,
const Dir V2 
)

◆ crossCrossed()

Dir Geom::Dir::crossCrossed ( const Dir V1,
const Dir V2 
) const

Computes the double vector product this ^ (V1 ^ V2).

  • CrossCrossed creates a new unit vector.
    Exceptions
    Standard_ConstructionError if:

V1 and V2 are parallel, or

  • this unit vector and (V1 ^ V2) are parallel.
    This is because, in these conditions, the computed vector
    is null and cannot be normalized.

◆ crossed()

Dir Geom::Dir::crossed ( const Dir Right) 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.

◆ dot()

double Geom::Dir::dot ( const Dir Other) const

Computes the scalar product

◆ dotCross()

double Geom::Dir::dotCross ( const Dir V1,
const Dir V2 
) const

Computes the triple scalar product <me> * (V1 ^ V2).
Warnings :
The computed vector V1' = V1 ^ V2 is not normalized
to create a unitary vector. So this method never
raises an exception even if V1 and V2 are parallel.

◆ isEqual()

bool Geom::Dir::isEqual ( const Dir Other,
const double  AngularTolerance 
) const

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

◆ isNormal()

bool Geom::Dir::isNormal ( const Dir Other,
const double  AngularTolerance 
) const

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

◆ isOpposite()

bool Geom::Dir::isOpposite ( const Dir Other,
const double  AngularTolerance 
) const

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

◆ isParallel()

bool Geom::Dir::isParallel ( const Dir Other,
const double  AngularTolerance 
) const

Returns true if the angle between this unit vector and the
unit vector Other is equal to 0 or to Pi.
Note: the tolerance criterion is given by AngularTolerance.

◆ mirror() [1/3]

void Geom::Dir::mirror ( const Dir V)

◆ mirror() [2/3]

void Geom::Dir::mirror ( const Geom::Ax1 A1)

◆ mirror() [3/3]

void Geom::Dir::mirror ( const Geom::Ax2 A2)

◆ mirrored() [1/3]

Dir Geom::Dir::mirrored ( const Dir V) const

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

◆ mirrored() [2/3]

Dir Geom::Dir::mirrored ( const Geom::Ax1 A1) const

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

◆ mirrored() [3/3]

Dir Geom::Dir::mirrored ( const Geom::Ax2 A2) const

Performs the symmetrical transformation of a direction
with respect to a plane. The axis placement A2 locates
the plane of the symmetry : (Location, XDirection, YDirection).

◆ operator *()

double Geom::Dir::operator * ( const Dir Other) const
inline

◆ operator-()

Dir Geom::Dir::operator- ( void  ) const
inline

◆ operator==()

bool Geom::Dir::operator== ( const Geom::Dir other) const

Checks whether two points are equal within linear tolerance (default 1E-07)

◆ operator[]() [1/2]

double& Geom::Dir::operator[] ( int  i)

◆ operator[]() [2/2]

const double& Geom::Dir::operator[] ( int  i) const

◆ operator^()

Dir Geom::Dir::operator^ ( const Dir Right) const
inline

◆ operator^=()

void Geom::Dir::operator^= ( const Dir Right)
inline

◆ reverse()

void Geom::Dir::reverse ( )

◆ reversed()

Dir Geom::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.]

◆ rotate()

void Geom::Dir::rotate ( const Geom::Ax1 A1,
const double  Ang 
)

◆ rotated()

Dir Geom::Dir::rotated ( const Geom::Ax1 A1,
const double  Ang 
) const

Rotates a direction. A1 is the axis of the rotation.
Ang is the angular value of the rotation in radians.

◆ setCoord() [1/2]

void Geom::Dir::setCoord ( const int  Index,
const double  Xi 
)

For this unit vector, assigns the value Xi to:

  • the X coordinate if Index is 1, or
  • the Y coordinate if Index is 2, or
  • the Z coordinate if Index 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 Index is not 1, 2, or 3.
    Standard_ConstructionError if either of the following
    is less than or equal to Geom::Precision::linear_Resolution():

Sqrt(Xv*Xv + Yv*Yv + Zv*Zv), or

  • the modulus of the number triple formed by the new
    value Xi and the two other coordinates of this vector
    that were not directly modified.

◆ setCoord() [2/2]

void Geom::Dir::setCoord ( const double  Xv,
const double  Yv,
const double  Zv 
)

For this unit vector, assigns the values Xv, Yv and Zv 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 Geom::Dir::setX ( const double  X)

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

◆ setXYZ()

void Geom::Dir::setXYZ ( const Geom::XYZ Coord)

Assigns the three coordinates of Coord to this unit vector.

◆ setY()

void Geom::Dir::setY ( const double  Y)

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

◆ setZ()

void Geom::Dir::setZ ( const double  Z)

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

◆ transform()

void Geom::Dir::transform ( const Geom::Trsf T)

◆ transformed()

Dir Geom::Dir::transformed ( const Geom::Trsf T) const

Transforms a direction with a "Trsf" from gp.
Warnings :
If the scale factor of the "Trsf" T is negative then the
direction <me> is reversed.

◆ x()

double Geom::Dir::x ( ) const

Returns the X coordinate for a unit vector.

◆ XDir()

static Dir Geom::Dir::XDir ( )
inlinestatic

◆ xyz()

const Geom::XYZ& Geom::Dir::xyz ( ) const

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

◆ y()

double Geom::Dir::y ( ) const

Returns the Y coordinate for a unit vector.

◆ YDir()

static Dir Geom::Dir::YDir ( )
inlinestatic

◆ z()

double Geom::Dir::z ( ) const

Returns the Z coordinate for a unit vector.

◆ ZDir()

static Dir Geom::Dir::ZDir ( )
inlinestatic

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