import numpy as np
import mayavi.mlab as mlab

def test_triangular_mesh():
  """An example of a cone, ie a non-regular mesh defined by its
      triangles.
  """
  n = 15
  t = np.linspace(-np.pi, np.pi, n)
  z = np.exp(1j * t)
  x = z.real.copy()
  y = z.imag.copy()
  z = np.zeros_like(x)
  
  triangles = [(0, i, i + 1) for i in range(1, n)]
  x = np.r_[0, x]
  y = np.r_[0, y]
  z = np.r_[1, z]
  t = np.r_[0, t]
  
  return mlab.triangular_mesh(x, y, z, triangles, scalars=t)

if __name__ == '__main__':
  tm = test_triangular_mesh()
  mlab.show()