Forums > MaxMSP

How do I turn two values into xy coordinates?

May 06 2012 | 1:24 pm

I have some basic jitter colour tracking going on, I have a linear scale of 1 to 10 for the x axis and the same for the y.

I’m trying to create an imaginary ‘grid’ within the Jitter window so when ever the colour tracked is in a specific grid it can trigger something. but each grid needs to have it’s own unique value so I can use the select object.

Is there a way I can turn these into coordinates or a way I can give each "grid" it’s own unique value?

— Pasted Max Patch, click to expand. —
May 06 2012 | 6:18 pm

you have to do just the right [scale] function. it’s a little tricky to get the right mapping, because you need floats first (so you have full sizes in each grid cell), then you use ints to set a [gate] to split things around. probably there are other ways too, but this seems to work:

-- Pasted Max Patch, click to expand. --

May 07 2012 | 1:21 pm

Thank you, sometimes when sitting in front of Max I get a little stuck in my ways and I end up banging my head against the desk due to the fact that I don’t see other ways around it. This is a very simple solution, thank you very much.

May 07 2012 | 3:08 pm

Don’t worry, I only had this solution because I did my own share of head banging in another similar project, believe me…happens to all of us I think ;)

There definitely are a lot of tweaks you can do with [scale] and [round] and converting to and from ints and floats…sometimes it just takes a lot of experimentation to get what you want.

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

Forums > MaxMSP