OpenLexocad  27.1
Geom::Vec2d Class Reference

Defines a non-persistent vector in 2D space.
More...

#include <Vec2d.h>

Public Member Functions

 Vec2d ()
 Creates an indefinite vector.
More...
 
 Vec2d (const Dir2d &V)
 Creates a unitary vector from a direction V.
More...
 
 Vec2d (const XY &Coord)
 Creates a vector with a doublet of coordinates.
More...
 
 Vec2d (const double Xv, const double Yv)
 Creates a point with its two cartesian coordinates.
More...
 
 Vec2d (const Pnt2d &P1, const Pnt2d &P2)
 
void add (const Vec2d &Other)
 
Vec2d added (const Vec2d &Other) const
 Adds two vectors
More...
 
double angle (const Vec2d &Other) const
 
double coord (const int Index) const
 
void coord (double &Xv, double &Yv) const
 For this vector, returns its two coordinates Xv and Yv
More...
 
double crossed (const Vec2d &Right) const
 Computes the crossing product between two vectors
More...
 
double crossMagnitude (const Vec2d &Right) const
 
double crossSquareMagnitude (const Vec2d &Right) const
 
void divide (const double Scalar)
 
Vec2d divided (const double Scalar) const
 divides a vector by a scalar
More...
 
double dot (const Vec2d &Other) const
 Computes the scalar product
More...
 
bool isEqual (const Vec2d &Other, const double LinearTolerance, const double AngularTolerance) const
 
bool isNormal (const Vec2d &Other, const double AngularTolerance) const
 Returns True if abs(abs(<me>.angle(Other)) - PI/2.) <= AngularTolerance
More...
 
bool isOpposite (const Vec2d &Other, const double AngularTolerance) const
 Returns True if PI - abs(<me>.angle(Other)) <= AngularTolerance
More...
 
bool isParallel (const Vec2d &Other, const double AngularTolerance) const
 
double magnitude () const
 Computes the magnitude of this vector.
More...
 
double squareMagnitude () const
 Computes the square magnitude of this vector.
More...
 
void operator+= (const Vec2d &Other)
 
Vec2d operator+ (const Vec2d &Other) const
 
void operator-= (const Vec2d &Right)
 
Vec2d operator- () const
 
Vec2d operator- (const Vec2d &Right) const
 
void operator *= (const double Scalar)
 
double operator * (const Vec2d &Other) const
 
Vec2d operator * (const double Scalar) const
 
void operator/= (const double Scalar)
 
Vec2d operator/ (const double Scalar) const
 
double operator^ (const Vec2d &Right) const
 
void multiply (const double Scalar)
 
Vec2d multiplied (const double Scalar) const
 
void mirror (const Vec2d &V)
 
void mirror (const Ax2d &A1)
 
Vec2d mirrored (const Ax2d &A1) const
 
Vec2d mirrored (const Vec2d &V) const
 
void normalize ()
 
Vec2d normalized () const
 
void reverse ()
 
Vec2d reversed () const
 Reverses the direction of a vector
//! Subtracts two vectors
More...
 
void rotate (const double Ang)
 
Vec2d rotated (const double Ang) const
 
void scale (const double S)
 
Vec2d scaled (const double S) const
 Scales a vector. S is the scaling value.
More...
 
void setCoord (const int Index, const double Xi)
 
void setCoord (const double Xv, const double Yv)
 
void setLinearForm (const double A1, const Vec2d &V1, const double A2, const Vec2d &V2, const Vec2d &V3)
 
void setLinearForm (const double A1, const Vec2d &V1, const double A2, const Vec2d &V2)
 <me> is setted to the following linear form : A1 * V1 + A2 * V2
More...
 
void setLinearForm (const double A1, const Vec2d &V1, const Vec2d &V2)
 <me> is setted to the following linear form : A1 * V1 + V2
More...
 
void setLinearForm (const Vec2d &Left, const Vec2d &Right)
 
void setX (const double X)
 Assigns the given value to the X coordinate of this vector.
More...
 
void setXY (const XY &Coord)
 Assigns the two coordinates of Coord to this vector.
More...
 
