Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Transformation Class Reference

#include <Transformation.hpp>

Public Member Functions

 Transformation ()
 
void setPosition (vec3 const &position)
 
void setRotation (vec3 const &rotation)
 
void setScale (float const &scale)
 
vec3 const & getPosition () const
 
vec3 const & getRotation () const
 
float const & getScale () const
 
mat4 const & getMatrix ()
 
mat4 const & getMatrixInverse ()
 
void move (vec3 const &delta)
 
void rotate (vec3 const &delta)
 
vec3 const & getLookVector ()
 
vec3 const & getSideVector ()
 
bool const needsRecalc ()
 
void limitRotationX (float from, float to)
 
void limitRotationY (float from, float to)
 
void limitRotationZ (float from, float to)
 

Private Member Functions

void recalc ()
 
void recalcInverse ()
 
void checkLimits ()
 

Private Attributes

mat4 m_matrix
 
mat4 m_matrixInverse
 
vec3 m_position
 
vec3 m_rotation
 
float m_scale
 
bool m_matrixInvalid
 
bool m_matrixInverseInvalid
 
vector< function< void()> > m_limits
 

Detailed Description

Stores a transformation of an object. Supports translation, rotation and uniform-scale

Definition at line 9 of file Transformation.hpp.

Constructor & Destructor Documentation

Constructs a Transformation with no rotation, position at 0,0,0 and scale 1.

Definition at line 4 of file Transformation.cpp.

Member Function Documentation

void checkLimits ( )
private

Checkks all limits and - if necessary - changes position, rotation or scale

Definition at line 120 of file Transformation.cpp.

vec3 const & getLookVector ( )

Returns the foreward- or look-vector.

Returns
the foreward- or look-vector.

Definition at line 81 of file Transformation.cpp.

mat4 const & getMatrix ( )

Accessor to the local matrix.

Returns
A const reference to the local matrix.

Definition at line 57 of file Transformation.cpp.

mat4 const & getMatrixInverse ( )

Accessor to the inverse of the local matrix.

Returns
A const reference to the inverse of the local matrix.

Definition at line 62 of file Transformation.cpp.

vec3 const& getPosition ( ) const
inline

Accessor to the local position.

Returns
A const reference to the local position.

Definition at line 58 of file Transformation.hpp.

vec3 const& getRotation ( ) const
inline

Accessor to the local rotation.

Returns
A const reference to the local rotation.

Definition at line 63 of file Transformation.hpp.

float const& getScale ( ) const
inline

Accessor to the local scale.

Returns
A const reference to the local scale.

Definition at line 68 of file Transformation.hpp.

vec3 const & getSideVector ( )

Returns the side-vector.

Returns
the side-vector.

Definition at line 87 of file Transformation.cpp.

void limitRotationX ( float  from,
float  to 
)

Limits the rotation around the X-axis.

Parameters
fromThe lower-bound of the rotation-angle
toThe upper-bound of the rotation-angle

Definition at line 96 of file Transformation.cpp.

void limitRotationY ( float  from,
float  to 
)

Limits the rotation around the Y-axis.

Parameters
fromThe lower-bound of the rotation-angle
toThe upper-bound of the rotation-angle

Definition at line 104 of file Transformation.cpp.

void limitRotationZ ( float  from,
float  to 
)

Limits the rotation around the Z-axis.

Parameters
fromThe lower-bound of the rotation-angle
toThe upper-bound of the rotation-angle

Definition at line 112 of file Transformation.cpp.

void move ( vec3 const &  delta)

Moves the position by delta. May invalidate the matrices. May be affected by limits.

Parameters
deltathe distance to be moved.

Definition at line 68 of file Transformation.cpp.

bool const needsRecalc ( )

Returns wheter or not the matrices need to be recalculated (because a changed happened)

Returns
Wheter or not the matrices need to be recalculated (because a changed happened)

Definition at line 92 of file Transformation.cpp.

void recalc ( )
private

Recalculates the local matrix, if it is invalid, based on position, roatation and scale

Definition at line 33 of file Transformation.cpp.

void recalcInverse ( )
private

Recalculates the local inverse matrix, if it is invalid, based on position, roatation and scale

Definition at line 47 of file Transformation.cpp.

void rotate ( vec3 const &  delta)

Increases the rotation by delta. May invalidate the matrices. May be affected by limits.

Parameters
deltathe distance to be rotation.

Definition at line 74 of file Transformation.cpp.

void setPosition ( vec3 const &  position)

Sets the position. May invalidate the matrices. May be affected by limits.

Parameters
positionThe new position

Definition at line 15 of file Transformation.cpp.

void setRotation ( vec3 const &  rotation)

Sets the rotation. May invalidate the matrices. May be affected by limits.

Parameters
rotationThe new rotation

Definition at line 21 of file Transformation.cpp.

void setScale ( float const &  scale)

Sets the scale. May invalidate the matrices. May be affected by limits.

Parameters
scaleThe new scale

Definition at line 27 of file Transformation.cpp.

Member Data Documentation

vector<function<void()> > m_limits
private

Functions that limit the valid values

Definition at line 19 of file Transformation.hpp.

mat4 m_matrix
private

The local matrix

Definition at line 11 of file Transformation.hpp.

bool m_matrixInvalid
private

Wheter or not the matrix needs to be updated

Definition at line 16 of file Transformation.hpp.

mat4 m_matrixInverse
private

The inverse of the local matrix

Definition at line 12 of file Transformation.hpp.

bool m_matrixInverseInvalid
private

Wheter or not the inverse-matrix needs to be updated

Definition at line 17 of file Transformation.hpp.

vec3 m_position
private

The local position

Definition at line 13 of file Transformation.hpp.

vec3 m_rotation
private

The local rotation

Definition at line 14 of file Transformation.hpp.

float m_scale
private

The local scale

Definition at line 15 of file Transformation.hpp.


The documentation for this class was generated from the following files: