Developer Documentation

Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
PoseT< PointT > Class Template Reference

A general pose, used to store the frames of the animation. More...

`#include <Type-Skeleton/ObjectTypes/Skeleton/PoseT.hh>`

## Public Member Functions
| PoseT (SkeletonT< Point > *_skeleton)
| Constructor. More...
| PoseT (const PoseT< PointT > &_other)
| Copy Constructor. More...
virtual | ~PoseT ()
| Destructor.
Pose editing
These methods update the other coordinate systems, changing the local coordinates will also change the global and vice versa.
const Matrix & | localMatrix (unsigned int _joint) const
| Returns the local matrix for the given joint. More...
void | setLocalMatrix (unsigned int _joint, const Matrix &_local, bool _keepLocalChildPositions=true)
| Sets the local coordinate system. More...
Vector | localTranslation (unsigned int _joint)
| Returns the local translation vector. More...
void | setLocalTranslation (unsigned int _joint, const Vector &_position, bool _keepLocalChildPositions=true)
| Sets the local translation vector. More...
Matrix | localMatrixInv (unsigned int _joint) const
| Simply returns the inverse of the local matrix.
const Matrix & | globalMatrix (unsigned int _joint) const
| Returns the global matrix for the given joint. More...
void | setGlobalMatrix (unsigned int _joint, const Matrix &_global, bool _keepGlobalChildPositions=true)
| Sets the global coordinate system. More...
Vector | globalTranslation (unsigned int _joint)
| Returns the global translation vector. More...
void | setGlobalTranslation (unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
| Sets the global translation vector. More...
virtual Matrix | globalMatrixInv (unsigned int _joint) const
| Simply returns the inverse of the global matrix. More...
Synchronization
Use these methods to keep the pose in sync with the number (and indices) of the joints.
virtual void | insertJointAt (size_t _index)
| Called by the skeleton/animation as a new joint is inserted. More...
virtual void | removeJointAt (size_t _index)
| Called by the skeleton/animation as a joint is removed. More...
Unified Matrices
Use these methods to gain access to the precalculations performed by this derivation.
const Matrix & | unifiedMatrix (size_t _joint)
| Returns the unified matrix. More...
const Quaternion & | unifiedRotation (size_t _joint)
| Returns a quaternion holding the rotational part of the unified matrix. More...
const DualQuaternion & | unifiedDualQuaternion (size_t _joint)
| Returns a dual quaternion holding the unified matrix represented as dual quaternion. More...

## Protected Types
typedef PointT | Point
typedef Point::value_type | Scalar
typedef ACG::VectorT< Scalar, 3 > | Vector
typedef ACG::Matrix4x4T< Scalar > | Matrix
typedef ACG::QuaternionT< Scalar > | Quaternion
typedef ACG::DualQuaternionT< Scalar > | DualQuaternion

## Protected Member Functions
Coordinate system update methods
These methods propagate the change in one of the coordinate systems into the other. This will keep intact the children nodes' positions per default (by recursively updating all children.). This behavior can be influenced via the _keepChildPositions parameter.
void | updateFromLocal (size_t _joint, bool _keepChildPositions=true)
| This method propagates the change in the local coordinate system to the global system and all children. More...
void | updateFromGlobal (size_t _joint, bool _keepChildPositions=true)
| This method propagates the change in the global coordinate system to the local system and all children. More...

## Protected Attributes
SkeletonT< PointT > * | skeleton_
| a pointer to the skeleton
std::vector< Matrix > | local_
| the pose in local coordinates
std::vector< Matrix > | global_
| the pose in global coordinates
std::vector< Matrix > | unified_
| the global pose matrix left-multiplied to the inverse global reference matrix:
std::vector< DualQuaternion > | unifiedDualQuaternion_

## Friends
template<typename >
class | SkeletonT
template<typename >
class | AnimationT
template<typename >
class | FrameAnimationT

## Detailed Description

### template<typename PointT>
class PoseT< PointT >

A general pose, used to store the frames of the animation.

Definition at line 58 of file PoseT.hh.

## Constructor & Destructor Documentation

## ◆ PoseT() [1/2]

template<typename PointT >

PoseT< PointT >::PoseT | ( | SkeletonT< Point > * | _skeleton | ) |
| explicit

Constructor.

Constructor for a new pose.

The pose will automatically be equipped with the right number of fields for the joints stored in the skeleton. Just fill them with data.

Parameters

  _skeleton | The skeleton that owns this pose

Definition at line 59 of file PoseT_impl.hh.

## ◆ PoseT() [2/2]

template<typename PointT>

PoseT< PointT >::PoseT | ( | const PoseT< PointT > & | _other | ) |
| explicit

Copy Constructor.

Copy constructor.

Creates an independent copy of the given pose.

Definition at line 76 of file PoseT_impl.hh.

## Member Function Documentation

## ◆ globalMatrix()

template<typename PointT >

const PoseT< PointT >::Matrix & PoseT< PointT >::globalMatrix | ( | unsigned int | _joint | ) | const
| inline

Returns the global matrix for the given joint.

global matrix manipulation the global matrix represents a joints orientation/translation in global coordinates

The global Matrix defines the transformation from bone coordinates back into global world coordinates.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The global matrix, relative to world coordinates

Definition at line 193 of file PoseT_impl.hh.

## ◆ globalMatrixInv()

template<typename PointT >

PoseT< PointT >::Matrix PoseT< PointT >::globalMatrixInv | ( | unsigned int | _joint | ) | const
| virtual

Simply returns the inverse of the global matrix.

The inverse of the global Matrix defines the transformation from global world coordinates in the currently active pose into bone coordinates.

Definition at line 267 of file PoseT_impl.hh.

## ◆ globalTranslation()

template<typename PointT >

PoseT< PointT >::Vector PoseT< PointT >::globalTranslation | ( | unsigned int | _joint | ) |
| inline

Returns the global translation vector.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The global translation vector (the 4th column in the global matrix)

Definition at line 227 of file PoseT_impl.hh.

## ◆ insertJointAt()

template<typename PointT >

void PoseT< PointT >::insertJointAt | ( | size_t | _index | ) |
| virtual

Called by the skeleton/animation as a new joint is inserted.

To keep the vectors storing the matrices for the joints in sync with the joints a new entry has to be inserted in exactly the same place if a new joint is added to the skeleton. This is done here. Derived classes have to overwrite this method to keep their data members in sync as well. Always call the base class method first.

Parameters

  _index | The new joint is inserted at this position. Insert new joints at the end by passing SkeletonT<>::jointCount() as parameter.

Definition at line 281 of file PoseT_impl.hh.

## ◆ localMatrix()

template<typename PointT >

const PoseT< PointT >::Matrix & PoseT< PointT >::localMatrix | ( | unsigned int | _joint | ) | const
| inline

Returns the local matrix for the given joint.

local matrix manipulation the local matrix represents a joints orientation/translation in the coordinate frame of the parent joint

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The local matrix, relative to the parents coordinate system

Definition at line 104 of file PoseT_impl.hh.

## ◆ localTranslation()

template<typename PointT >

PoseT< PointT >::Vector PoseT< PointT >::localTranslation | ( | unsigned int | _joint | ) |
| inline

Returns the local translation vector.

The local translation vector describes the translation from the origin of the parent joint coordinate system to the origin of the local joint coordinate system in local coordinates.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The local translation vector (the 4th column in the local matrix)

Definition at line 139 of file PoseT_impl.hh.

## ◆ removeJointAt()

template<typename PointT >

void PoseT< PointT >::removeJointAt | ( | size_t | _index | ) |
| virtual

Called by the skeleton/animation as a joint is removed.

To keep the vectors storing the matrices for the joints in sync with the joints exactly the same entry has to be removed as a joint is removed from the skeleton. This is done here. Derived classes have to overwrite this method to keep their data members in sync as well. Always call the base class method first.

Parameters

  _index | The new joint is inserted at this position. Insert new joints at the end by passing SkeletonT<>::jointCount() as parameter.

Definition at line 298 of file PoseT_impl.hh.

## ◆ setGlobalMatrix()

template<typename PointT >

void PoseT< PointT >::setGlobalMatrix | ( | unsigned int | _joint,
|  | const Matrix & | _global,
|  | bool | _keepGlobalChildPositions = `true`
| ) |  |

Sets the global coordinate system.

The global Matrix defines the transformation from bone coordinates back into global world coordinates. The change will automatically be propagated to all children. Also the local matrices will be updated.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint
  _global | The new global matrix
  _keepGlobalChildPositions | Do the children stay at the same position or do they move with their parent joint

Definition at line 211 of file PoseT_impl.hh.

## ◆ setGlobalTranslation()

template<typename PointT >

void PoseT< PointT >::setGlobalTranslation | ( | unsigned int | _joint,
|  | const Vector & | _position,
|  | bool | _keepGlobalChildPositions = `true`
| ) |  |

Sets the global translation vector.

The matrix is otherwise not modified. The change is automatically propagated to all children. Also the local coordinate frames will be updated.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint
  _position | The new global translation vector
  _keepGlobalChildPositions | Do the children stay at the same position or do they move with their parent joint

Definition at line 249 of file PoseT_impl.hh.

## ◆ setLocalMatrix()

template<typename PointT >

void PoseT< PointT >::setLocalMatrix | ( | unsigned int | _joint,
|  | const Matrix & | _local,
|  | bool | _keepLocalChildPositions = `true`
| ) |  |

Sets the local coordinate system.

The change will automatically be propagated to all children. Also the global matrices will be updated.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint
  _local | The new local matrix
  _keepLocalChildPositions | If true, the positions of the children will be kept

Definition at line 120 of file PoseT_impl.hh.

## ◆ setLocalTranslation()

template<typename PointT >

void PoseT< PointT >::setLocalTranslation | ( | unsigned int | _joint,
|  | const Vector & | _position,
|  | bool | _keepLocalChildPositions = `true`
| ) |  |

Sets the local translation vector.

The matrix is otherwise not modified. The change is automatically propagated to all children. Also the global coordinate frames will be updated.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint
  _position | The new local translation vector
  _keepLocalChildPositions | If true, the positions of the children will be kept

Definition at line 161 of file PoseT_impl.hh.

## ◆ unifiedDualQuaternion()

template<typename PointT >

const PoseT< PointT >::DualQuaternion & PoseT< PointT >::unifiedDualQuaternion | ( | size_t | _joint | ) |
| inline

Returns a dual quaternion holding the unified matrix represented as dual quaternion.

This is used by the Dual Quaternion blend skinning.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The rotational part of the unified matrix

Definition at line 431 of file PoseT_impl.hh.

## ◆ unifiedMatrix()

template<typename PointT >

const PoseT< PointT >::Matrix & PoseT< PointT >::unifiedMatrix | ( | size_t | _joint | ) |
| inline

Returns the unified matrix.

The unified matrix stores

speeding up the calculation of the vertices in the current pose

The matrix

transforms a point of the skin in global coordinates when the skeleton is in the reference pose to local bone coordinates. The Matrix

takes a point in bone coordinates and transforms it back into global coordinates. As the matrix is given by a skeleton in a different pose, the points in local coordinates will therefore follow the skeleton.

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Definition at line 397 of file PoseT_impl.hh.

## ◆ unifiedRotation()

template<typename PointT >

const PoseT< PointT >::Quaternion & PoseT< PointT >::unifiedRotation | ( | size_t | _joint | ) |
| inline

Returns a quaternion holding the rotational part of the unified matrix.

This is used by the spherical blend skinning.

The rotational part of the unified matrix is stored in the real part of the dual quaternion

Parameters

  _joint | The joints index, same as for SkeletonT<>::joint

Returns
  The rotational part of the unified matrix

Definition at line 415 of file PoseT_impl.hh.

## ◆ updateFromGlobal()

template<typename PointT >

void PoseT< PointT >::updateFromGlobal | ( | size_t | _joint,
|  | bool | _keepChildPositions = `true`
| ) |  |
| protected

This method propagates the change in the global coordinate system to the local system and all children.

Do not overwrite this method, instead overwrite BasePose::UpdateFromGlobalCallback. Otherwise the recursion will become a problem.

Parameters

  _joint | The updated joints index
  _keepChildPositions | Do the children stay at the same global position or do they move with their parent joint

Definition at line 353 of file PoseT_impl.hh.

## ◆ updateFromLocal()

template<typename PointT >

void PoseT< PointT >::updateFromLocal | ( | size_t | _joint,
|  | bool | _keepChildPositions = `true`
| ) |  |
| protected

This method propagates the change in the local coordinate system to the global system and all children.

Parameters

  _joint | The updated joints index
  _keepChildPositions | Do the children stay at the same position or do they move with their parent joint

Definition at line 315 of file PoseT_impl.hh.

## Member Data Documentation

## ◆ unifiedDualQuaternion_

template<typename PointT>

std::vector<DualQuaternion> PoseT< PointT >::unifiedDualQuaternion_
| protected

JointT::PoseT::unified in DualQuaternion representation note: the real part of the dual quaternion is the rotation part of the transformation as quaternion

Definition at line 190 of file PoseT.hh.

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

- Type-Skeleton/ObjectTypes/Skeleton/PoseT.hh
- Type-Skeleton/ObjectTypes/Skeleton/PoseT_impl.hh