SpatiumLib
Public Member Functions | Protected Attributes | List of all members
spatium::gfx3d::Transform Class Reference

Tranformation in 3D space. More...

#include <Transform.h>

Collaboration diagram for spatium::gfx3d::Transform:
Collaboration graph
[legend]

Public Member Functions

 Transform ()
 
geom3d::Vector3 right () const
 Get the vector pointing to the right (positive X axis) More...
 
geom3d::Vector3 up () const
 Get the vector pointing up (positive y axis) More...
 
geom3d::Vector3 back () const
 Get the vector pointing back (positive z axis) More...
 
geom3d::Point3 position () const
 Get the position in world space (translation) More...
 
void setPosition (const geom3d::Point3 &xyz)
 Set the position in world space (translation) More...
 
void translate (const geom3d::Vector3 &xyz)
 Translate in world space. More...
 
geom3d::Vector3 scale () const
 Get the scale. More...
 
void rotate (const geom3d::Vector3 &euler)
 Rotate (relative to self/object space) More...
 
void setRotation (const geom3d::Vector3 &euler)
 Set the rotation in world space. More...
 
geom3d::Vector3 rotation () const
 Get the rotation in world space. More...
 
void setMatrix (const geom3d::Matrix4x4 &matrix)
 Set the transformation matrix. More...
 
geom3d::Matrix4x4 matrix () const
 Get the transformation matrix. More...
 
geom3d::Point3 objectPointToWorldPoint (const geom3d::Point3 &point) const
 Convert 3D Cartesian point coordinates from object space to world space. Object coordinates are defined with respect to the object's local coordinate system. World coordinates are defined with resect to the world's global cordinate system. (Origin = [0,0,0]) More...
 
geom3d::Point3 worldPointToObjectPoint (const geom3d::Point3 &point) const
 Convert 3D Cartesian point coordinates from world space to object space. World coordinates are defined with resect to the world's global cordinate system. (Origin = [0,0,0]) Object coordinates are defined with respect to the object's local coordinate system. More...
 

Protected Attributes

geom3d::Matrix4x4 m_matrix
 Transformation matrix. More...
 

Detailed Description

Tranformation in 3D space.

Default transformation (identity).

1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1

1st column = right vector 2nd column = up vector 3rd column = back vector 4rd column = translation (position)

Constructor & Destructor Documentation

◆ Transform()

spatium::gfx3d::Transform::Transform ( )
inline

Member Function Documentation

◆ back()

geom3d::Vector3 spatium::gfx3d::Transform::back ( ) const
inline

Get the vector pointing back (positive z axis)

Returns
Back vector

◆ matrix()

geom3d::Matrix4x4 spatium::gfx3d::Transform::matrix ( ) const
inline

Get the transformation matrix.

Returns
Transformation matrix

◆ objectPointToWorldPoint()

geom3d::Point3 spatium::gfx3d::Transform::objectPointToWorldPoint ( const geom3d::Point3 point) const
inline

Convert 3D Cartesian point coordinates from object space to world space. Object coordinates are defined with respect to the object's local coordinate system. World coordinates are defined with resect to the world's global cordinate system. (Origin = [0,0,0])

Parameters
[in]pointPoint cordinates in object space
Returns
Point coordinates in world space

◆ position()

geom3d::Point3 spatium::gfx3d::Transform::position ( ) const
inline

Get the position in world space (translation)

Returns
Position

◆ right()

geom3d::Vector3 spatium::gfx3d::Transform::right ( ) const
inline

Get the vector pointing to the right (positive X axis)

Returns
Right vector

◆ rotate()

void spatium::gfx3d::Transform::rotate ( const geom3d::Vector3 euler)
inline

Rotate (relative to self/object space)

Parameters
[in]eulerDegrees around x, y and z axis
Todo:
This doesn't work... Use TRS?

◆ rotation()

geom3d::Vector3 spatium::gfx3d::Transform::rotation ( ) const
inline

Get the rotation in world space.

Returns
Rotation in euler angles
Todo:
Check if should each column should be scaled first?
Todo:
Unsafe compare
Todo:
Unsafe compare

◆ scale()

geom3d::Vector3 spatium::gfx3d::Transform::scale ( ) const
inline

Get the scale.

Returns
Scale on x, y and z axis

◆ setMatrix()

void spatium::gfx3d::Transform::setMatrix ( const geom3d::Matrix4x4 matrix)
inline

Set the transformation matrix.

Parameters
[in]matrixTransformation matrix

◆ setPosition()

void spatium::gfx3d::Transform::setPosition ( const geom3d::Point3 xyz)
inline

Set the position in world space (translation)

Parameters
[in]positionPosition

◆ setRotation()

void spatium::gfx3d::Transform::setRotation ( const geom3d::Vector3 euler)
inline

Set the rotation in world space.

Parameters
[in]eulerRotation in euler angles

◆ translate()

void spatium::gfx3d::Transform::translate ( const geom3d::Vector3 xyz)
inline

Translate in world space.

Parameters
[in]xyzTranslation on X, Y and Z axis

◆ up()

geom3d::Vector3 spatium::gfx3d::Transform::up ( ) const
inline

Get the vector pointing up (positive y axis)

Returns
Up vector

◆ worldPointToObjectPoint()

geom3d::Point3 spatium::gfx3d::Transform::worldPointToObjectPoint ( const geom3d::Point3 point) const
inline

Convert 3D Cartesian point coordinates from world space to object space. World coordinates are defined with resect to the world's global cordinate system. (Origin = [0,0,0]) Object coordinates are defined with respect to the object's local coordinate system.

Parameters
[in]pointPoint cordinates in world space
Returns
Point coordinates in object space

Member Data Documentation

◆ m_matrix

geom3d::Matrix4x4 spatium::gfx3d::Transform::m_matrix
protected

Transformation matrix.


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