How do I turn two values into xy coordinates?

May 6, 2012 at 1:24pm

How do I turn two values into xy coordinates?

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. –
#63450
May 6, 2012 at 6:18pm

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. –
#228782
May 7, 2012 at 1:21pm

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.

#228783
May 7, 2012 at 3:08pm

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.

#228784

You must be logged in to reply to this topic.