|
OpenLexocad
27.0
|
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 XY & | xy () const |
| For this vector, returns its two coordinates as a number pair More... | |
| double | y () const |
| For this vector, returns its Y coordinate. More... | |
Defines a non-persistent vector in 2D space.
| Geom::Vec2d::Vec2d | ( | ) |
Creates an indefinite vector.
| Geom::Vec2d::Vec2d | ( | const Dir2d & | V | ) |
Creates a unitary vector from a direction V.
| Geom::Vec2d::Vec2d | ( | const XY & | Coord | ) |
Creates a vector with a doublet of coordinates.
| Geom::Vec2d::Vec2d | ( | const double | Xv, |
| const double | Yv | ||
| ) |
Creates a point with its two cartesian coordinates.
Creates a vector from two points. The length of the vector
is the distance between P1 and P2
| void Geom::Vec2d::add | ( | const Vec2d & | Other | ) |
| 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.
| 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}.
| void Geom::Vec2d::coord | ( | double & | Xv, |
| double & | Yv | ||
| ) | const |
For this vector, returns its two coordinates Xv and Yv
| double Geom::Vec2d::crossed | ( | const Vec2d & | Right | ) | const |
Computes the crossing product between two vectors
| double Geom::Vec2d::crossMagnitude | ( | const Vec2d & | Right | ) | const |
Computes the magnitude of the cross product between <me> and
Right. Returns || <me> ^ Right ||
| double Geom::Vec2d::crossSquareMagnitude | ( | const Vec2d & | Right | ) | const |
Computes the square magnitude of the cross product between <me> and
Right. Returns || <me> ^ Right ||**2
| void Geom::Vec2d::divide | ( | const double | Scalar | ) |
| Vec2d Geom::Vec2d::divided | ( | const double | Scalar | ) | const |
divides a vector by a scalar
| double Geom::Vec2d::dot | ( | const Vec2d & | Other | ) | const |
Computes the scalar product
| 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.
| bool Geom::Vec2d::isNormal | ( | const Vec2d & | Other, |
| const double | AngularTolerance | ||
| ) | const |
Returns True if abs(abs(<me>.angle(Other)) - PI/2.) <= AngularTolerance
| bool Geom::Vec2d::isOpposite | ( | const Vec2d & | Other, |
| const double | AngularTolerance | ||
| ) | const |
Returns True if PI - abs(<me>.angle(Other)) <= AngularTolerance
| 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.
| double Geom::Vec2d::magnitude | ( | ) | const |
Computes the magnitude of this vector.
| void Geom::Vec2d::mirror | ( | const Vec2d & | V | ) |
| void Geom::Vec2d::mirror | ( | const Ax2d & | A1 | ) |
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.
| 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.
| void Geom::Vec2d::multiply | ( | const double | Scalar | ) |
| void Geom::Vec2d::normalize | ( | ) |
| 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
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void Geom::Vec2d::reverse | ( | ) |
| Vec2d Geom::Vec2d::reversed | ( | ) | const |
Reverses the direction of a vector
//! Subtracts two vectors
| void Geom::Vec2d::rotate | ( | const double | Ang | ) |
| Vec2d Geom::Vec2d::rotated | ( | const double | Ang | ) | const |
Rotates a vector. Ang is the angular value of the
rotation in radians.
| void Geom::Vec2d::scale | ( | const double | S | ) |
| Vec2d Geom::Vec2d::scaled | ( | const double | S | ) | const |
Scales a vector. S is the scaling value.
| 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}.
| void Geom::Vec2d::setCoord | ( | const double | Xv, |
| const double | Yv | ||
| ) |
For this vector, assigns
the values Xv and Yv to its two coordinates
| 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
| 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
<me> is setted to the following linear form : A1 * V1 + V2
<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.
| void Geom::Vec2d::setX | ( | const double | X | ) |
Assigns the given value to the X coordinate of this vector.
| void Geom::Vec2d::setXY | ( | const XY & | Coord | ) |
Assigns the two coordinates of Coord to this vector.
| void Geom::Vec2d::setY | ( | const double | Y | ) |
Assigns the given value to the Y coordinate of this vector.
| double Geom::Vec2d::squareMagnitude | ( | ) | const |
Computes the square magnitude of this vector.
| void Geom::Vec2d::subtract | ( | const Vec2d & | Right | ) |
| void Geom::Vec2d::transform | ( | const Trsf2d & | T | ) |
| double Geom::Vec2d::x | ( | ) | const |
For this vector, returns its X coordinate.
| const XY& Geom::Vec2d::xy | ( | ) | const |
For this vector, returns its two coordinates as a number pair
| double Geom::Vec2d::y | ( | ) | const |
For this vector, returns its Y coordinate.