musicflower.util.trisurf

musicflower.util.trisurf(triangles, decimals=None)[source]

Convert a Nx3x3 array of N triangles in 3D space, defined via their corners, into x, y, z coordinate arrays, and i, j, k index arrays as used by Plotly’s Mesh3d function. Additionally, a return index r is return that can be used to reconstruct information associated with the original points.

Parameters
  • triangles – Nx3x3 array of triangle vertices in 3D space (last dimension is x-y-z coordinate)

  • decimals – decimals to use for rounding using numpy.around to improve point identification (default: None i.e. do not round)

Returns

x, y, z, i, j, k, r