#include <VVector.hh>
Public Member Functions | |
| VVector () | |
| Creates an uninitialized vector. | |
| VVector (bool zero_) | |
| Creates an initialized (to zero) or uninitialized vector. | |
| VVector (double val) | |
| Creates an initialized vector with the same value for x, y and z. | |
| VVector (const f3 fv) | |
| Create and initialize a vector from array of floats. | |
| VVector (const d3 dv) | |
| Create and initialize a vector from array of doubles. | |
| VVector (double x, double y, double z) | |
| Create and initialize a vector from 3 doubles. | |
| const double | operator[] (int i) const |
| Read-only access an element in the vector. | |
| double & | operator[] (int i) |
| Write access to an element in the vector. | |
| double & | x () |
| Get element 0 of the vector. | |
| double & | y () |
| Get element 1 of the vector. | |
| double & | z () |
| Get element 2 of the vector. | |
| const double | x () const |
| Get element 0 of the vector. | |
| const double | y () const |
| Get element 1 of the vector. | |
| const double | z () const |
| Get element 2 of the vector. | |
| operator const double * () const | |
| Implicit conversion to array of doubles. | |
| const VVector | operator+ (const VVector &rhs) const |
| Add 2 vectors. | |
| const VVector | operator- (const VVector &rhs) const |
| Subtract a vector from this vector. | |
| double | operator * (const VVector &rhs) const |
| Dot product between vectors. | |
| const VVector | operator * (double scalar) const |
| Multiply each element with a scalar. | |
| const VVector | operator/ (double scalar) const |
| Divide each element with a scalar. | |
| VVector & | operator+= (const VVector &rhs) |
| Add a vector to this vector. | |
| VVector & | operator-= (const VVector &rhs) |
| Subtract a vector from this vector. | |
| VVector & | operator *= (double scalar) |
| Mutliply this vector with a scalar. | |
| VVector & | operator/= (double scalar) |
| Divide this vector with a scalar. | |
| const VVector | crossproduct (const VVector &with) const |
| Cross product of this vector and with. | |
| const VVector | projection (const VVector &onto) const |
| Projection, vectors does not have to be of unit length. | |
| const VVector | perpendicular (const VVector &to) const |
| Perpendicular part, vectors does not have to be of unit length. | |
| const VVector | rotX (double angleRad) const |
| Rotate angleRad rad around X axis. | |
| const VVector | rotY (double angleRad) const |
| Rotate angleRad rad around Y axis. | |
| const VVector | rotZ (double angleRad) const |
| Rotate angleRad rad around Z axis. | |
| const VVector | rotN (const VVector &n, double angleRad) const |
| Rotate angleRad rad around arbitrary axis. | |
| const double | length () const |
| Compute the length of the vector. | |
| void | normalize () |
| Normalize the vector (i.e. make it length 1 and same direction). | |
| void | set (double x, double y, double z) |
| Set the value of the vector. | |
| void | zero () |
Static Private Member Functions | |
| static double & | getDummy () |
Private Attributes | |
| d3 | m_vval |
Friends | |
| std::ostream & | operator<< (std::ostream &o, const VVector &v) |
| Print vector in format [x, y, z]. | |
| VVector::VVector | ( | ) | [inline] |
Creates an uninitialized vector.
| VVector::VVector | ( | bool | zero_ | ) | [inline, explicit] |
Creates an initialized (to zero) or uninitialized vector.
| zero_ | if true the vector is initilized to [0,0,0] |
| VVector::VVector | ( | double | val | ) | [inline, explicit] |
Creates an initialized vector with the same value for x, y and z.
| val | The value to initialize the vector with v = (val, val, val) |
| VVector::VVector | ( | const f3 | fv | ) | [inline, explicit] |
Create and initialize a vector from array of floats.
| fv | pointer to vector of 3 floats |
| VVector::VVector | ( | const d3 | dv | ) | [inline, explicit] |
Create and initialize a vector from array of doubles.
| dv | pointer to vector of 3 doubles |
| VVector::VVector | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) | [inline] |
Create and initialize a vector from 3 doubles.
| x | value of element 0 | |
| y | value of element 1 | |
| z | value of element 2 |
Cross product of this vector and with.
| static double& VVector::getDummy | ( | ) | [inline, static, private] |
| const double VVector::length | ( | ) | const [inline] |
Compute the length of the vector.
| void VVector::normalize | ( | ) | [inline] |
Normalize the vector (i.e. make it length 1 and same direction).
| const VVector VVector::operator * | ( | double | scalar | ) | const [inline] |
Multiply each element with a scalar.
| double VVector::operator * | ( | const VVector & | rhs | ) | const [inline] |
Dot product between vectors.
| rhs | The vector to multiply with this vector |
| VVector& VVector::operator *= | ( | double | scalar | ) | [inline] |
Mutliply this vector with a scalar.
| VVector::operator const double * | ( | ) | const [inline] |
Implicit conversion to array of doubles.
Subtract a vector from this vector.
| rhs | The vector to subtract from this vector |
| const VVector VVector::operator/ | ( | double | scalar | ) | const [inline] |
Divide each element with a scalar.
| VVector& VVector::operator/= | ( | double | scalar | ) | [inline] |
Divide this vector with a scalar.
| double& VVector::operator[] | ( | int | i | ) | [inline] |
Write access to an element in the vector.
If i < 0 or i > 3 an undefined dummy value is returned (and a warning is printed on stderr if NDEBUG was not defined at compile time).
| const double VVector::operator[] | ( | int | i | ) | const [inline] |
Read-only access an element in the vector.
If i < 0 or i > 3 an undefined dummy value is returned (and a warning is printed on stderr if NDEBUG was not defined at compile time).
Perpendicular part, vectors does not have to be of unit length.
| to | The vector to take the perpendicular part to |
Projection, vectors does not have to be of unit length.
| onto | The vector to project this vector on |
Rotate angleRad rad around arbitrary axis.
| n | The vector to rotate around | |
| angleRad | The number of radians to rotate |
| const VVector VVector::rotX | ( | double | angleRad | ) | const [inline] |
Rotate angleRad rad around X axis.
| angleRad | The number of radians to rotate |
| const VVector VVector::rotY | ( | double | angleRad | ) | const [inline] |
Rotate angleRad rad around Y axis.
| angleRad | The number of radians to rotate |
| const VVector VVector::rotZ | ( | double | angleRad | ) | const [inline] |
Rotate angleRad rad around Z axis.
| angleRad | The number of radians to rotate |
| void VVector::set | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) | [inline] |
Set the value of the vector.
| const double VVector::x | ( | ) | const [inline] |
Get element 0 of the vector.
| double& VVector::x | ( | ) | [inline] |
Get element 0 of the vector.
| const double VVector::y | ( | ) | const [inline] |
Get element 1 of the vector.
| double& VVector::y | ( | ) | [inline] |
Get element 1 of the vector.
| const double VVector::z | ( | ) | const [inline] |
Get element 2 of the vector.
| double& VVector::z | ( | ) | [inline] |
Get element 2 of the vector.
| void VVector::zero | ( | ) | [inline] |
| std::ostream& operator<< | ( | std::ostream & | o, | |
| const VVector & | v | |||
| ) | [friend] |
Print vector in format [x, y, z].
d3 VVector::m_vval [private] |
1.4.7