Forums > Jitter

How to rotate a vertex position matrix with angle-axis input


dtr
June 13, 2012 | 2:02 pm

Hi,
I haven’t been able to work this one out. How do I rotate a matrix with XYZ position data with an angle-axis vector (a,x,y,z) as input? Is there an external that does this?

Tanx, D.



dtr
June 13, 2012 | 2:14 pm

Ok I found one solution in Graham Wakefield’s quat externals: [axis2quat] and [quatpov]. This forces me to to iterate through the matrix cells though. Is there a solution that transforms the matrix data directly? With the right math code I could make a jit.gen operation as well.




dtr
June 13, 2012 | 4:00 pm

I should be able to max-ify that. Tanx!


June 13, 2012 | 6:12 pm

couple things to mention.
there are max 6 native versions of the quaternion objects.
jit.quat
jit.quat2euler
jit.euler2quat
jit.quat2axis
jit.axis2quat

if your matrix of vertices came from an jit.gl object in matrixoutput mode, you can apply a rotation to the object itself and use @matrixoutput 2, to output the transformed vertices.

but otherwise, you should be able to construct a gen patch that takes a quaternion as a parameter, and transforms the vertices appropriately.



dtr
June 13, 2012 | 7:02 pm

tanx!

> if your matrix of vertices came from an jit.gl object in matrixoutput mode, you can apply a rotation to the object itself and use @matrixoutput 2, to output the transformed vertices.

I know but this is exactly to work around the lack of matrixoutput in jit.gl.mesh…


June 21, 2012 | 12:33 pm

dtr, I’m interested, by your final solution.
jit.gen ?



dtr
June 21, 2012 | 12:51 pm

Hey, I didn’t implement it yet. It’s on my list for optimization steps but got more pressing issues right now…


June 21, 2012 | 12:54 pm

argh :)
all forces with you!

on my side, playing with quaternions.. I’ll post my stuff soon



dtr
June 21, 2012 | 1:00 pm

Thanks! 4 days till graduation exam performance, gotta weave all those loose threads together in a solid fabric…


Viewing 10 posts - 1 through 10 (of 10 total)