void setY (const double Y)
 Assigns the given value to the Y coordinate of this vector.
More...
 
void subtract (const Vec2d &Right)
 
Vec2d subtracted (const Vec2d &Right) const
 Subtracts two vectors
More...
 
void transform (const Trsf2d &T)
 
Vec2d transformed (const Trsf2d &T) const
 
double x () const
 For this vector, returns its X coordinate.
More...
 
const XYxy () const
 For this vector, returns its two coordinates as a number pair
More...
 
double y () const
 For this vector, returns its Y coordinate.
More...
 

Detailed Description

Defines a non-persistent vector in 2D space.

Constructor & Destructor Documentation

◆ Vec2d() [1/5]

Geom::Vec2d::Vec2d ( )

Creates an indefinite vector.

◆ Vec2d() [2/5]

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

Creates a unitary vector from a direction V.

◆ Vec2d() [3/5]

Geom::Vec2d::Vec2d ( const XY Coord)

Creates a vector with a doublet of coordinates.

◆ Vec2d() [4/5]

Geom::Vec2d::Vec2d ( const double  Xv,
const double  Yv 
)

Creates a point with its two cartesian coordinates.

◆ Vec2d() [5/5]

Geom::Vec2d::Vec2d ( const Pnt2d P1,
const Pnt2d P2 
)

Creates a vector from two points. The length of the vector
is the distance between P1 and P2

Member Function Documentation

◆ add()

void Geom::Vec2d::add ( const Vec2d Other)

◆ added()

Vec2d Geom::Vec2d::added ( const Vec2d Other) const

Adds two vectors

◆ angle()

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

Computes the angular value between <me> and <Other>
returns the angle value between -PI and PI in radian.
The orientation is from <me> to Other. The positive sense is the
trigonometric sense.

◆ coord() [1/2]

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

Returns the coordinate of range Index :
Index = 1 => X is returned
Index = 2 => Y is returned
//! Raised if Index != {1, 2}.

◆ coord() [2/2]

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

For this vector, returns its two coordinates Xv and Yv

◆ crossed()

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

Computes the crossing product between two vectors

◆ crossMagnitude()

double Geom::Vec2d::crossMagnitude ( const Vec2d Right) const

Computes the magnitude of the cross product between <me> and
Right. Returns || <me> ^ Right ||

◆ crossSquareMagnitude()

double Geom::Vec2d::crossSquareMagnitude ( const Vec2d Right) const

Computes the square magnitude of the cross product between <me> and
Right. Returns || <me> ^ Right ||**2

◆ divide()

void Geom::Vec2d::divide ( const double  Scalar)

◆ divided()

Vec2d Geom::Vec2d::divided ( const double  Scalar) const

divides a vector by a scalar

◆ dot()

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

Computes the scalar product

◆ isEqual()

bool Geom::Vec2d::isEqual ( const Vec2d Other,
const double  LinearTolerance,
const double  AngularTolerance 
) const

Returns True if the two vectors have the same magnitude value
and the same direction. The precision values are LinearTolerance
for the magnitude and AngularTolerance for the direction.

◆ isNormal()

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

Returns True if abs(abs(<me>.angle(Other)) - PI/2.) <= AngularTolerance

◆ isOpposite()

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

Returns True if PI - abs(<me>.angle(Other)) <= AngularTolerance

◆ isParallel()

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

Returns true if abs(angle(<me>, Other)) <= AngularTolerance or
PI - abs(angle(<me>, Other)) <= AngularTolerance
Two vectors with opposite directions are considered as parallel.

◆ magnitude()

double Geom::Vec2d::magnitude ( ) const

Computes the magnitude of this vector.

◆ mirror() [1/2]

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

◆ mirror() [2/2]

void Geom::Vec2d::mirror ( const Ax2d A1)

◆ mirrored() [1/2]

Vec2d Geom::Vec2d::mirrored ( const Ax2d A1) const

◆ mirrored() [2/2]

Vec2d Geom::Vec2d::mirrored ( const Vec2d V) const

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

◆ multiplied()

Vec2d Geom::Vec2d::multiplied ( const double  Scalar) const

