opensurgsim
Namespaces | Typedefs | Functions
RigidTransform.h File Reference

Definitions of 2x2 and 3x3 rigid (isometric) transforms. More...

#include <Eigen/Core>
#include <Eigen/Geometry>
#include "SurgSim/Math/Quaternion.h"

Go to the source code of this file.

Namespaces

 SurgSim
 Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions.
 

Typedefs

typedef Eigen::Transform< float, 2, Eigen::Isometry > SurgSim::Math::RigidTransform2f
 A 2D rigid (isometric) transform, represented as floats. More...
 
typedef Eigen::Transform< float, 3, Eigen::Isometry > SurgSim::Math::RigidTransform3f
 A 3D rigid (isometric) transform, represented as floats. More...
 
typedef Eigen::Transform< double, 2, Eigen::Isometry > SurgSim::Math::RigidTransform2d
 A 2D rigid (isometric) transform, represented as doubles. More...
 
typedef Eigen::Transform< double, 3, Eigen::Isometry > SurgSim::Math::RigidTransform3d
 A 3D rigid (isometric) transform, represented as doubles. More...
 

Functions

template<typename M , typename V >
Eigen::Transform< typename M::Scalar, M::RowsAtCompileTime, Eigen::Isometry > SurgSim::Math::makeRigidTransform (const Eigen::MatrixBase< M > &rotation, const Eigen::MatrixBase< V > &translation)
 Create a rigid transform using the specified rotation matrix and translation. More...
 
template<typename Q , typename V >
Eigen::Transform< typename Q::Scalar, 3, Eigen::Isometry > SurgSim::Math::makeRigidTransform (const Eigen::QuaternionBase< Q > &rotation, const Eigen::MatrixBase< V > &translation)
 Create a rigid transform using the specified rotation quaternion and translation. More...
 
template<typename T , int VOpt>
Eigen::Transform< T, 3, Eigen::Isometry > SurgSim::Math::makeRigidTransform (const Eigen::Matrix< T, 3, 1, VOpt > &position, const Eigen::Matrix< T, 3, 1, VOpt > &center, const Eigen::Matrix< T, 3, 1, VOpt > &up)
 Make a rigid transform from a eye point a center view point and an up direction, does not check whether up is colinear with eye-center The original formula can be found at http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml. More...
 
template<typename V >
Eigen::Transform< typename V::Scalar, V::SizeAtCompileTime, Eigen::Isometry > SurgSim::Math::makeRigidTranslation (const Eigen::MatrixBase< V > &translation)
 Create a rigid transform using the identity rotation and the specified translation. More...
 
template<typename T , int TOpt>
Eigen::Transform< T, 3, Eigen::Isometry > SurgSim::Math::interpolate (const Eigen::Transform< T, 3, Eigen::Isometry, TOpt > &t0, const Eigen::Transform< T, 3, Eigen::Isometry, TOpt > &t1, T t)
 Interpolate (slerp) between 2 rigid transformations. More...
 

Detailed Description

Definitions of 2x2 and 3x3 rigid (isometric) transforms.

Typedef Documentation

§ RigidTransform2d

typedef Eigen::Transform<double, 2, Eigen::Isometry> SurgSim::Math::RigidTransform2d

A 2D rigid (isometric) transform, represented as doubles.

This type (and any struct that contain it) can be safely allocated via new.

§ RigidTransform2f

typedef Eigen::Transform<float, 2, Eigen::Isometry> SurgSim::Math::RigidTransform2f

A 2D rigid (isometric) transform, represented as floats.

This type (and any struct that contain it) can be safely allocated via new.

§ RigidTransform3d

typedef Eigen::Transform<double, 3, Eigen::Isometry> SurgSim::Math::RigidTransform3d

A 3D rigid (isometric) transform, represented as doubles.

This type (and any struct that contain it) can be safely allocated via new.

§ RigidTransform3f

typedef Eigen::Transform<float, 3, Eigen::Isometry> SurgSim::Math::RigidTransform3f

A 3D rigid (isometric) transform, represented as floats.

This type (and any struct that contain it) can be safely allocated via new.

Function Documentation

§ interpolate()

template<typename T , int TOpt>
Eigen::Transform<T, 3, Eigen::Isometry> SurgSim::Math::interpolate ( const Eigen::Transform< T, 3, Eigen::Isometry, TOpt > &  t0,
const Eigen::Transform< T, 3, Eigen::Isometry, TOpt > &  t1,
t 
)
inline

Interpolate (slerp) between 2 rigid transformations.

Template Parameters
Tthe numeric data type used for arguments and the return value. Can usually be deduced.
TOptthe option flags (alignment etc.) used for the Transform arguments. Can be deduced.
Parameters
t0The start transform (at time 0.0).
t1The end transform (at time 1.0).
tThe interpolation time requested. Within [0..1].
Returns
the transform resulting in the slerp interpolation at time t, between t0 and t1.
Note
t=0 => returns t0
t=1 => returns t1

§ makeRigidTransform() [1/3]

template<typename M , typename V >
Eigen::Transform<typename M::Scalar, M::RowsAtCompileTime, Eigen::Isometry> SurgSim::Math::makeRigidTransform ( const Eigen::MatrixBase< M > &  rotation,
const Eigen::MatrixBase< V > &  translation 
)
inline

Create a rigid transform using the specified rotation matrix and translation.

Template Parameters
Mthe type used to describe the rotation matrix. Can usually be deduced.
Vthe type used to describe the translation vector. Can usually be deduced.
Parameters
rotationthe rotation matrix.
translationthe translation vector.
Returns
the transform with the specified rotation and translation.

§ makeRigidTransform() [2/3]

template<typename Q , typename V >
Eigen::Transform<typename Q::Scalar, 3, Eigen::Isometry> SurgSim::Math::makeRigidTransform ( const Eigen::QuaternionBase< Q > &  rotation,
const Eigen::MatrixBase< V > &  translation 
)
inline

Create a rigid transform using the specified rotation quaternion and translation.

Template Parameters
Qthe type used to describe the rotation quaternion. Can usually be deduced.
Vthe type used to describe the translation vector. Can usually be deduced.
Parameters
rotationthe rotation quaternion.
translationthe translation vector.
Returns
the transform with the specified rotation and translation.

§ makeRigidTransform() [3/3]

template<typename T , int VOpt>
Eigen::Transform<T, 3, Eigen::Isometry> SurgSim::Math::makeRigidTransform ( const Eigen::Matrix< T, 3, 1, VOpt > &  position,
const Eigen::Matrix< T, 3, 1, VOpt > &  center,
const Eigen::Matrix< T, 3, 1, VOpt > &  up 
)
inline

Make a rigid transform from a eye point a center view point and an up direction, does not check whether up is colinear with eye-center The original formula can be found at http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml.

Template Parameters
typenameT T the numeric data type used for arguments and the return value. Can usually be deduced.
intVOpt VOpt the option flags (alignment etc.) used for the axis vector argument. Can be deduced.
Parameters
positionThe position of the object.
centerThe point to which the object should point.
upThe up vector to be used for this calculation.
Returns
a RigidTransform that locates the object at position rotated into the direction of center.

§ makeRigidTranslation()

template<typename V >
Eigen::Transform<typename V::Scalar, V::SizeAtCompileTime, Eigen::Isometry> SurgSim::Math::makeRigidTranslation ( const Eigen::MatrixBase< V > &  translation)
inline

Create a rigid transform using the identity rotation and the specified translation.

Template Parameters
Vthe type used to describe the translation vector. Can usually be deduced.
Parameters
translationthe translation vector.
Returns
the transform with the identity rotation and the specified translation.