Basic vertex class. Supports all arithmetic operators as well as indexed access and matrix multiplication with the Matrix4 class. More...
#include <Vertex.hpp>
Public Member Functions | |
Vertex () | |
Default constructor. All coordinates are initialized with zeros. | |
Vertex (const CoordType &x, const CoordType &y, const CoordType &z) | |
Builds a Vertex with the given coordinates. | |
Vertex (const Vertex &o) | |
Copy Ctor. | |
virtual | ~Vertex () |
Destructor. | |
CoordType | length () |
Return the current length of the vector. | |
Vertex< CoordType > | cross (const Vertex &other) const |
Calculates the cross product between this and the given vector. Returns a new Vertex instance. | |
void | rotate (const Matrix4< CoordType > &m) |
Applies the given matrix. Translational components are ignored (matrix must be row major). | |
void | rotateCM (const Matrix4< CoordType > &m) |
Applies the given matrix. Translational components are ignored. | |
void | rotateRM (const Matrix4< CoordType > &m) |
Applies the given matrix. Translational components are ignored. | |
void | transform (const Matrix4< CoordType > &m) |
Transforms the vertex according to the given matrix (Default: matrix is row major). | |
void | transformRM (const Matrix4< CoordType > &m) |
Transforms the vertex according to the given matrix (Row major format). | |
void | transformCM (const Matrix4< CoordType > &m) |
Transforms the vertex according to the given matrix (Column major format). | |
virtual void | crossTo (const Vertex &other) |
Calculates the cross product with the other given Vertex and assigns the result to the current instance. | |
virtual CoordType | operator* (const Vertex &other) const |
Multiplication operator (dot product). | |
virtual Vertex< CoordType > | operator* (const CoordType &scale) const |
Multiplication operator (scaling). | |
virtual Vertex< CoordType > | operator+ (const Vertex &other) const |
virtual Vertex< CoordType > | operator- (const Vertex &other) const |
Coordinate subtraction. | |
virtual void | operator-= (const Vertex &other) |
Coordinate substraction. | |
virtual void | operator+= (const Vertex< CoordType > &other) |
Coordinate addition. | |
virtual void | operator*= (const CoordType &scale) |
Scaling. | |
virtual void | operator/= (const CoordType &scale) |
Scaling. | |
virtual bool | operator== (const Vertex &other) const |
Compares two vertices. | |
virtual bool | operator!= (const Vertex &other) const |
Compares two vertices. | |
virtual CoordType | operator[] (const int &index) const |
Indexed coordinate access (reading). | |
virtual CoordType & | operator[] (const int &index) |
Indexed coordinate access (writing). | |
Public Attributes | |
CoordType | m_x |
The x-coordinate of the vertex. | |
CoordType | m_y |
The y-coordinate of the vertex. | |
CoordType | m_z |
The z-coordinate of the vertex. | |
Static Private Attributes | |
static const float | epsilon = 0.001 |
Epsilon value for vertex comparism. |
Basic vertex class. Supports all arithmetic operators as well as indexed access and matrix multiplication with the Matrix4 class.
Definition at line 22 of file Vertex.hpp.
lssr::Vertex< CoordType >::Vertex | ( | ) | [inline] |
Default constructor. All coordinates are initialized with zeros.
Definition at line 30 of file Vertex.hpp.
lssr::Vertex< CoordType >::Vertex | ( | const CoordType & | x, | |
const CoordType & | y, | |||
const CoordType & | z | |||
) | [inline] |
Builds a Vertex with the given coordinates.
Definition at line 38 of file Vertex.hpp.
lssr::Vertex< CoordType >::Vertex | ( | const Vertex< CoordType > & | o | ) | [inline] |
Copy Ctor.
Definition at line 48 of file Vertex.hpp.
virtual lssr::Vertex< CoordType >::~Vertex | ( | ) | [inline, virtual] |
Destructor.
Definition at line 58 of file Vertex.hpp.
Vertex<CoordType> lssr::Vertex< CoordType >::cross | ( | const Vertex< CoordType > & | other | ) | const |
Calculates the cross product between this and the given vector. Returns a new Vertex instance.
other | The second cross product vector |
virtual void lssr::Vertex< CoordType >::crossTo | ( | const Vertex< CoordType > & | other | ) | [virtual] |
Calculates the cross product with the other given Vertex and assigns the result to the current instance.
CoordType lssr::Vertex< CoordType >::length | ( | ) |
Return the current length of the vector.
virtual bool lssr::Vertex< CoordType >::operator!= | ( | const Vertex< CoordType > & | other | ) | const [inline, virtual] |
Compares two vertices.
Definition at line 181 of file Vertex.hpp.
virtual CoordType lssr::Vertex< CoordType >::operator* | ( | const Vertex< CoordType > & | other | ) | const [virtual] |
Multiplication operator (dot product).
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator* | ( | const CoordType & | scale | ) | const [virtual] |
Multiplication operator (scaling).
virtual void lssr::Vertex< CoordType >::operator*= | ( | const CoordType & | scale | ) | [virtual] |
Scaling.
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator+ | ( | const Vertex< CoordType > & | other | ) | const [virtual] |
virtual void lssr::Vertex< CoordType >::operator+= | ( | const Vertex< CoordType > & | other | ) | [virtual] |
Coordinate addition.
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator- | ( | const Vertex< CoordType > & | other | ) | const [virtual] |
Coordinate subtraction.
virtual void lssr::Vertex< CoordType >::operator-= | ( | const Vertex< CoordType > & | other | ) | [virtual] |
Coordinate substraction.
virtual void lssr::Vertex< CoordType >::operator/= | ( | const CoordType & | scale | ) | [virtual] |
Scaling.
virtual bool lssr::Vertex< CoordType >::operator== | ( | const Vertex< CoordType > & | other | ) | const [virtual] |
Compares two vertices.
virtual CoordType& lssr::Vertex< CoordType >::operator[] | ( | const int & | index | ) | [virtual] |
Indexed coordinate access (writing).
virtual CoordType lssr::Vertex< CoordType >::operator[] | ( | const int & | index | ) | const [virtual] |
Indexed coordinate access (reading).
void lssr::Vertex< CoordType >::rotate | ( | const Matrix4< CoordType > & | m | ) |
Applies the given matrix. Translational components are ignored (matrix must be row major).
A | 4x4 rotation matrix. |
void lssr::Vertex< CoordType >::rotateCM | ( | const Matrix4< CoordType > & | m | ) |
Applies the given matrix. Translational components are ignored.
A | 4x4 rotation matrix (column major). |
void lssr::Vertex< CoordType >::rotateRM | ( | const Matrix4< CoordType > & | m | ) |
Applies the given matrix. Translational components are ignored.
A | 4x4 rotation matrix (row major). |
void lssr::Vertex< CoordType >::transform | ( | const Matrix4< CoordType > & | m | ) |
Transforms the vertex according to the given matrix (Default: matrix is row major).
A | 4x4 tranformation matrix. |
void lssr::Vertex< CoordType >::transformCM | ( | const Matrix4< CoordType > & | m | ) |
Transforms the vertex according to the given matrix (Column major format).
A | 4x4 tranformation matrix. |
void lssr::Vertex< CoordType >::transformRM | ( | const Matrix4< CoordType > & | m | ) |
Transforms the vertex according to the given matrix (Row major format).
A | 4x4 tranformation matrix. |
const float lssr::Vertex< CoordType >::epsilon = 0.001 [static, private] |
Epsilon value for vertex comparism.
Definition at line 209 of file Vertex.hpp.
CoordType lssr::Vertex< CoordType >::m_x |
The x-coordinate of the vertex.
Definition at line 198 of file Vertex.hpp.
CoordType lssr::Vertex< CoordType >::m_y |
The y-coordinate of the vertex.
Definition at line 201 of file Vertex.hpp.
CoordType lssr::Vertex< CoordType >::m_z |
The z-coordinate of the vertex.
Definition at line 204 of file Vertex.hpp.