Getting a distance matrix to output "labeled" distance values

Feb 11, 2013 at 10:10pm

Getting a distance matrix to output "labeled" distance values

Hello everybody,

I’m building a patch in which I need to compute the distance between a tracked object and several fixed objects, so I thought that using a matrix and jit.gen to perform operations could be the most efficient way to make it.

Here’s what I got so far:

– Pasted Max Patch, click to expand. –

The patch is working pretty well. What I need to implement now is formatting the jit.gen output this way: ” “.
I think I can achieve this using jit.iter and a counter prepending the object’s number, but I wonder if there is a way inside jit.gen to do that: since every distance value lies on a different row of the matrix, is there some way (swiz?) to get the jit.gen object to output something like: ” , , etc.”?

#66462
Feb 11, 2013 at 10:32pm

send in a 4 plane matrix, and use the cell object to get the current row (if i’m understanding you):

– Pasted Max Patch, click to expand. –
#239247
Feb 11, 2013 at 10:54pm

That’s it! Thank you, Rob!

#239248
Feb 12, 2013 at 9:19pm

I made a little correction in my jit.gen, as I noticed that the [param coords] was reading just the first number in the list.
Here’s the correct code:

– Pasted Max Patch, click to expand. –
#239249
Feb 12, 2013 at 9:58pm

I was wondering how I could calculate distances within many objects in a time.
Imagine I have a group of moving objects in the left matrix and a group of static objects in right matrix and I want to estimate the distance between every moving object and every single static object.

– Pasted Max Patch, click to expand. –

Could this a good start? (obviously it’s not working…)

For the moment, I think I’ll encapsulate the previous patch and use many instances of the same patcher.
Like this:

– Pasted Max Patch, click to expand. –
#239250

You must be logged in to reply to this topic.