44 #include "SkeletonTransform.hh" 77 if ( _pose == refPose_){
80 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
84 if ( pose == refPose_ )
116 if ( _pose == refPose_ ){
120 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
124 if ( pose == refPose_ )
153 if ( _pose == refPose_ ){
157 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
161 if ( pose == refPose_ )
223 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
268 transformation.
translate( _translation );
291 std::cerr <<
"Cannot rotate joint. Matrix is not a rotation matrix (det:" <<
determinant(_rotation) <<
")" << std::endl;
314 if ( (_pose == refPose_) || !_applyToWholeAnimation ){
330 if ( _applyToWholeAnimation ){
333 for (
unsigned int iFrame = 0; iFrame < skeleton_.
animation(a)->frameCount(); iFrame++){
361 _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)+
362 _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)+
363 _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)+
364 _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)+
365 _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)+
366 _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);
void scaleSkeleton(double _factor, Skeleton::Pose *_pose=0)
scale all bones of the skeleton by the given factor
void setLocalMatrix(unsigned int _joint, const Matrix &_local, bool _keepLocalChildPositions=true)
Sets the local coordinate system.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
Functions for geometric operations related to angles.
const Matrix & localMatrix(unsigned int _joint) const
Returns the local matrix for the given joint.
static double determinant(Matrix4x4 &_m)
compute determinant to check if matrix is rotation matrix
void setGlobalTranslation(unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
Sets the global translation vector.
void transformSkeleton(Matrix4x4 _transformation, Skeleton::Pose *_pose=0)
transform the skeleton
Matrix localMatrixInv(unsigned int _joint) const
Simply returns the inverse of the local matrix.
A general pose, used to store the frames of the animation.
virtual Matrix globalMatrixInv(unsigned int _joint) const
Simply returns the inverse of the global matrix.
Vector localTranslation(unsigned int _joint)
Returns the local translation vector.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Iterator class for the skeleton.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
void transformJoint(Skeleton::Joint *_joint, Matrix4x4 _matrix, bool _keepChildPositions=true)
apply a transformation to a joint in the refPose
Joint * parent()
Returns the parent joint.
Pose * referencePose()
Returns a pointer to the reference pose.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
void setLocalTranslation(unsigned int _joint, const Vector &_position, bool _keepLocalChildPositions=true)
Sets the local translation vector.
void rotateJoint(Skeleton::Joint *_joint, Skeleton::Pose *_pose, Matrix4x4 _rotation, bool _applyToWholeAnimation=true)
rotate a joint in an arbitrary Pose
Represents a single joint in the skeleton.
void translateJoint(Skeleton::Joint *_joint, ACG::Vec3d _translation, bool _keepChildPositions=true)
apply a translation to a joint in the refPose
void translateSkeleton(ACG::Vec3d _translation, Skeleton::Pose *_pose=0)
translate the skeleton
void identity()
setup an identity matrix
SkeletonTransform(Skeleton &_skeleton)
Le constructeur.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
size_t id() const
returns the joint id