50 #include "SkeletonTransform.hh"
83 if ( _pose == refPose_){
86 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
90 if ( pose == refPose_ )
122 if ( _pose == refPose_ ){
126 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
130 if ( pose == refPose_ )
159 if ( _pose == refPose_ ){
163 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
167 if ( pose == refPose_ )
229 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
274 transformation.
translate( _translation );
297 std::cerr <<
"Cannot rotate joint. Matrix is not a rotation matrix (det:" <<
determinant(_rotation) <<
")" << std::endl;
320 if ( (_pose == refPose_) || !_applyToWholeAnimation ){
336 if ( _applyToWholeAnimation ){
339 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
367 _m(0,3) * _m(1,2) * _m(2,1) * _m(3,0)-_m(0,2) * _m(1,3) * _m(2,1) * _m(3,0)-_m(0,3) * _m(1,1) * _m(2,2) * _m(3,0)+_m(0,1) * _m(1,3) * _m(2,2) * _m(3,0)+
368 _m(0,2) * _m(1,1) * _m(2,3) * _m(3,0)-_m(0,1) * _m(1,2) * _m(2,3) * _m(3,0)-_m(0,3) * _m(1,2) * _m(2,0) * _m(3,1)+_m(0,2) * _m(1,3) * _m(2,0) * _m(3,1)+
369 _m(0,3) * _m(1,0) * _m(2,2) * _m(3,1)-_m(0,0) * _m(1,3) * _m(2,2) * _m(3,1)-_m(0,2) * _m(1,0) * _m(2,3) * _m(3,1)+_m(0,0) * _m(1,2) * _m(2,3) * _m(3,1)+
370 _m(0,3) * _m(1,1) * _m(2,0) * _m(3,2)-_m(0,1) * _m(1,3) * _m(2,0) * _m(3,2)-_m(0,3) * _m(1,0) * _m(2,1) * _m(3,2)+_m(0,0) * _m(1,3) * _m(2,1) * _m(3,2)+
371 _m(0,1) * _m(1,0) * _m(2,3) * _m(3,2)-_m(0,0) * _m(1,1) * _m(2,3) * _m(3,2)-_m(0,2) * _m(1,1) * _m(2,0) * _m(3,3)+_m(0,1) * _m(1,2) * _m(2,0) * _m(3,3)+
372 _m(0,2) * _m(1,0) * _m(2,1) * _m(3,3)-_m(0,0) * _m(1,2) * _m(2,1) * _m(3,3)-_m(0,1) * _m(1,0) * _m(2,2) * _m(3,3)+_m(0,0) * _m(1,1) * _m(2,2) * _m(3,3);
Represents a single joint in the skeleton.
static double determinant(Matrix4x4 &_m)
compute determinant to check if matrix is rotation matrix
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
Pose * referencePose()
Returns a pointer to the reference pose.
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.
void setGlobalTranslation(unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
Sets the global translation vector.
void translateJoint(Skeleton::Joint *_joint, ACG::Vec3d _translation, bool _keepChildPositions=true)
apply a translation to a joint in the refPose
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
Functions for geometric operations related to angles.
size_t id() const
returns the joint id
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
void setLocalTranslation(unsigned int _joint, const Vector &_position, bool _keepLocalChildPositions=true)
Sets the local translation vector.
SkeletonTransform(Skeleton &_skeleton)
Le constructeur.
Iterator class for the skeleton.
void scaleSkeleton(double _factor, Skeleton::Pose *_pose=0)
scale all bones of the skeleton by the given factor
void transformSkeleton(Matrix4x4 _transformation, Skeleton::Pose *_pose=0)
transform the skeleton
const Matrix & localMatrix(unsigned int _joint) const
Returns the local matrix for the given joint.
virtual Matrix globalMatrixInv(unsigned int _joint) const
Simply returns the inverse of the global matrix.
A general pose, used to store the frames of the animation.
Joint * parent()
Returns the parent joint.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
void translateSkeleton(ACG::Vec3d _translation, Skeleton::Pose *_pose=0)
translate the skeleton
void setLocalMatrix(unsigned int _joint, const Matrix &_local, bool _keepLocalChildPositions=true)
Sets the local coordinate system.
void identity()
setup an identity matrix
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
Vector localTranslation(unsigned int _joint)
Returns the local translation vector.
void transformJoint(Skeleton::Joint *_joint, Matrix4x4 _matrix, bool _keepChildPositions=true)
apply a transformation to a joint in the refPose
void rotateJoint(Skeleton::Joint *_joint, Skeleton::Pose *_pose, Matrix4x4 _rotation, bool _applyToWholeAnimation=true)
rotate a joint in an arbitrary Pose