glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
116 stars 56 forks source link

Shape's createTransformationMatrix is buggy #197

Open Matyooo opened 7 years ago

Matyooo commented 7 years ago

Hi all$ @amazingsmash , @DiegoGomezDeck , @akosmaroy

I think a caught a bug for you. Shape.cpp:85 was:

const MutableMatrix44D localTransform = headingRotation.multiply(pitchRotation).multiply(rollRotation).multiply(translation).multiply(scale);
should be: const MutableMatrix44D localTransform = translation.multiply(headingRotation).multiply(pitchRotation).multiply(rollRotation).multiply(scale);

The right order of transformations is scale first, then rotations around origo then translation. What do you think?

amazingsmash commented 7 years ago

Hi @Matyooo ,

I think you are right. The current operation (TV = R_T_S*V) rotates the vertex after being translated, ending up in a rotation that is no longer intrinsic to the object.

An animated rotation with a fix translation of a model shows the effects. I checked the TV = T_R_S*V transformation and it seems to produce proper results.

DiegoGomezDeck commented 7 years ago

Any pull request to solve it?