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

dtr's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

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

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

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

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].