jit.gen & quaternions

Julien Bayle's icon

Hi there,
is there a way to use easily quaternions with jit.gen ??

I need to process a 3 planes matrix with x,y,z space coordinates with jit.gen (which is okay) but my calculation involves quaternions.
Each row of coordinates have to be multiplied by quaternions & quaternions conjugates.

anyone already did that with jit.gen ?
if someone could help even outside of gen, I'd be happy :D

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

hi julien. below is a patch that rotates vectors by a quaternion using jit.gen.

Julien Bayle's icon

Hi Robert,
thanks a lot for your patch.
I'll try it asap in my system.
I'll grab the quat from jit.anim.node in order to not have problem with gimbal lock coming from euler angles, but I guess the jit.gen calculations remain the same.

posting when I'll have tested it.

Julien Bayle's icon

I guess I'm VERY near from my solution.

I'm rotating my vectors by the quaternion rotation.
each vector is made by (objectVector - camVector)

I included your codebox into mine and put the azimuth & elevation calculation in another codebox.

I don't know if it is a problem of vector normalization or whatever, but it still doesn't work.
if I move the camera "around" the object, by keeping the object in the center of my view, I should still have az=0 & el=0 ... this is basic and I absolutely don't understand why I don't have that :-(

4181.snapshot.PNG
PNG
Julien Bayle's icon

Robert, can I request some help ?
I'm still stuck.
I don't understand where my logic fails

Julien Bayle's icon

I tried to grab the rotation quaternion of my cam from jit.anim.node, gl.camera .. it doesnt work better
This is a calculation error (in the part I made for sure) and I cannot debug it :-(

Julien Bayle's icon

anyone else would help me ?