box_sym.lua
NAME
box_sym
FUNCTION
box_sym(plot, arr, dx)
NOTES
Adds box symbols to the plot.
INPUTS
plot - zePlot object
arr - zeArray object having 3 vectors containing data of x, y, and dy
size - symbol with in plot coordinate
OUTPUTS
a zePolygon object.
SOURCE
require("register")
function box_sym(plot, arr, size)
local node, shape, xyz = zeGrf.new("node", "polygon", "vertex")
plot:add(shape)
shape:set{vertex = xyz, type = "quads"}
local n = arr:size()
local dx = size / 2
for i = 1, n do
local x = arr:getele(i-1, 0)
local y = arr:getele(i-1, 1)
local dy = arr:getele(i-1, 2)
local z = 0
xyz:add(x - dx, y - dy, z)
xyz:add(x + dx, y - dy, z)
xyz:add(x + dx, y + dy, z)
xyz:add(x - dx, y + dy, z)
end
return shape
end