pipe_3d.lua
NAME
pipe_3d
FUNCTION
pipe_3d(r, h, n)
NOTES
Creates a pipe shape at (0, 0, 0).
INPUTS
r - radius in pixel
h - height in pixel along z-axis
n - number of slices that comprise the shape
OUTPUTS
a zePolygon object of GL_QUAD_STRIP
SOURCE
require("register")
function pipe_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, r, n, 0, 360)
xyz:add(arr)
arr:shift(3)
nor:add(arr)
return shape
end