OpenLexocad
27.0
|
Defines a non-persistent vector in 3D space.
More...
#include <Vec.h>
Public Member Functions | |
Vec () | |
Creates an indefinite vector. More... | |
Vec (const Geom::Dir &V) | |
Creates a unitary vector from a direction V. More... | |
Vec (const Geom::XYZ &Coord) | |
Creates a vector with a triplet of coordinates. More... | |
Vec (const double Xv, const double Yv, const double Zv) | |
Creates a point with its three Cartesian coordinates. More... | |
Vec (const Geom::Pnt &P1, const Geom::Pnt &P2) | |
Vec (const Vec &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 vector. More... | |
void | setY (const double Y) |
Assigns the given value to the X coordinate of this vector. More... | |
void | setZ (const double Z) |
Assigns the given value to the X coordinate of this vector. More... | |
void | setXYZ (const Geom::XYZ &Coord) |
Assigns the three coordinates of Coord to this vector. More... | |
double | coord (const int Index) const |
void | coord (double &Xv, double &Yv, double &Zv) const |
For this vector returns its three coordinates Xv, Yv, and Zvinline More... | |
double | x () const |
For this vector, returns its X coordinate. More... | |
double | y () const |
For this vector, returns its Y coordinate. More... | |
double | z () const |
For this vector, returns its Z coordinate. More... | |
const Geom::XYZ & | xyz () const |
bool | isEqual (const Vec &Other, const double LinearTolerance, const double AngularTolerance) const |
bool | isNormal (const Vec &Other, const double AngularTolerance) const |
bool | isOpposite (const Vec &Other, const double AngularTolerance) const |
bool | isParallel (const Vec &Other, const double AngularTolerance) const |
double | angle (const Vec &Other) const |
double | angleWithRef (const Vec &Other, const Vec &VRef) const |
double | magnitude () const |
Computes the magnitude of this vector. More... | |
double | squareMagnitude () const |
Computes the square magnitude of this vector. //! Adds two vectors More... | |
void | add (const Vec &Other) |
void | operator+= (const Vec &Other) |
Vec | added (const Vec &Other) const |
Adds two vectors //! Subtracts two vectors More... | |
Vec | operator+ (const Vec &Other) const |
void | subtract (const Vec &Right) |
void | operator-= (const Vec &Right) |
Vec | subtracted (const Vec &Right) const |
Subtracts two vectors //! Multiplies a vector by a scalar More... | |
Vec | operator- (const Vec &Right) const |
void | multiply (const double Scalar) |
void | operator *= (const double Scalar) |
Vec | multiplied (const double Scalar) const |
Multiplies a vector by a scalar //! Divides a vector by a scalar More... | |
Vec | operator * (const double Scalar) const |
void | divide (const double Scalar) |
void | operator/= (const double Scalar) |
Vec | divided (const double Scalar) const |
Divides a vector by a scalar //! computes the cross product between two vectors More... | |
Vec | operator/ (const double Scalar) const |
void | cross (const Vec &Right) |
void | operator^= (const Vec &Right) |
Vec | crossed (const Vec &Right) const |
computes the cross product between two vectors More... | |
Vec | operator^ (const Vec &Right) const |
double | crossMagnitude (const Vec &Right) const |
double | crossSquareMagnitude (const Vec &Right) const |
void | crossCross (const Vec &V1, const Vec &V2) |
Vec | crossCrossed (const Vec &V1, const Vec &V2) const |
double | dot (const Vec &Other) const |
computes the scalar product More... | |
double | operator * (const Vec &Other) const |
double | dotCross (const Vec &V1, const Vec &V2) const |
void | normalize () |
Vec | normalized () const |
void | reverse () |
Vec | reversed () const |
Reverses the direction of a vector More... | |
Vec | operator- () const |
void | setLinearForm (const double A1, const Vec &V1, const double A2, const Vec &V2, const double A3, const Vec &V3, const Vec &V4) |
void | setLinearForm (const double A1, const Vec &V1, const double A2, const Vec &V2, const double A3, const Vec &V3) |
void | setLinearForm (const double A1, const Vec &V1, const double A2, const Vec &V2, const Vec &V3) |
void | setLinearForm (const double A1, const Vec &V1, const double A2, const Vec &V2) |
void | setLinearForm (const double A1, const Vec &V1, const Vec &V2) |
<me> is setted to the following linear form : A1 * V1 + V2 More... | |
void | setLinearForm (const Vec &V1, const Vec &V2) |
<me> is setted to the following linear form : V1 + V2 More... | |
void | mirror (const Vec &V) |
Vec | mirrored (const Vec &V) const |
void | mirror (const Geom::Ax1 &A1) |
Vec | mirrored (const Geom::Ax1 &A1) const |
void | mirror (const Geom::Ax2 &A2) |
Vec | mirrored (const Geom::Ax2 &A2) const |
void | rotate (const Geom::Ax1 &A1, const double Ang) |
Vec | rotated (const Geom::Ax1 &A1, const double Ang) const |
void | scale (const double S) |
Vec | scaled (const double S) const |
Scales a vector. S is the scaling value. //! Transforms a vector with the transformation T. More... | |
void | transform (const Geom::Trsf &T) |
Vec | transformed (const Geom::Trsf &T) const |
Transforms a vector with the transformation T. More... | |
double & | operator[] (int i) |
Defines a non-persistent vector in 3D space.
Geom::Vec::Vec | ( | ) |
Creates an indefinite vector.
Geom::Vec::Vec | ( | const Geom::Dir & | V | ) |
Creates a unitary vector from a direction V.
Geom::Vec::Vec | ( | const Geom::XYZ & | Coord | ) |
Creates a vector with a triplet of coordinates.
Geom::Vec::Vec | ( | const double | Xv, |
const double | Yv, | ||
const double | Zv | ||
) |
Creates a point with its three Cartesian coordinates.
Creates a vector from two points. The length of the vector
is the distance between P1 and P2
Geom::Vec::Vec | ( | const Vec & | rhs | ) |
Copy constructor.
void Geom::Vec::add | ( | const Vec & | Other | ) |
double Geom::Vec::angle | ( | const Vec & | Other | ) | const |
Computes the angular value between <me> and <Other>
Returns the angle value between 0 and PI in radian.
Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution from gp or
Other.Magnitude() <= Resolution because the angular value is
indefinite if one of the vectors has a null magnitude.
Computes the angle, in radians, between this vector and
vector Other. The result is a value between -Pi and Pi.
For this, VRef defines the positive sense of rotation: the
angular value is positive, if the cross product this ^ Other
has the same orientation as VRef relative to the plane
defined by the vectors this and Other. Otherwise, the
angular value is negative.
Exceptions
gp_VectorWithNullMagnitude if the magnitude of this
vector, the vector Other, or the vector VRef is less than or
equal to Geom::Precision::linear_Resolution().
Standard_DomainError if this vector, the vector Other,
and the vector VRef are coplanar, unless this vector and
the vector Other are parallel.
double Geom::Vec::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
//! Raised if Index != {1, 2, 3}.
void Geom::Vec::coord | ( | double & | Xv, |
double & | Yv, | ||
double & | Zv | ||
) | const |
For this vector returns its three coordinates Xv, Yv, and Zvinline
void Geom::Vec::cross | ( | const Vec & | Right | ) |
Computes the triple vector product.
<me> ^ (V1 ^ V2)
double Geom::Vec::crossMagnitude | ( | const Vec & | Right | ) | const |
Computes the magnitude of the cross
product between <me> and Right.
Returns || <me> ^ Right ||
double Geom::Vec::crossSquareMagnitude | ( | const Vec & | Right | ) | const |
Computes the square magnitude of
the cross product between <me> and Right.
Returns || <me> ^ Right ||**2
//! Computes the triple vector product.
<me> ^ (V1 ^ V2)
void Geom::Vec::divide | ( | const double | Scalar | ) |
Vec Geom::Vec::divided | ( | const double | Scalar | ) | const |
Divides a vector by a scalar
//! computes the cross product between two vectors
double Geom::Vec::dot | ( | const Vec & | Other | ) | const |
computes the scalar product
Computes the triple scalar product <me> * (V1 ^ V2).
//! normalizes a vector
Raises an exception if the magnitude of the vector is
lower or equal to Resolution from gp.
bool Geom::Vec::isEqual | ( | const Vec & | 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::Vec::isNormal | ( | const Vec & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if abs(<me>.Angle(Other) - PI/2.) <= AngularTolerance
Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
Other.Magnitude() <= Resolution from gp
bool Geom::Vec::isOpposite | ( | const Vec & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if PI - <me>.Angle(Other) <= AngularTolerance
Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
Other.Magnitude() <= Resolution from gp
bool Geom::Vec::isParallel | ( | const Vec & | Other, |
const double | AngularTolerance | ||
) | const |
Returns True if Angle(<me>, Other) <= AngularTolerance or
PI - Angle(<me>, Other) <= AngularTolerance
This definition means that two parallel vectors cannot define
a plane but two vectors with opposite directions are considered
as parallel. Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
Other.Magnitude() <= Resolution from gp
double Geom::Vec::magnitude | ( | ) | const |
Computes the magnitude of this vector.
void Geom::Vec::mirror | ( | const Vec & | V | ) |
void Geom::Vec::mirror | ( | const Geom::Ax1 & | A1 | ) |
void Geom::Vec::mirror | ( | const Geom::Ax2 & | A2 | ) |
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.
Performs the symmetrical transformation of a vector
with respect to a plane. The axis placement A2 locates
the plane of the symmetry : (Location, XDirection, YDirection).
Vec Geom::Vec::multiplied | ( | const double | Scalar | ) | const |
Multiplies a vector by a scalar
//! Divides a vector by a scalar
void Geom::Vec::multiply | ( | const double | Scalar | ) |
void Geom::Vec::normalize | ( | ) |
Vec Geom::Vec::normalized | ( | ) | const |
normalizes a vector
Raises an exception if the magnitude of the vector is
lower or equal to Resolution from gp.
//! Reverses the direction of a vector
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
double& Geom::Vec::operator[] | ( | int | i | ) |
|
inline |
void Geom::Vec::reverse | ( | ) |
Vec Geom::Vec::reversed | ( | ) | const |
Reverses the direction of a vector
void Geom::Vec::rotate | ( | const Geom::Ax1 & | A1, |
const double | Ang | ||
) |
Rotates a vector. A1 is the axis of the rotation.
Ang is the angular value of the rotation in radians.
void Geom::Vec::scale | ( | const double | S | ) |
Vec Geom::Vec::scaled | ( | const double | S | ) | const |
Scales a vector. S is the scaling value.
//! Transforms a vector with the transformation T.
void Geom::Vec::setCoord | ( | const int | Index, |
const double | Xi | ||
) |
Changes the coordinate of range Index
Index = 1 => X is modified
Index = 2 => Y is modified
Index = 3 => Z is modified
//! Raised if Index != {1, 2, 3}.
void Geom::Vec::setCoord | ( | const double | Xv, |
const double | Yv, | ||
const double | Zv | ||
) |
For this vector, assigns
void Geom::Vec::setLinearForm | ( | const double | A1, |
const Vec & | V1, | ||
const double | A2, | ||
const Vec & | V2, | ||
const double | A3, | ||
const Vec & | V3, | ||
const Vec & | V4 | ||
) |
<me> is setted to the following linear form :
A1 * V1 + A2 * V2 + A3 * V3 + V4
void Geom::Vec::setLinearForm | ( | const double | A1, |
const Vec & | V1, | ||
const double | A2, | ||
const Vec & | V2, | ||
const double | A3, | ||
const Vec & | V3 | ||
) |
<me> is setted to the following linear form :
A1 * V1 + A2 * V2 + A3 * V3
void Geom::Vec::setLinearForm | ( | const double | A1, |
const Vec & | V1, | ||
const double | A2, | ||
const Vec & | V2, | ||
const Vec & | V3 | ||
) |
<me> is setted to the following linear form :
A1 * V1 + A2 * V2 + V3
<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 : V1 + V2
void Geom::Vec::setX | ( | const double | X | ) |
Assigns the given value to the X coordinate of this vector.
void Geom::Vec::setXYZ | ( | const Geom::XYZ & | Coord | ) |
Assigns the three coordinates of Coord to this vector.
void Geom::Vec::setY | ( | const double | Y | ) |
Assigns the given value to the X coordinate of this vector.
void Geom::Vec::setZ | ( | const double | Z | ) |
Assigns the given value to the X coordinate of this vector.
double Geom::Vec::squareMagnitude | ( | ) | const |
Computes the square magnitude of this vector.
//! Adds two vectors
void Geom::Vec::subtract | ( | const Vec & | Right | ) |
Subtracts two vectors
//! Multiplies a vector by a scalar
void Geom::Vec::transform | ( | const Geom::Trsf & | T | ) |
Vec Geom::Vec::transformed | ( | const Geom::Trsf & | T | ) | const |
Transforms a vector with the transformation T.
double Geom::Vec::x | ( | ) | const |
For this vector, returns its X coordinate.
const Geom::XYZ& Geom::Vec::xyz | ( | ) | const |
For this vector, returns
double Geom::Vec::y | ( | ) | const |
For this vector, returns its Y coordinate.
double Geom::Vec::z | ( | ) | const |
For this vector, returns its Z coordinate.