JigLibJS
JigLibJS copied to clipboard
degrees/radians conversion
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
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.