Developer Documentation
|
A general pose, used to store the frames of the animation. More...
#include <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 | |
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 (unsigned int _index) |
Called by the skeleton/animation as a new joint is inserted. More... | |
virtual void | removeJointAt (unsigned int _index) |
Called by the skeleton/animation as a joint is removed. More... | |
Unified Matrices | |
const Matrix & | unifiedMatrix (unsigned int _joint) |
Returns the unified matrix. More... | |
const Quaternion & | unifiedRotation (unsigned int _joint) |
Returns a quaternion holding the rotational part of the unified matrix. More... | |
const DualQuaternion & | unifiedDualQuaternion (unsigned int _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 (unsigned int _joint, bool _keepChildPositions=true) |
This method propagates the change in the local coordinate system to the global system and all children. More... | |
void | updateFromGlobal (unsigned int _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 |
A general pose, used to store the frames of the animation.
|
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.
_joint | The joints index, same as for SkeletonT<>::joint |
|
inline |
Returns the global translation vector.
_joint | The joints index, same as for SkeletonT<>::joint |
|
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.
_index | The new joint is inserted at this position. Insert new joints at the end by passing SkeletonT<>::jointCount() as parameter. |
|
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
_joint | The joints index, same as for SkeletonT<>::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.
_joint | The joints index, same as for SkeletonT<>::joint |
|
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.
_index | The new joint is inserted at this position. Insert new joints at the end by passing SkeletonT<>::jointCount() as parameter. |
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.
_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 |
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.
_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 |
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.
_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 |
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.
_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 |
|
inline |
Returns a dual quaternion holding the unified matrix represented as dual quaternion.
This is used by the Dual Quaternion blend skinning.
_joint | The joints index, same as for SkeletonT<>::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.
_joint | The joints index, same as for SkeletonT<>::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
_joint | The joints index, same as for SkeletonT<>::joint |
|
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.
_joint | The updated joints index |
_keepChildPositions | Do the children stay at the same global position or do they move with their parent joint |
|
protected |
|
protected |