Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bc98e07f807ebc03f75837cb76117b79 to your computer and use it in GitHub Desktop.
Save anonymous/bc98e07f807ebc03f75837cb76117b79 to your computer and use it in GitHub Desktop.
# Adopted to Julia
# Copyright (c) 2016, Hiroharu Sugawara <hsugawa@gmail.com>
# License: BSD Style.
# An example of a cone, ie a non-regular mesh defined by its triangles.
n = 8
t = linspace(-pi, pi, n)
xy = exp(im * t)
x = real(xy)
y = imag(xy)
z = zeros(n)
triangles = [ (0, i, i + 1) for i in 1:n-1 ]
unshift!(x,0.0)
unshift!(y,0.0)
unshift!(z,1.0)
t=Array(t)
unshift!(t,0.0)
using PyCall
@pyimport mayavi.mlab as mlab
mlab.triangular_mesh(x, y, z, triangles, scalars=PyObject(t))
mlab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment