## jit.anim.drive and rotatexyz z axis issue

Apr 17 2013 | 11:00 am
Hi,
I've got an issue when rotating a jit.gl.camera using jit.anim.node. I intend to rotate the camera using the keyboard and retrieve rotation information via the rotatexyz attribute. Rotation for the X and Y axes is output as expected between -180 and 180 for a full 360 degrees, whereas Z axis rotation goes between -90, 90 and then back to -90 for the full 360 degrees. I have attached a patch with ajit.gl.gridshape in order to demonstrate the problem.
This is an issue as I cannot retrieve Z axis rotation between 0 and 360. Has anyone come across this before? Is there something I'm missing or is there another way I could retrieve rotation information? Any help would be greatly appreciated.
Thanks

• Apr 17 2013 | 11:55 am
Welcome to coordinate system fun. (btw, read up on gimbal lock http://en.wikipedia.org/wiki/Gimbal_lock also) Might I suggest that you consider using rotation describes as an axis/angle (@rotate) or a quaterion (@quat) and to stay in that rotation/coordinate system. However, if you really want to keep in euler x y z, then notice that your Y rotation is changing. One cycle of the z -90 to 90 it is 0 NExt cycle it is 180 So you are experiencing a full 360 degrees of rotation. It is just being described by using the Y and Z rotations together. You wouldn't be able to get a full smooth 360 degrees of rotation simultaneously on all X Y Z axis...due to gimbal lock.
• Apr 17 2013 | 12:55 pm
Thanks for your help, I figured I must have been missing something. The plan was to use to the rotation of the jit.gl.camera to change rotation, tilt and tumble of a B-Format ambisonic sound field. It looks like I have some more reading to do on the subject.
• Apr 17 2013 | 3:56 pm
Fun! You'll get it. Think about your hand. Point it out in front of you, fingers away from your body and palm facing down. Now, keep your hand stiff and rotate your fingers down towards the floor until they point straight down. You've just done a 90 degree rotation around the X axis. Continue this rotation (which is physically difficult due to your bones...so imagine). You will continue to rotate until the fingers point back to your body. However now...your palm is facing up. This is an example of that sudden 0/180 flip you see in an axis (the Y in your patch example). Make sense?
Perhaps also reference COSM for the audio stuff http://www.allosphere.ucsb.edu/cosm/concepts.html
• Apr 17 2013 | 8:33 pm
After some reading and experimentation (the hand analogy helped), euler isn't going to be suitable as I need 360 degrees of free rotation. Unfortunately the ambisonic sound field manipulation formulas take rotation in x y z so I think I need to convert them to quaternion rotation or axis/angle. As i'm encoding sound sources at different positions to B-format ambisonics, another I idea I've had is to apply the rotation from the jit.gl.camera to all of the cartesian positions, effectively rotating the position of sounds before encoding instead of rotating the sound field afterwards. The COSM stuff looks great but I'm putting this together for a university project so I'm trying to keep externals to a minimum and build as much as I can myself.