Public Member Functions | Public Attributes | Static Private Attributes

lssr::Vertex< CoordType > Class Template Reference

Basic vertex class. Supports all arithmetic operators as well as indexed access and matrix multiplication with the Matrix4 class. More...

#include <Vertex.hpp>

Inheritance diagram for lssr::Vertex< CoordType >:
Inheritance graph
[legend]

List of all members.

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.

Detailed Description

template<typename CoordType>
class lssr::Vertex< CoordType >

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.


Constructor & Destructor Documentation

template<typename CoordType>
lssr::Vertex< CoordType >::Vertex (  )  [inline]

Default constructor. All coordinates are initialized with zeros.

Definition at line 30 of file Vertex.hpp.

template<typename CoordType>
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.

template<typename CoordType>
lssr::Vertex< CoordType >::Vertex ( const Vertex< CoordType > &  o  )  [inline]

Copy Ctor.

Definition at line 48 of file Vertex.hpp.

template<typename CoordType>
virtual lssr::Vertex< CoordType >::~Vertex (  )  [inline, virtual]

Destructor.

Definition at line 58 of file Vertex.hpp.


Member Function Documentation

template<typename CoordType>
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.

Parameters:
other The second cross product vector
template<typename CoordType>
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.

template<typename CoordType>
CoordType lssr::Vertex< CoordType >::length (  ) 

Return the current length of the vector.

template<typename CoordType>
virtual bool lssr::Vertex< CoordType >::operator!= ( const Vertex< CoordType > &  other  )  const [inline, virtual]

Compares two vertices.

Definition at line 181 of file Vertex.hpp.

template<typename CoordType>
virtual CoordType lssr::Vertex< CoordType >::operator* ( const Vertex< CoordType > &  other  )  const [virtual]

Multiplication operator (dot product).

template<typename CoordType>
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator* ( const CoordType &  scale  )  const [virtual]

Multiplication operator (scaling).

template<typename CoordType>
virtual void lssr::Vertex< CoordType >::operator*= ( const CoordType &  scale  )  [virtual]

Scaling.

template<typename CoordType>
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator+ ( const Vertex< CoordType > &  other  )  const [virtual]
template<typename CoordType>
virtual void lssr::Vertex< CoordType >::operator+= ( const Vertex< CoordType > &  other  )  [virtual]

Coordinate addition.

template<typename CoordType>
virtual Vertex<CoordType> lssr::Vertex< CoordType >::operator- ( const Vertex< CoordType > &  other  )  const [virtual]

Coordinate subtraction.

template<typename CoordType>
virtual void lssr::Vertex< CoordType >::operator-= ( const Vertex< CoordType > &  other  )  [virtual]

Coordinate substraction.

template<typename CoordType>
virtual void lssr::Vertex< CoordType >::operator/= ( const CoordType &  scale  )  [virtual]

Scaling.

template<typename CoordType>
virtual bool lssr::Vertex< CoordType >::operator== ( const Vertex< CoordType > &  other  )  const [virtual]

Compares two vertices.

template<typename CoordType>
virtual CoordType& lssr::Vertex< CoordType >::operator[] ( const int &  index  )  [virtual]

Indexed coordinate access (writing).

template<typename CoordType>
virtual CoordType lssr::Vertex< CoordType >::operator[] ( const int &  index  )  const [virtual]

Indexed coordinate access (reading).

template<typename CoordType>
void lssr::Vertex< CoordType >::rotate ( const Matrix4< CoordType > &  m  ) 

Applies the given matrix. Translational components are ignored (matrix must be row major).

Parameters:
A 4x4 rotation matrix.
template<typename CoordType>
void lssr::Vertex< CoordType >::rotateCM ( const Matrix4< CoordType > &  m  ) 

Applies the given matrix. Translational components are ignored.

Parameters:
A 4x4 rotation matrix (column major).
template<typename CoordType>
void lssr::Vertex< CoordType >::rotateRM ( const Matrix4< CoordType > &  m  ) 

Applies the given matrix. Translational components are ignored.

Parameters:
A 4x4 rotation matrix (row major).
template<typename CoordType>
void lssr::Vertex< CoordType >::transform ( const Matrix4< CoordType > &  m  ) 

Transforms the vertex according to the given matrix (Default: matrix is row major).

Parameters:
A 4x4 tranformation matrix.
template<typename CoordType>
void lssr::Vertex< CoordType >::transformCM ( const Matrix4< CoordType > &  m  ) 

Transforms the vertex according to the given matrix (Column major format).

Parameters:
A 4x4 tranformation matrix.
template<typename CoordType>
void lssr::Vertex< CoordType >::transformRM ( const Matrix4< CoordType > &  m  ) 

Transforms the vertex according to the given matrix (Row major format).

Parameters:
A 4x4 tranformation matrix.

Member Data Documentation

template<typename CoordType>
const float lssr::Vertex< CoordType >::epsilon = 0.001 [static, private]

Epsilon value for vertex comparism.

Definition at line 209 of file Vertex.hpp.

template<typename CoordType>
CoordType lssr::Vertex< CoordType >::m_x

The x-coordinate of the vertex.

Definition at line 198 of file Vertex.hpp.

template<typename CoordType>
CoordType lssr::Vertex< CoordType >::m_y

The y-coordinate of the vertex.

Definition at line 201 of file Vertex.hpp.

template<typename CoordType>
CoordType lssr::Vertex< CoordType >::m_z

The z-coordinate of the vertex.

Definition at line 204 of file Vertex.hpp.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Defines