A normal implementation. Basically a vertex with normalization functionality. More...
#include <Normal.hpp>
Public Member Functions | |
Normal () | |
Default constructor. All elements are set to zero. | |
Normal (CoordType x, CoordType y, CoordType z) | |
Constructs a new normal from the given components. Applies normalization. | |
template<typename T > | |
Normal (const Vertex< T > &other) | |
Copy constructor for vertices. Applies normalization. | |
template<typename T > | |
Normal (const Normal &other) | |
Constructs from another normal. Implemented to avoid unnecessary normalizations. | |
virtual | ~Normal () |
void | normalize () |
Normalizes the components. | |
Normal< CoordType > | operator+ (const Normal &n) const |
virtual Normal< CoordType > | operator- (const Normal &n) const |
void | operator+= (const Normal &n) |
void | operator-= (const Normal &n) |
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. |
A normal implementation. Basically a vertex with normalization functionality.
Definition at line 21 of file Normal.hpp.
lssr::Normal< CoordType >::Normal | ( | ) | [inline] |
Default constructor. All elements are set to zero.
Definition at line 30 of file Normal.hpp.
lssr::Normal< CoordType >::Normal | ( | CoordType | x, | |
CoordType | y, | |||
CoordType | z | |||
) | [inline] |
Constructs a new normal from the given components. Applies normalization.
Definition at line 36 of file Normal.hpp.
lssr::Normal< CoordType >::Normal | ( | const Vertex< T > & | other | ) | [inline] |
Copy constructor for vertices. Applies normalization.
Definition at line 47 of file Normal.hpp.
lssr::Normal< CoordType >::Normal | ( | const Normal< CoordType > & | other | ) | [inline] |
Constructs from another normal. Implemented to avoid unnecessary normalizations.
Definition at line 57 of file Normal.hpp.
virtual lssr::Normal< CoordType >::~Normal | ( | ) | [inline, virtual] |
Definition at line 64 of file Normal.hpp.
Vertex<CoordType> lssr::Vertex< CoordType >::cross | ( | const Vertex< CoordType > & | other | ) | const [inherited] |
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, inherited] |
Calculates the cross product with the other given Vertex and assigns the result to the current instance.
CoordType lssr::Vertex< CoordType >::length | ( | ) | [inherited] |
Return the current length of the vector.
void lssr::Normal< CoordType >::normalize | ( | ) |
Normalizes the components.
virtual bool lssr::Vertex< CoordType >::operator!= | ( | const Vertex< CoordType > & | other | ) | const [inline, virtual, inherited] |
Compares two vertices.
Definition at line 181 of file Vertex.hpp.
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator* | ( | const CoordType & | scale | ) | const [virtual, inherited] |
Multiplication operator (scaling).
virtual CoordType lssr::Vertex< CoordType >::operator* | ( | const Vertex< CoordType > & | other | ) | const [virtual, inherited] |
Multiplication operator (dot product).
virtual void lssr::Vertex< CoordType >::operator*= | ( | const CoordType & | scale | ) | [virtual, inherited] |
Scaling.
Normal<CoordType> lssr::Normal< CoordType >::operator+ | ( | const Normal< CoordType > & | n | ) | const [inline] |
Definition at line 71 of file Normal.hpp.
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator+ | ( | const Vertex< CoordType > & | other | ) | const [virtual, inherited] |
void lssr::Normal< CoordType >::operator+= | ( | const Normal< CoordType > & | n | ) | [inline] |
Definition at line 81 of file Normal.hpp.
virtual void lssr::Vertex< CoordType >::operator+= | ( | const Vertex< CoordType > & | other | ) | [virtual, inherited] |
Coordinate addition.
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator- | ( | const Vertex< CoordType > & | other | ) | const [virtual, inherited] |
Coordinate subtraction.
virtual Normal<CoordType> lssr::Normal< CoordType >::operator- | ( | const Normal< CoordType > & | n | ) | const [inline, virtual] |
Definition at line 76 of file Normal.hpp.
virtual void lssr::Vertex< CoordType >::operator-= | ( | const Vertex< CoordType > & | other | ) | [virtual, inherited] |
Coordinate substraction.
void lssr::Normal< CoordType >::operator-= | ( | const Normal< CoordType > & | n | ) | [inline] |
Definition at line 86 of file Normal.hpp.
virtual void lssr::Vertex< CoordType >::operator/= | ( | const CoordType & | scale | ) | [virtual, inherited] |
Scaling.
virtual bool lssr::Vertex< CoordType >::operator== | ( | const Vertex< CoordType > & | other | ) | const [virtual, inherited] |
Compares two vertices.
virtual CoordType lssr::Vertex< CoordType >::operator[] | ( | const int & | index | ) | const [virtual, inherited] |
Indexed coordinate access (reading).
virtual CoordType& lssr::Vertex< CoordType >::operator[] | ( | const int & | index | ) | [virtual, inherited] |
Indexed coordinate access (writing).
void lssr::Vertex< CoordType >::rotate | ( | const Matrix4< CoordType > & | m | ) | [inherited] |
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 | ) | [inherited] |
Applies the given matrix. Translational components are ignored.
A | 4x4 rotation matrix (column major). |
void lssr::Vertex< CoordType >::rotateRM | ( | const Matrix4< CoordType > & | m | ) | [inherited] |
Applies the given matrix. Translational components are ignored.
A | 4x4 rotation matrix (row major). |
void lssr::Vertex< CoordType >::transform | ( | const Matrix4< CoordType > & | m | ) | [inherited] |
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 | ) | [inherited] |
Transforms the vertex according to the given matrix (Column major format).
A | 4x4 tranformation matrix. |
void lssr::Vertex< CoordType >::transformRM | ( | const Matrix4< CoordType > & | m | ) | [inherited] |
Transforms the vertex according to the given matrix (Row major format).
A | 4x4 tranformation matrix. |
CoordType lssr::Vertex< CoordType >::m_x [inherited] |
The x-coordinate of the vertex.
Definition at line 198 of file Vertex.hpp.
CoordType lssr::Vertex< CoordType >::m_y [inherited] |
The y-coordinate of the vertex.
Definition at line 201 of file Vertex.hpp.
CoordType lssr::Vertex< CoordType >::m_z [inherited] |
The z-coordinate of the vertex.
Definition at line 204 of file Vertex.hpp.