Normalizes a vector
Raises an exception if the magnitude of the vector is
lower or equal to Resolution from package gp.

◆ multiply()

void Geom::Vec2d::multiply ( const double  Scalar)

◆ normalize()

void Geom::Vec2d::normalize ( )

◆ normalized()

Vec2d Geom::Vec2d::normalized ( ) const

Normalizes a vector
Raises an exception if the magnitude of the vector is
lower or equal to Resolution from package gp.
//! Reverses the direction of a vector

◆ operator *() [1/2]

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

◆ operator *() [2/2]

Vec2d Geom::Vec2d::operator * ( const double  Scalar) const
inline

◆ operator *=()

void Geom::Vec2d::operator *= ( const double  Scalar)
inline

◆ operator+()

Vec2d Geom::Vec2d::operator+ ( const Vec2d Other) const
inline

◆ operator+=()

void Geom::Vec2d::operator+= ( const Vec2d Other)
inline

◆ operator-() [1/2]

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

◆ operator-() [2/2]

Vec2d Geom::Vec2d::operator- ( const Vec2d Right) const
inline

◆ operator-=()

void Geom::Vec2d::operator-= ( const Vec2d Right)
inline

◆ operator/()

Vec2d Geom::Vec2d::operator/ ( const double  Scalar) const
inline

◆ operator/=()

void Geom::Vec2d::operator/= ( const double  Scalar)
inline

◆ operator^()

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

◆ reverse()

void Geom::Vec2d::reverse ( )

◆ reversed()

Vec2d Geom::Vec2d::reversed ( ) const

Reverses the direction of a vector
//! Subtracts two vectors

◆ rotate()

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

◆ rotated()

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

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

◆ scale()

void Geom::Vec2d::scale ( const double  S)

◆ scaled()

Vec2d Geom::Vec2d::scaled ( const double  S) const

Scales a vector. S is the scaling value.

◆ setCoord() [1/2]

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

Changes the coordinate of range Index
Index = 1 => X is modified
Index = 2 => Y is modified
Raises OutOfRange if Index != {1, 2}.

◆ setCoord() [2/2]

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

For this vector, assigns
the values Xv and Yv to its two coordinates

◆ setLinearForm() [1/4]

void Geom::Vec2d::setLinearForm ( const double  A1,
const Vec2d V1,
const double  A2,
const Vec2d V2,
const Vec2d V3 
)

<me> is setted to the following linear form :
A1 * V1 + A2 * V2 + V3

◆ setLinearForm() [2/4]

void Geom::Vec2d::setLinearForm ( const double  A1,
const Vec2d V1,
const double  A2,
const Vec2d V2 
)

<me> is setted to the following linear form : A1 * V1 + A2 * V2

◆ setLinearForm() [3/4]

void Geom::Vec2d::setLinearForm ( const double  A1,
const Vec2d V1,
const Vec2d V2 
)

<me> is setted to the following linear form : A1 * V1 + V2

◆ setLinearForm() [4/4]

void Geom::Vec2d::setLinearForm ( const Vec2d Left,
const Vec2d Right 
)

<me> is setted to the following linear form : Left + Right
Performs the symmetrical transformation of a vector
with respect to the vector V which is the center of
the symmetry.

◆ setX()

void Geom::Vec2d::setX ( const double  X)

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

◆ setXY()

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

Assigns the two coordinates of Coord to this vector.

◆ setY()

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

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

◆ squareMagnitude()

double Geom::Vec2d::squareMagnitude ( ) const

Computes the square magnitude of this vector.

◆ subtract()

void Geom::Vec2d::subtract ( const Vec2d Right)

◆ subtracted()

Vec2d Geom::Vec2d::subtracted ( const Vec2d Right) const

Subtracts two vectors

◆ transform()

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

◆ transformed()

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

◆ x()

double Geom::Vec2d::x ( ) const

For this vector, returns its X coordinate.

◆ xy()

const XY& Geom::Vec2d::xy ( ) const

For this vector, returns its two coordinates as a number pair

◆ y()

double Geom::Vec2d::y ( ) const

For this vector, returns its Y coordinate.


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