Search code examples
pythonmatplotlibscipymayavimplot3d

How to visualize 3D delaunay triangulation


I have a set of 3D points which I've used scipy.spatial.Delaunay to do the triangulation / tetrahedralization. I now have a set of unique faces of all of the tetrahedra, and would like to visualize these in 3D.

Are there any Python libraries (or libraries with a Python wrapper) that can do this?


Solution

  • Try mayavi.mlab.triangular_mesh()

    import numpy as np
    from mayavi import mlab
    vertices = np.array([[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]])
    faces = np.array([[0, 1, 0, 0],[1, 2, 1, 2],[2, 3, 3, 3]])
    mlab.triangular_mesh(vertices[0,:], vertices[1,:], vertices[2,:], faces.T)
    mlab.show()