Forums > MaxMSP

matrix transformation on a simple 2d or 3d vector (list)

November 4, 2011 | 7:00 pm

Is there something in between vexpr for simple vector (list) math, and jit.mxform.. for transforming a whole matrix?

e.g. something that allows me to avoid making this in Max:

http://www.kwon3d.com/theory/transform/rot.html


November 5, 2011 | 3:31 am

Figured this one out on my own. Was not as hard as I thought (at least for 2d vectors) and was very satisfying. Here’s the solution for posterity…

– Pasted Max Patch, click to expand. –

November 5, 2011 | 3:36 am

And… adding the 3rd dimension is trivial.

if you are rotating about the z axis, then z=z, and the above pertains.

If you are rotating about the x axis, then use x=x, and use the formula previously used for x for y and y for z.

If rotating about y: use y=y and shift the others once more, wrapping: y to z and z to x.

The visuals from the link above help.


November 5, 2011 | 4:04 am

Oh yeah and angle is in radians (pi radians = 180°)


March 13, 2012 | 8:43 pm

reminds me of this jitter toy i made back in the days

http://www.cycling74.com/forums/topic.php?id=7523

– Pasted Max Patch, click to expand. –

March 13, 2012 | 9:15 pm

Wow, great patch!



dtr
March 14, 2012 | 11:35 am

i’ve got this for rotation of matrix position data (sorry no time to put it in a nice demo patch, the XYZ rotation order might be jumbled as well)

– Pasted Max Patch, click to expand. –

March 14, 2012 | 12:20 pm

i rmmbr that one from an old forum thread
here is a clearer example patch

– Pasted Max Patch, click to expand. –

http://www.cycling74.com/forums/topic.php?id=9950


May 9, 2012 | 11:59 pm

thank you for sharing this!


December 10, 2012 | 9:00 am

I love all of you.


December 10, 2012 | 4:10 pm

short note for anyone stumbling across this, if you’re trying to do this with 3D objects using max 6 you can use jit.anim.drive that handles rotations springs and translations pretty painlessly , and most matrix types support @matrix output 2 which outputs the data after its been rotated

I built a large complicated patch in max5 before these features were around, really nice now that they’re here


December 10, 2012 | 4:25 pm

Sweet thanks!

J


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