OpenLexocad
27.0
|
#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::XYZ & | xyz () 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 () |
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.
Geom::Dir::Dir | ( | ) |
Creates an indefinite direction.
Geom::Dir::Dir | ( | const Geom::Vec & | V | ) |
Normalizes the vector V and creates a direction. Raises ConstructionError if V.Magnitude() <= Resolution.
Geom::Dir::Dir | ( | const Geom::XYZ & | Coord | ) |
Creates a direction from a triplet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
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.
Geom::Dir::Dir | ( | const Dir & | rhs | ) |
Copy constructor.
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]
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.
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.
void Geom::Dir::coord | ( | double & | Xv, |
double & | Yv, | ||
double & | Zv | ||
) | const |
Returns for the unit vector its three coordinates Xv, Yv, and Zv.
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.
Computes the double vector product this ^ (V1 ^ V2).
V1 and V2 are parallel, or
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.
double Geom::Dir::dot | ( | const Dir & | Other | ) | const |
Computes the scalar product
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.
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.
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).
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).
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.
void Geom::Dir::mirror | ( | const Dir & | V | ) |
void Geom::Dir::mirror | ( | const Geom::Ax1 & | A1 | ) |
void Geom::Dir::mirror | ( | const Geom::Ax2 & | A2 | ) |
Performs the symmetrical transformation of a direction
with respect to the direction V which is the center of
the symmetry.
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 A2 locates
the plane of the symmetry : (Location, XDirection, YDirection).
|
inline |
|
inline |
bool Geom::Dir::operator== | ( | const Geom::Dir & | other | ) | const |
Checks whether two points are equal within linear tolerance (default 1E-07)
double& Geom::Dir::operator[] | ( | int | i | ) |
const double& Geom::Dir::operator[] | ( | int | i | ) | const |
|
inline |
void Geom::Dir::reverse | ( | ) |
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.]
void Geom::Dir::rotate | ( | const Geom::Ax1 & | A1, |
const double | Ang | ||
) |
Rotates a direction. A1 is the axis of the rotation.
Ang is the angular value of the rotation in radians.
void Geom::Dir::setCoord | ( | const int | Index, |
const double | Xi | ||
) |
For this unit vector, assigns the value Xi to:
Sqrt(Xv*Xv + Yv*Yv + Zv*Zv), or
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.
void Geom::Dir::setX | ( | const double | X | ) |
Assigns the given value to the X coordinate of this unit vector.
void Geom::Dir::setXYZ | ( | const Geom::XYZ & | Coord | ) |
Assigns the three coordinates of Coord to this unit vector.
void Geom::Dir::setY | ( | const double | Y | ) |
Assigns the given value to the Y coordinate of this unit vector.
void Geom::Dir::setZ | ( | const double | Z | ) |
Assigns the given value to the Z coordinate of this unit vector.
void Geom::Dir::transform | ( | const Geom::Trsf & | T | ) |
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.
double Geom::Dir::x | ( | ) | const |
Returns the X coordinate for a unit vector.
|
inlinestatic |
const Geom::XYZ& Geom::Dir::xyz | ( | ) | const |
for this unit vector, returns its three coordinates as a number triplea.
double Geom::Dir::y | ( | ) | const |
Returns the Y coordinate for a unit vector.
|
inlinestatic |
double Geom::Dir::z | ( | ) | const |
Returns the Z coordinate for a unit vector.
|
inlinestatic |