JigLibJS icon indicating copy to clipboard operation
JigLibJS copied to clipboard

degrees/radians conversion

Open hero101111 opened this issue 13 years ago • 1 comments

Hi,

I've noticed that the Matrix3D class (jiglib/maths/matrix3d.js) possibly has a bug in the appendRotation() and angleAxis() functions. The conversion from degrees to angles is done with angle=angle/(pi_2), whereas it should be angle=angle_pi/180 (or angle_2_pi/360). I am also wondering why in the appendRotation() function you negate the axis of rotation (Vector3DUtil.negate(axis)). If, for example, I set the rotation angles [10, 20, 30] of an object and I apply inverse transformations to the orientation matrix I get the rotation angles [350, 340, 330](with degrees/radians conversion fixed). If I comment the axis negation part I get the right values ([10, 20, 30]).

Regards, Gabriel

hero101111 avatar Apr 06 '11 11:04 hero101111

Good spots, I'm not sure why it's that way I'll do some investigation not sure where the code came from initially. Although, the conversion one would certainly explain some funky behaviour I've seen. I know many of the functions in the maths part aren't used by jiglib which maybe how they've gone unnoticed.

supereggbert avatar Apr 06 '11 11:04 supereggbert