cone_3d.lua
NAME
pipe_3d
FUNCTION
pipe_3d(r, h, n)
NOTES
Creates a cone shape at (0, 0, 0).
INPUTS
r - radius in pixels
h - height in pixels along z-axis
n - number of slices that comprise the shape
OUTPUTS
a zePolygon object of GL_QUAD_STRIP
SOURCE
require("register")
function cone_3d(r, h, n)
local shape, xyz, nor = zeGrf.new("polygon", "vertex", "vertex")
shape:set{vertex = xyz, vertex_normal = nor, type = "quadstrip"}
local arr = zeUtl.new("double")
zeMake.cylinder(arr, h, r, 0, n, 0, 360)
xyz:add(arr)
arr:shift(3)
nor:add(arr)
return shape
end