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

Nov 4, 2011 at 7:00pm

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

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

#59811
Nov 5, 2011 at 3:31am

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. –
#215232
Nov 5, 2011 at 3:36am

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.

#215233
Nov 5, 2011 at 4:04am

#215234
Mar 13, 2012 at 8:43pm

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. –
#215235
Mar 13, 2012 at 9:15pm

Wow, great patch!

#215236
Mar 14, 2012 at 11:35am

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. –
#215237
Mar 14, 2012 at 12:20pm

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

#215238
May 9, 2012 at 11:59pm

thank you for sharing this!

#215240
Dec 10, 2012 at 9:00am

I love all of you.

#215241
Dec 10, 2012 at 4:10pm

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

#215242
Dec 10, 2012 at 4:25pm

Sweet thanks!

J

#215243

You must be logged in to reply to this topic.