ISeeML
1.0
|
This class defines 2D geometric vectors, which can be defined by their Polar or Cartesian coordinates. More...
#include <Vector.hpp>
Public Member Functions | |
Vector () | |
The default constructor, creating the zero vector with Cartesian coordinates (0,0). | |
Vector (const double &theta) | |
A simple constructor, creating the unit vector of given orientation. More... | |
Vector (const double &x, const double &y) | |
The main constructor, creating a vector from its Cartesian coordinates. More... | |
iSeeML::Object & | clone () const |
Description method, giving a copy of the current vector. More... | |
void | writeTo (ostream &O) const |
Description method, writing a description of the vector into a stream: Cartesian coordinate in each dimension is written, between paranthesis and separated by commas. More... | |
const double & | xCoord () const |
Description method, giving the vector's first Cartesian coordinate. More... | |
const double & | yCoord () const |
Description method, giving the vector's second Cartesian coordinate. More... | |
double | orientation () const |
Description method, giving the vector's orientation. More... | |
double | length () const |
Description method, giving the vector's length. More... | |
double | sqrLength () const |
Description method, giving the square of the vector's length. More... | |
Vector & | moveTo (const double &x, const double &y) |
Modification method, moving the point to a given position. More... | |
Vector & | translate (const Vector &v) |
Modification method, translating the vector along an other. More... | |
Vector & | rotate (const double &theta) |
Modification method, rotating the vector of a given angle. More... | |
Vector & | add (const Vector &v) |
Modification method, adding a vector to the current one. More... | |
Vector & | multiply (const double &f) |
Modification method, multiplying a vector by a real factor. More... | |
Vector & | divide (const double &f) |
Division method, dividing a vector by a real factor. More... | |
Vector & | symmetryOx () |
Modification method, transforming a vector into its symmetric with respect to the X axis. More... | |
Vector & | symmetryOy () |
Modification method, transforming a vector into its symmetric with respect to the Y axis. More... | |
bool | operator== (const Vector &other) const |
Equality operator between vectors (differences between both Cartesian coordinates should be zero). More... | |
Vector | operator+ (const Vector &v) const |
Sum operator between two vectors, giving the translation of the first one by the other. More... | |
Vector | operator- (const Vector &v) const |
Difference operator between two vectors, giving the sum of the first vector and of the second one's opposite. More... | |
Vector | operator- () const |
Opposite operator for a vector, such that the sum of the vector and of its opposite is the zero vector. More... | |
Vector | operator* (const double &f) const |
Multiplication operator between a vector and a real. More... | |
Vector | operator/ (const double &f) const |
Division operator between a vector and a real. More... | |
double | operator* (const Vector &v) const |
Scalar product operator between two vectors. More... | |
double | operator^ (const Vector &v) const |
Vectorial product operator between two vectors. More... | |
![]() | |
virtual bool | operator== (const iSeeML::geom::Object &other) const |
Equality operator between geometric objects. More... | |
![]() | |
virtual | ~Object () |
This virtual class needs a virtual destructor. | |
virtual const string | className () const |
Description method, giving the object's class name. More... | |
bool | sameClass (const iSeeML::Object &other) |
Method verifying that a given object has the same type (same class name) than the current one. More... | |
Static Public Member Functions | |
static double | FresnelCos (const double &s) |
Various method, computing the Fresnel Cosine integral. More... | |
static double | FresnelSin (const double &s) |
Various method, computing the Fresnel Sine integral. More... | |
static Vector | FresnelInt (const double &s) |
Various method, computing the Fresnel integrals in a vector. More... | |
![]() | |
template<class T > | |
static const T & | min (const T &a, const T &b) |
Method giving the minimum of two elements. More... | |
template<class T > | |
static const T & | max (const T &a, const T &b) |
Method giving the maximum of two elements. More... | |
static double | sqr (const double &x) |
Method giving the square of a double. More... | |
static double | mod2pi (const double &theta) |
Method giving the angle between - ![]() ![]() ![]() | |
static double | rad2deg (const double &theta) |
Method transforming an angle in radian, ![]() ![]() | |
static double | deg2rad (const double &theta) |
Method transforming an angle in degree, ![]() ![]() | |
static bool | isPositive (const double &x) |
Method telling whether a double is strictly positive. More... | |
static bool | isNegative (const double &x) |
Method telling whether a double is strictly negative. More... | |
static bool | isZero (const double &x) |
Method comparing a double to zero. More... | |
static int | sign (const double &x) |
Method giving the sign of a double. More... | |
Static Public Attributes | |
static const string | ClassName |
The class name is public, as this class can be instanced. More... | |
Protected Member Functions | |
int | algDimension () const |
Description method, giving the dimension of the containing space (2) when this vector is considered as an algebraic one. More... | |
double | algCoord (const int i) const |
Description method, giving Cartesian coordinate of given index for the vector. More... | |
![]() | |
virtual void | algWriteTo (ostream &O) const |
Description method for algebraic vectors, writing this vector in a given output stream: coordinates for each dimension are written, between paranthesis and separated by commas. More... | |
Friends | |
Vector | operator* (const double &f, const Vector &v) |
Multiplication operator between a real and a vector. More... | |
Vector | operator/ (const double &f, const Vector &v) |
Division operator between a real and a vector. More... | |
Additional Inherited Members | |
![]() | |
ostream & | operator<< (ostream &O, const iSeeML::Object &o) |
Modification method, writing a description of a ISeeML object in a given output stream. More... | |
This class defines 2D geometric vectors, which can be defined by their Polar or Cartesian coordinates.
This class contains description methods giving Polar and Cartesian coordinates as well as the writeTo method, modification methods giving translation, rotation, scaling and symmetry of a vector, the corresponding operators as well as the equality operator, and a last method computing Cartesian coordinates of a reference clothoid (which are Fresnel integrals).
|
inline |
A simple constructor, creating the unit vector of given orientation.
The vector of Polar coordinates (rho, theta)
can thus be obtained using iSeeML::geom::Vector(theta).multiply(rho)
.
theta | the orientation of the vector. |
|
inline |
Modification method, adding a vector to the current one.
The original vector is changed, addition without modification is obtained using operator+(const Vector&) const.
v | the vector of the translation. |
|
inlineprotectedvirtual |
Description method, giving Cartesian coordinate of given index for the vector.
i | the index of the searched Cartesian coordinate. |
ISEEML_CHECK_GEOM_VECT_PRECOND
is defined (see CompilerFlags.h), an error is generated.Reimplemented from iSeeML::Object.
|
inlineprotectedvirtual |
Description method, giving the dimension of the containing space (2) when this vector is considered as an algebraic one.
This representation is mainly used to define a unified writeTo. Dimension cannot be static, as it is virtual.
Reimplemented from iSeeML::Object.
|
inlinevirtual |
Description method, giving a copy of the current vector.
This clone is dynamically allocated (using default copy constructor), it has to be deleted later.
Implements iSeeML::Object.
|
inline |
Division method, dividing a vector by a real factor.
The original vector is changed, division without modification is obtained using operator/() const.
f | a real factor. |
ISEEML_CHECK_GEOM_VECT_PRECOND
is defined (see CompilerFlags.h), an error is generated.
|
inlinestatic |
Various method, computing the Fresnel Cosine integral.
s | the integration length. |
s
smaller (in absolute value) then 2, which correspond to a deflection (change of the orientation) of s
, of cos(
|
static |
Various method, computing the Fresnel integrals in a vector.
The returned vector correspond to the Cartesian coordinates of the point of given arc length along a reference clothoid (along which curvature is equal to times the arc length). These coordinates have been precomputed with a precision of 1E-5, and are stored in two static arrays.
s | the arc length along the reference clothoid of the searched position, or the integration length of the Fresnel integrals. |
s
smaller (in absolute value) then 2, which correspond to a deflection (change of the orientation) of s
is not correct and check flags ISEEML_CHECK_GEOM_VECT_PRECOND
or ISEEML_CHECK_ARRAY_ELEMT
(see CompilerFlags.h) are defined.s
, of respectively cos(
|
inlinestatic |
Various method, computing the Fresnel Sine integral.
s | the integration length. |
s
smaller (in absolute value) then 2, which correspond to a deflection (change of the orientation) of s
, of sin(
|
inline |
Description method, giving the vector's length.
The couple (length, orientation) gives Polar coordinates of the vector, while the couple (xCoord, yCoord) gives Cartesian coordinates.
|
inline |
|
inline |
Modification method, multiplying a vector by a real factor.
The original vector is changed, multiplication without modification is obtained using operator*() const.
f | a real factor. |
|
inline |
Multiplication operator between a vector and a real.
f | a real factor. |
|
inline |
Scalar product operator between two vectors.
v | the second vector of the product. |
Sum operator between two vectors, giving the translation of the first one by the other.
v | the vector of the translation. |
|
inline |
Opposite operator for a vector, such that the sum of the vector and of its opposite is the zero vector.
Difference operator between two vectors, giving the sum of the first vector and of the second one's opposite.
v | a vector. |
|
inline |
Division operator between a vector and a real.
f | a real factor. |
|
inline |
Equality operator between vectors (differences between both Cartesian coordinates should be zero).
other | another vector. |
|
inline |
Vectorial product operator between two vectors.
v | the second vector of the product. |
|
inline |
Description method, giving the vector's orientation.
The couple (length, orientation) gives Polar coordinates of the vector, while the couple (xCoord, yCoord) gives Cartesian coordinates. Orientation is always uniquely defined, except for zero vector. In that case, we choose to return 0.
|
inline |
Modification method, rotating the vector of a given angle.
The original vector is changed.
theta | the angle of the rotation. |
|
inline |
Description method, giving the square of the vector's length.
Uses the scalar product.
|
inline |
Modification method, transforming a vector into its symmetric with respect to the X axis.
|
inline |
Modification method, transforming a vector into its symmetric with respect to the Y axis.
Modification method, translating the vector along an other.
The original vector is changed, addition without modification is obtained using operator+(const Vector&) const.
v | the vector of the translation. |
Implements iSeeML::geom::Object.
|
inlinevirtual |
Description method, writing a description of the vector into a stream: Cartesian coordinate in each dimension is written, between paranthesis and separated by commas.
O | the output stream in which description is written. |
Implements iSeeML::Object.
|
inline |
Description method, giving the vector's first Cartesian coordinate.
|
inline |
Description method, giving the vector's second Cartesian coordinate.
Multiplication operator between a real and a vector.
f | the real factor, |
v | the vector. |
Division operator between a real and a vector.
f | the real factor, |
v | the vector. |
|
static |
The class name is public, as this class can be instanced.