OpenLexocad
28.0
|
#include <Dir2d.h>
Public Member Functions | |
Dir2d () | |
Creates an indefinite Direction. More... | |
Dir2d (const Vec2d &V) | |
Normalizes the vector V and creates a Direction. Raises ConstructionError if V.Magnitude() <= Resolution from gp. More... | |
Dir2d (const XY &Coord) | |
Creates a Direction from a doublet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp. More... | |
Dir2d (const double Xv, const double Yv) | |
Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv) <= Resolution from gp. More... | |
double | angle (const Dir2d &Other) const |
double | coord (const int Index) const |
void | coord (double &Xv, double &Yv) const |
double | crossed (const Dir2d &Right) const |
Computes the cross product between two directions. More... | |
double | dot (const Dir2d &Other) const |
Computes the scalar product More... | |
bool | isEqual (const Dir2d &Other, const double AngularTolerance) const |
bool | isNormal (const Dir2d &Other, const double AngularTolerance) const |
bool | isOpposite (const Dir2d &Other, const double AngularTolerance) const |
bool | isParallel (const Dir2d &Other, const double AngularTolerance) const |
void | mirror (const Dir2d &V) |
void | mirror (const Ax2d &A) |
Dir2d | mirrored (const Ax2d &A) const |
Dir2d | mirrored (const Dir2d &V) const |
Dir2d | operator- () const |
double | operator^ (const Dir2d &Right) const |
double | operator* (const Dir2d &Other) const |
bool | operator== (const Dir2d &other) const |
void | reverse () |
Dir2d | reversed () const |
Reverses the orientation of a direction More... | |
void | rotate (const double Ang) |
Dir2d | rotated (const double Ang) const |
void | setCoord (const int Index, const double Xi) |
void | setCoord (const double Xv, const double Yv) |
void | setX (const double X) |
void | setXY (const XY &Coord) |
void | setY (const double Y) |
void | transform (const Trsf2d &T) |
Dir2d | transformed (const Trsf2d &T) const |
double | x () const |
For this unit vector, returns its x coordinate. More... | |
const XY & | xy () const |
double | y () const |
For this unit vector, returns its y coordinate. More... | |
Describes a unit vector in the plane (2D space). This unit
vector is also called "Direction".
See Also
gce_MakeDir2d which provides functions for more
complex unit vector constructions
Geom2d_Direction which provides additional functions
for constructing unit vectors and works, in particular, with
the parametric equations of unit vectors
Geom::Dir2d::Dir2d | ( | ) |
Creates an indefinite Direction.
Geom::Dir2d::Dir2d | ( | const Vec2d & | V | ) |
Normalizes the vector V and creates a Direction. Raises ConstructionError if V.Magnitude() <= Resolution from gp.
Geom::Dir2d::Dir2d | ( | const XY & | Coord | ) |
Creates a Direction from a doublet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
Geom::Dir2d::Dir2d | ( | const double | Xv, |
const double | Yv | ||
) |
Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv) <= Resolution from gp.
double Geom::Dir2d::angle | ( | const Dir2d & | Other | ) | const |
Computes the angular value in radians between <me> and
<Other>. Returns the angle in the range [-PI, PI].
double Geom::Dir2d::coord | ( | const int | Index | ) | const |
For this unit vector returns the coordinate of range Index :
Index = 1 => x is returned
Index = 2 => y is returned
Raises OutOfRange if Index != {1, 2}.
void Geom::Dir2d::coord | ( | double & | Xv, |
double & | Yv | ||
) | const |
For this unit vector returns its two coordinates Xv and Yv.
Raises OutOfRange if Index != {1, 2}.
double Geom::Dir2d::crossed | ( | const Dir2d & | Right | ) | const |
Computes the cross product between two directions.
double Geom::Dir2d::dot | ( | const Dir2d & | Other | ) | const |
Computes the scalar product
bool Geom::Dir2d::isEqual | ( | const Dir2d & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if the two vectors have the same direction
i.e. the angle between this unit vector and the
unit vector Other is less than or equal to AngularTolerance.
bool Geom::Dir2d::isNormal | ( | const Dir2d & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if the angle between this unit vector and the
unit vector Other is equal to Pi/2 or -Pi/2 (normal)
i.e. abs(abs(<me>.Angle(Other)) - PI/2.) <= AngularTolerance
bool Geom::Dir2d::isOpposite | ( | const Dir2d & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if the angle between this unit vector and the
unit vector Other is equal to Pi or -Pi (opposite).
i.e. PI - abs(<me>.Angle(Other)) <= AngularTolerance
bool Geom::Dir2d::isParallel | ( | const Dir2d & | Other, |
const double | AngularTolerance | ||
) | const |
returns true if if the angle between this unit vector and unit
vector Other is equal to 0, Pi or -Pi.
i.e. abs(Angle(<me>, Other)) <= AngularTolerance or
PI - abs(Angle(<me>, Other)) <= AngularTolerance
void Geom::Dir2d::mirror | ( | const Ax2d & | A | ) |
void Geom::Dir2d::mirror | ( | const Dir2d & | V | ) |
Performs the symmetrical transformation of a direction
with respect to the direction V which is the center of
the symmetry.
|
inline |
|
inline |
|
inline |
|
inline |
void Geom::Dir2d::reverse | ( | ) |
Dir2d Geom::Dir2d::reversed | ( | ) | const |
Reverses the orientation of a direction
void Geom::Dir2d::rotate | ( | const double | Ang | ) |
Dir2d Geom::Dir2d::rotated | ( | const double | Ang | ) | const |
Rotates a direction. Ang is the angular value of
the rotation in radians.
void Geom::Dir2d::setCoord | ( | const double | Xv, |
const double | Yv | ||
) |
For this unit vector, assigns:
void Geom::Dir2d::setCoord | ( | const int | Index, |
const double | Xi | ||
) |
For this unit vector, assigns:
the value Xi to:
void Geom::Dir2d::setX | ( | const double | X | ) |
Assigns the given value to the X coordinate of this unit vector,
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_ConstructionError if either of the following
is less than or equal to Geom::Precision::linear_Resolution():
void Geom::Dir2d::setXY | ( | const XY & | Coord | ) |
Assigns:
void Geom::Dir2d::setY | ( | const double | Y | ) |
Assigns the given value to the Y coordinate of this unit vector,
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_ConstructionError if either of the following
is less than or equal to Geom::Precision::linear_Resolution():
void Geom::Dir2d::transform | ( | const Trsf2d & | T | ) |
double Geom::Dir2d::x | ( | ) | const |
For this unit vector, returns its x coordinate.
const XY& Geom::Dir2d::xy | ( | ) | const |
For this unit vector, returns its two coordinates as a number pair.
//! Comparison between Directions
The precision value is an input data.
double Geom::Dir2d::y | ( | ) | const |
For this unit vector, returns its y coordinate.