Forums > Jitter

A more efficient method to turn a list into a 3-plane 2D matrix?


dtr
March 2, 2014 | 5:38 am

Hey,

I’m looking for the most efficient way to turn a long list of coordinates into a vertex position matrix for jit.gl.mesh. I’m receiving the list from a Processing sketch from another computer via UDP/OSC.

The list is in the form (X1 Y1 Z1 X2 Y2 Z2 X3 …) and I dont know the length beforehand.

Below’s a method I came up with but I don’t think it’s very efficient. Any tips?

 

<code>

– Pasted Max Patch, click to expand. –

</code>

The list could also be formatted in a different way if that helps.


March 3, 2014 | 5:50 am

Here’s one approach. You can divide your list into three-item groups with [zl group 3], then put each of those values into one of the three planes of a [jit.matrix 3 float32].
<code>

– Pasted Max Patch, click to expand. –

</code>


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