Developer Documentation
|
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 | |
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 | |
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 |
A general pose, used to store the frames of the animation.
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.
_skeleton | The skeleton that owns this pose |
Definition at line 59 of file PoseT_impl.hh.
Copy Constructor.
Copy constructor.
Creates an independent copy of the given pose.
Definition at line 76 of file PoseT_impl.hh.
|
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 |
Definition at line 193 of file PoseT_impl.hh.
|
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.
|
inline |
Returns the global translation vector.
_joint | The joints index, same as for SkeletonT<>::joint |
Definition at line 227 of file PoseT_impl.hh.
|
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. |
Definition at line 281 of file PoseT_impl.hh.
|
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 |
Definition at line 104 of file PoseT_impl.hh.
|
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 |
Definition at line 139 of file PoseT_impl.hh.
|
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. |
Definition at line 298 of file PoseT_impl.hh.
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 |
Definition at line 211 of file PoseT_impl.hh.
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 |
Definition at line 249 of file PoseT_impl.hh.
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 |
Definition at line 120 of file PoseT_impl.hh.
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 |
Definition at line 161 of file PoseT_impl.hh.
|
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 |
Definition at line 431 of file PoseT_impl.hh.
|
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 |
Definition at line 397 of file PoseT_impl.hh.
|
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 |
Definition at line 415 of file PoseT_impl.hh.
|
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 |
Definition at line 353 of file PoseT_impl.hh.
|
protected |
This method propagates the change in the local coordinate system to the global system and all children.
_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.
|
protected |