Forums > MaxMSP

making a grid …

August 3, 2008 | 12:36 am

Hi,
- I would like to make a grid between 1000x values and 1000 y values with a
resolution of 50, so that each field of the grid is 50 values. If the x and
y values from i.e. a wii are inside the very first field x value 0-50 and y
value 0-50, then write "a", if the second field x value is 50-100 and y
value is 0-50 then write "b" aso.

How do I do that efficiently in max, without using a ton of
if-sentence-objects? Could anyone give me a good example?

Best,
Andrea


August 3, 2008 | 6:49 am

effectively you’re dividing the 1000 value range into 20 parts.
the easiest way would be to divide x and y by 50 then multiply y by 20
to get the row step and add the two values together to get a unique
consecutive index for each grid-square. fill a coll with the desired
results at each square index, query that and you’re done.

hth

/*j

> – I would like to make a grid between 1000x values and 1000 y values
> with a resolution of 50, so that each field of the grid is 50
> values. If the x and y values from i.e. a wii are inside the very
> first field x value 0-50 and y value 0-50, then write "a", if the
> second field x value is 50-100 and y value is 0-50 then write "b" aso.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 56 339 32 196617 print;
#N coll map 1;
#T flags 1 0;
#T 0 a;
#T 1 b;
#T 2 c;
#T 3 d;
#T 4 e;
#T 5 f;
#P newobj 56 312 56 196617 coll map 1;
#P number 56 179 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 146 179 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 56 286 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 56 254 27 196617 +;
#P newex 146 225 32 196617 * 20;
#P newex 146 202 31 196617 / 50;
#P newex 56 202 31 196617 / 50;
#P user pictslider 56 70 100 100 4 4 4 4 SliderDefaultKnob.pct 0
SliderDefaultBkgnd.pct 0 2163 0 0 65537000 1. 1.;
#P connect 8 0 9 0;
#P connect 5 0 8 0;
#P connect 2 0 3 0;
#P connect 6 0 2 0;
#P connect 1 0 4 0;
#P connect 7 0 1 0;
#P connect 0 1 6 0;
#P connect 0 0 7 0;
#P connect 4 0 5 0;
#P connect 3 0 4 1;
#P window clipboard copycount 10;


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