Divide a space in grid?

Sep 15, 2012 at 8:22am

Divide a space in grid?

I am taking the video feed from a Kinect and need to track if the right hand is in a certain quadrant. basically, I am dividing the space in 8 equal squares. If the hand is in that space then it triggers an event in Max. In the past I have done something alike using if-then statements but I believe that it is not the best way and there must be something better. Anyone has an idea?

#64379
Sep 15, 2012 at 10:53pm

like this ?

– Pasted Max Patch, click to expand. –
#232188
Sep 16, 2012 at 5:02pm

Nice! Thank you. I will work a bit with this.

#232189
Sep 16, 2012 at 5:08pm

You can also do it with a scale object (and change to not re-bang within the same section/number)

– Pasted Max Patch, click to expand. –
#232190
Sep 16, 2012 at 10:09pm

well i also tried it with a scale object , but it gives different results….

– Pasted Max Patch, click to expand. –
#232191
Sep 16, 2012 at 10:26pm

Interesting that it’s so different. It’s the +1 that’s the difference I guess. It comes down to how you want to space it as in yours the “8″ isn’t a section of the slider. It’s the tippy top of the slider. That’s probably the best mapping if you’re mapping it to something, but maybe not ideal if you want 8 equal slices.

#232192
Sep 17, 2012 at 2:48pm

Actually, I have 2 columns of 4 squares each. I will duplicate the patch, one for the x values, one for the Y-values and then match the bangs. And off course test what results are the mmost accurate.

#232193
Sep 18, 2012 at 12:27pm

Almost there. I pack the X and Y values in a list and match them. The only problem I have is that I am not getting a bang if the Y value changes but the X stays the same. What should I do for that? When I simply send a bang to the pack object, there are sometimes two matches instead of one.

– Pasted Max Patch, click to expand. –
#232194
Sep 19, 2012 at 2:42pm

#232195
Sep 20, 2012 at 11:00am

Pak is nice but I sometimes get two or even three bangs where there should only be one bang. What am I doing wrong?

– Pasted Max Patch, click to expand. –
#232196
Sep 21, 2012 at 11:45am

Sorry to reply to my own post but I found the problem is with the match object. I am feeding it a list but the object takes the list as a sequence so if you send <1 1> and then < 1 2> it will see <1 1> and then when you send <1 2 > he will match the <1 2> but also the interpolated < 1 1>. Now, is there a way to get around this?

#232197

You must be logged in to reply to this topic.