code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

calculateDiffAxisAngle. how it works? #346

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. using btTransformUtil::calculateDiffAxisAngle with with transformation1
   a rotation in y axis.
2.
3.

What is the expected output? What do you see instead?
a rotation in Y. I get a rotation in another axis

What version of the product are you using? On what operating system?
2.75

Please provide any additional information below.

i suppouse that
    transformation0 = initial transformation
    transformation1 = final   transformation
    Dmat diference transformation maybe it is not how it really works

    T0 * Dmat = T1
    then if we premultiplicate by T0 inverse
    T0.inverse * T0 * Dmat = T0.inverse * T1
    1 * Dmat = T0.inverse * T1

changing line 
   btMatrix3x3 dmat = transform1.getBasis() * transform0.getBasis().inverse();

   to

   btMatrix3x3 dmat = transform0.getBasis().inverse() * transform1.getBasis();

works as i believe it works.

Original issue reported on code.google.com by plbar...@gmail.com on 26 Feb 2010 at 2:27

GoogleCodeExporter commented 9 years ago
Here is some example usage:

btTransform tr0, tr1,tr2;
    tr0.setIdentity();
    tr1.setIdentity();
    tr1.setOrigin(btVector3(1,1,1));
    tr1.setRotation(btQuaternion(btVector3(1,0,0),0.1*1.772453851));

    btTransform dt;
    btVector3 axis,axis1;
    btScalar angle,angle1;
    btVector3 linvel,angvel;

    btTransformUtil::calculateDiffAxisAngle(tr0,tr1,axis,angle);
    btTransformUtil::calculateDiffAxisAngleQuaternion(tr0.getRotation(),tr1.getRotation(),axis1,angle1);
    btTransformUtil::calculateVelocity(tr0,tr1,1,linvel,angvel);

    MultiThreadedDemo* demo = new MultiThreadedDemo();
    btTransformUtil::integrateTransform(tr0,linvel,angvel,1,tr2);
    btQuaternion orn1 = tr2.getRotation();
    btQuaternion orn2 = tr1.getRotation();

Original comment by erwin.coumans on 9 Sep 2012 at 9:51