cgv
Loading...
Searching...
No Matches
cgv::math::rigid_transform< T > Class Template Reference

implementation of a rigid body transformation with a quaternion and a translation vector. More...

#include <rigid_transform.h>

Public Types

typedef cgv::math::fvec< T, 3 > vec_type
 type of 3d vector
 
typedef cgv::math::fvec< T, 4 > hvec_type
 type of homogenous vector
 
typedef cgv::math::quaternion< T > quat_type
 type of quaternions
 
typedef cgv::math::fmat< T, 3, 3 > mat_type
 type of 3x3 matrix
 
typedef cgv::math::fmat< T, 4, 4 > hmat_type
 type of 4x4 matrix
 

Public Member Functions

 rigid_transform ()
 construct identity
 
 rigid_transform (const quat_type &_q, const vec_type &_t)
 construct from quaternion and translation vector to the transformation that first rotates and then translates
 
void transform_vector (vec_type &v) const
 apply transformation to vector
 
void transform_point (vec_type &p) const
 apply transformation to point
 
rigid_transform< T > operator* (const rigid_transform< T > &M) const
 concatenate two rigid transformations
 
rigid_transform< T > & operator+= (const rigid_transform< T > &T)
 multiply quaternion and translation with scalar
 
rigid_transform< T > & operator*= (T s)
 multiply quaternion and translation with scalar
 
rigid_transform< T > operator* (T s) const
 multiply quaternion and translation with scalar
 
void normalize ()
 
rigid_transform< T > inverse () const
 return the inverse transformation
 
vec_type get_transformed_vector (const vec_type &v) const
 apply transformation to vector
 
vec_type get_transformed_point (const vec_type &p) const
 apply transformation to point
 
const vec_typeget_translation () const
 return the translational part
 
vec_typeref_translation ()
 return the translational part
 
const quat_typeget_quaternion () const
 return the rotation as quaternion
 
quat_typeref_quaternion ()
 return the rotation as quaternion
 
hmat_type get_hmat () const
 convert transformation to homogeneous transformation
 
hmat_type get_transposed_hmat () const
 convert transformation to transpose of homogeneous transformation
 

Protected Attributes

quat_type q
 store transformation as quaternion
 
vec_type t
 and translation vector
 

Detailed Description

template<typename T>
class cgv::math::rigid_transform< T >

implementation of a rigid body transformation with a quaternion and a translation vector.

Definition at line 13 of file rigid_transform.h.

Member Typedef Documentation

◆ hmat_type

template<typename T >
typedef cgv::math::fmat<T,4,4> cgv::math::rigid_transform< T >::hmat_type

type of 4x4 matrix

Definition at line 25 of file rigid_transform.h.

◆ hvec_type

template<typename T >
typedef cgv::math::fvec<T,4> cgv::math::rigid_transform< T >::hvec_type

type of homogenous vector

Definition at line 19 of file rigid_transform.h.

◆ mat_type

template<typename T >
typedef cgv::math::fmat<T,3,3> cgv::math::rigid_transform< T >::mat_type

type of 3x3 matrix

Definition at line 23 of file rigid_transform.h.

◆ quat_type

template<typename T >
typedef cgv::math::quaternion<T> cgv::math::rigid_transform< T >::quat_type

type of quaternions

Definition at line 21 of file rigid_transform.h.

◆ vec_type

template<typename T >
typedef cgv::math::fvec<T,3> cgv::math::rigid_transform< T >::vec_type

type of 3d vector

Definition at line 17 of file rigid_transform.h.

Constructor & Destructor Documentation

◆ rigid_transform() [1/2]

template<typename T >
cgv::math::rigid_transform< T >::rigid_transform ( )
inline

construct identity

Definition at line 33 of file rigid_transform.h.

◆ rigid_transform() [2/2]

template<typename T >
cgv::math::rigid_transform< T >::rigid_transform ( const quat_type _q,
const vec_type _t 
)
inline

construct from quaternion and translation vector to the transformation that first rotates and then translates

Definition at line 35 of file rigid_transform.h.

Member Function Documentation

◆ get_hmat()

