## Multitouch data "pixelate" into a matrix

Oct 4, 2013 at 9:54am

# Multitouch data "pixelate" into a matrix

Hi, sorry for the confusing title.

For example I have a 16×16 2D matrix. and I’ve pressed on a multitouch pad around (4,4) with a certain force, then the data in the (4,4) slot will be 1. And the slots around (4,4) – 8 of them – will have a number a bit lower (like 0.8). and the slots a step further away – 16 of them – will be lower again (e.g. 0.5).

And in this process, I can use my force to control how much the date would be in the slots.

Here in attachment I’ve made a simple drawing shows what I mean, there are 2 presses, the top-left is harder than the lower-right.

Thanks.

Edit: the top attachment is the right one, how do I delete posted attachments?

###### Attachments:
#267046
Oct 4, 2013 at 11:08am

So uhm… what’s the question? :)

#267052
Oct 4, 2013 at 11:45am

you could do that with jit.matrix
- jit.expr a 7×7 single plane float matrix with something like
expr sin(norm[0]*PI)*sin(norm[1]*PI) or expr 1.-hypot(snorm[0]\,snorm[1])
- multiply this matrix (jit.op @op *) with a float that is the scaled velocity (f.e. scale 0 127 0. 1.)
- overwrite your main 16×16 matrix at the right offset with that matrix
- jit.spill

#267055
Oct 5, 2013 at 2:32am

@tobiasros Thank you very much! I’ve nailed this down.

But my macbook pro gets so slow and lagging when I use this patch. Is this normal? I am totally beginner to jitter so I wonder if there’s some setting or optimization I can do to the computer or the patch. Thanks.

Here is the patch:
<code>

– Pasted Max Patch, click to expand. –

</code>

#267089
Oct 5, 2013 at 6:08am

here some quick improvements:

call this abstraction placethematrix:

<code>

– Pasted Max Patch, click to expand. –

</code>

this is main patcher:

<code>

– Pasted Max Patch, click to expand. –

</code>

next you could f.e. put the abstractions in a poly…

#267098
Oct 5, 2013 at 6:04pm

i gave it another go:
this one now is pretty fast on my 4 year old mbp

###### Attachments:
1. pixelate.zip
#267173
Oct 6, 2013 at 9:47am

Thank you @tobiasros!
This is super awesome and fast.

Btw, I found that if I have too many UI objects on my retina macbook, it can get slow very quick. I found out I can lug the system pretty efficiently just by dragging the jit.pwindow bigger… seems like a bug between max and retina macbook.

#267233

You must be logged in to reply to this topic.