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


    Mar 02 2014 | 1:38 pm
    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?
    The list could also be formatted in a different way if that helps.

    • Mar 03 2014 | 1:50 pm
      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].