OpenLexocad  27.1
Geom::Dir2d Class Reference

#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 XYxy () const
 
double y () const
 For this unit vector, returns its y coordinate.
More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Dir2d() [1/4]

Geom::Dir2d::Dir2d ( )

Creates an indefinite Direction.

◆ Dir2d() [2/4]

Geom::Dir2d::Dir2d ( const Vec2d V)

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

◆ Dir2d() [3/4]

Geom::Dir2d::Dir2d ( const XY Coord)

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

◆ Dir2d() [4/4]

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.

Member Function Documentation

◆ angle()

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

◆ coord() [1/2]

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

◆ coord() [2/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}.

◆ crossed()

double Geom::Dir2d::crossed ( const Dir2d Right) const

Computes the cross product between two directions.

◆ dot()

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

Computes the scalar product

◆ isEqual()

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.

◆ isNormal()

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

◆ isOpposite()

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

◆ isParallel()

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

◆ mirror() [1/2]

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

◆ mirror() [2/2]

void Geom::Dir2d::mirror ( const Ax2d A)

◆ mirrored() [1/2]

Dir2d Geom::Dir2d::mirrored ( const Ax2d A) const

◆ mirrored() [2/2]

Dir2d Geom::Dir2d::mirrored ( const Dir2d V) const

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

◆ operator *()

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

◆ operator-()

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

◆ operator==()

bool Geom::Dir2d::operator== ( const Dir2d other) const
inline

◆ operator^()

double Geom::Dir2d::operator^ ( const Dir2d Right) const
inline

◆ reverse()

void Geom::Dir2d::reverse ( )

◆ reversed()

Dir2d Geom::Dir2d::reversed ( ) const

Reverses the orientation of a direction

◆ rotate()

void Geom::Dir2d::rotate ( const double  Ang)

◆ rotated()

Dir2d Geom::Dir2d::rotated ( const double  Ang) const

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

◆ setCoord() [1/2]

void Geom::Dir2d::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, 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 or 2.
    Standard_ConstructionError if either of the following
    is less than or equal to Geom::Precision::linear_Resolution():
  • Sqrt(Xv*Xv + Yv*Yv), or
  • the modulus of the number pair formed by the new
    value Xi and the other coordinate of this vector that
    was not directly modified.
    Raises OutOfRange if Index != {1, 2}.

◆ setCoord() [2/2]

void Geom::Dir2d::setCoord ( const double  Xv,
const double  Yv 
)

For this unit vector, assigns:

  • the values Xv and Yv to its two coordinates,
    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 or 2.
    Standard_ConstructionError if either of the following
    is less than or equal to Geom::Precision::linear_Resolution():
  • Sqrt(Xv*Xv + Yv*Yv), or
  • the modulus of the number pair formed by the new
    value Xi and the other coordinate of this vector that
    was not directly modified.
    Raises OutOfRange if Index != {1, 2}.

◆ setX()

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():

  • the modulus of Coord, or
  • the modulus of the number pair formed from the new
    X or Y coordinate and the other coordinate of this
    vector that was not directly modified.

◆ setXY()

void Geom::Dir2d::setXY ( const XY Coord)

Assigns:

  • the two coordinates of Coord to 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():
  • the modulus of Coord, or
  • the modulus of the number pair formed from the new
    x or y coordinate and the other coordinate of this
    vector that was not directly modified.

◆ setY()

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():

  • the modulus of Coord, or
  • the modulus of the number pair formed from the new
    x or Y coordinate and the other coordinate of this
    vector that was not directly modified.

◆ transform()

void Geom::Dir2d::transform ( const Trsf2d T)

◆ transformed()

Dir2d Geom::Dir2d::transformed ( const Trsf2d T) const

◆ x()

double Geom::Dir2d::x ( ) const

For this unit vector, returns its x coordinate.

◆ xy()

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.

◆ y()

double Geom::Dir2d::y ( ) const

For this unit vector, returns its y coordinate.


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