template<typename T >
hmat_type cgv::math::rigid_transform< T >::get_hmat ( ) const
inline

◆ get_quaternion()

template<typename T >
const quat_type & cgv::math::rigid_transform< T >::get_quaternion ( ) const
inline

return the rotation as quaternion

Definition at line 61 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q.

◆ get_transformed_point()

template<typename T >
vec_type cgv::math::rigid_transform< T >::get_transformed_point ( const vec_type p) const
inline

apply transformation to point

Definition at line 55 of file rigid_transform.h.

References cgv::math::quaternion< T >::apply(), cgv::math::rigid_transform< T >::q, and cgv::math::rigid_transform< T >::t.

◆ get_transformed_vector()

template<typename T >
vec_type cgv::math::rigid_transform< T >::get_transformed_vector ( const vec_type v) const
inline

apply transformation to vector

Definition at line 53 of file rigid_transform.h.

References cgv::math::quaternion< T >::apply(), and cgv::math::rigid_transform< T >::q.

Referenced by cgv::math::rigid_transform< T >::operator*().

◆ get_translation()

template<typename T >
const vec_type & cgv::math::rigid_transform< T >::get_translation ( ) const
inline

return the translational part

Definition at line 57 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::t.

◆ get_transposed_hmat()

template<typename T >
hmat_type cgv::math::rigid_transform< T >::get_transposed_hmat ( ) const
inline

convert transformation to transpose of homogeneous transformation

Definition at line 76 of file rigid_transform.h.

References cgv::math::quaternion< T >::put_matrix(), cgv::math::rigid_transform< T >::q, cgv::math::fmat< T, N, M >::set_row(), and cgv::math::rigid_transform< T >::t.

◆ inverse()

template<typename T >
rigid_transform< T > cgv::math::rigid_transform< T >::inverse ( ) const
inline

return the inverse transformation

Definition at line 51 of file rigid_transform.h.

References cgv::math::quaternion< T >::inverse(), cgv::math::rigid_transform< T >::q, and cgv::math::rigid_transform< T >::t.

◆ normalize()

template<typename T >
void cgv::math::rigid_transform< T >::normalize ( )
inline

Definition at line 49 of file rigid_transform.h.

◆ operator*() [1/2]

template<typename T >
rigid_transform< T > cgv::math::rigid_transform< T >::operator* ( const rigid_transform< T > &  M) const
inline

◆ operator*() [2/2]

template<typename T >
rigid_transform< T > cgv::math::rigid_transform< T >::operator* ( s) const
inline

multiply quaternion and translation with scalar

Definition at line 47 of file rigid_transform.h.

◆ operator*=()

template<typename T >
rigid_transform< T > & cgv::math::rigid_transform< T >::operator*= ( s)
inline

multiply quaternion and translation with scalar

Definition at line 45 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q, and cgv::math::rigid_transform< T >::t.

◆ operator+=()

template<typename T >
rigid_transform< T > & cgv::math::rigid_transform< T >::operator+= ( const rigid_transform< T > &  T)
inline

multiply quaternion and translation with scalar

Definition at line 43 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q, and cgv::math::rigid_transform< T >::t.

◆ ref_quaternion()

template<typename T >
quat_type & cgv::math::rigid_transform< T >::ref_quaternion ( )
inline

return the rotation as quaternion

Definition at line 63 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q.

◆ ref_translation()

template<typename T >
vec_type & cgv::math::rigid_transform< T >::ref_translation ( )
inline

return the translational part

Definition at line 59 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::t.

◆ transform_point()

template<typename T >
void cgv::math::rigid_transform< T >::transform_point ( vec_type p) const
inline

apply transformation to point

Definition at line 39 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q, cgv::math::quaternion< T >::rotate(), and cgv::math::rigid_transform< T >::t.

◆ transform_vector()

template<typename T >
void cgv::math::rigid_transform< T >::transform_vector ( vec_type v) const
inline

apply transformation to vector

Definition at line 37 of file rigid_transform.h.

References cgv::math::rigid_transform< T >::q, and cgv::math::quaternion< T >::rotate().

Member Data Documentation

◆ q

◆ t


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