## Re: [max-msp] faking jit.gl.handle autorotate

May 16, 2006 at 4:19pm

# Re: [max-msp] faking jit.gl.handle autorotate

Coming back on this old post I never got a reply to…Not that I’ve spent a
whole year on this but I still can’t figure it out:-)

If you use the mouse input to autorotate a jit.gl.handle all axis are
rotating most of the time. How is this calculated? I can’t get my head
around it. I guess the mouse input generates a vector that is used to
compute the rotation and speed on every axis, but how?

I’d like to store/recall the vector and speed to compute the rotate or
rotatexyz parameters without using jit.gl.handle and without actual mouse
input. Can someone with better math skills help me out please?

-thijs

#26180
May 16, 2006 at 6:01pm

Hi Wes, from what I understand your approach is similar to the one I use
right now (rotating one axis – the other 2 fixed offsets – moving the camera
around).
The problem is that using the mouse input on a handle, there are 3 axis
involved in the rotation. Your patch doesn’t explain to me how to generate a
rotation like that. (without moving around the camera/scene)

I think this is more obvious looking at a plane then a torus. Forgive me if
I’m being stupid, but I don’t know how I can explain myself otherwise.

best, -thijs

#77856
May 16, 2006 at 6:09pm

HI Thijs,

I’m not sure if the Jitter3DUtils or even JavaScript support was
available when you first asked your question. But now the answer is
simple: use the quaternion rotation code from the Jitter3dUtils.
Keep track of your rotation as a quaternion, accumulating it with
add_quats. Use quat_to_axis to convert into axis/angle format.
Plenty of intro-to-quaternions stuff from the gave development world
should be available through Google.

best
Randy

#77857
May 16, 2006 at 6:15pm

Hey Thijs,

I’d suggest looking at both the Jitter3DUtils.js (c74:/js-extensions)
and the topic on joyrotate/nudgexyz which has some of these things
duplicated, but provides a nudgexyz method.

We could add this in a future version of Jitter3DUtils.js

-Joshua

#77859
May 16, 2006 at 8:18pm

Thanks guys! that’s exactly what I need. Last time I looked at Jitter3DUtils
I didn’t understand anything so I couldn’t remember whats in it either.
Quaternions is still a bit blurry but I’m getting there. The nudgexyz code
will definitely get me going. Thanks again.

Best, -thijs

#77860
May 16, 2006 at 9:09pm

In case someone else cares to learn about quaternion rotations… I found
this really clear and helpful

-thijs

#77861

You must be logged in to reply to this topic.