Divide a space in grid?

Thinksamuel's icon

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?

MJ's icon
Max Patch
Copy patch and select New From Clipboard in Max.

like this ?

Thinksamuel's icon

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

Rodrigo's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

MJ's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

Rodrigo's icon

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.

Thinksamuel's icon

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.

Thinksamuel's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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.

MJ's icon

use pak instead of pack

Thinksamuel's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

Thinksamuel's icon

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 and then < 1 2> it will see and then when you send he will match the but also the interpolated < 1 1>. Now, is there a way to get around this?