Forums > MaxMSP

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

Nov 04 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

Nov 05 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. --

```
```
Nov 05 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.

Nov 05 2011 | 4:04 am

Mar 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. --

```
```
Mar 13 2012 | 9:15 pm

Wow, great patch!

Mar 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. --

```
```
Mar 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 09 2012 | 11:59 pm

thank you for sharing this!

Dec 10 2012 | 9:00 am

I love all of you.

Dec 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

Dec 10 2012 | 4:25 pm

Sweet thanks!

J

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

Forums > MaxMSP