plus_sym.lua
NAME
plus_sym
FUNCTION
plus_sym(plot, width, height, arr, size)
NOTES
Adds plus symbols to the plot.
INPUTS
plot - zePlot object
width - image width
height - image height
arr - zeArray object having 2 vectors containing data of x and y
size - symbol size in pixels
OUTPUTS
a line object of GL_LINES
SOURCE
require("register")
function plus_sym(plot, width, height, arr, size)
local shape, xyz = zeGrf.new("line", "vertex")
plot:add(shape)
shape:set{vertex = xyz, type = "lines", solid = 1.5}
local n = arr:size()
local x, y = plot:toplot(width, height, 0, 0, 0)
local dx, dy = plot:toplot(width, height, 0.5 * size, 0.5 * size, 0)
dx = dx - x
dy = dy - y
for i = 1, n do
x = arr:getele(i-1, 0)
y = arr:getele(i-1, 1)
xyz:add(x - dx, y, 0)
xyz:add(x + dx, y, 0)
xyz:add(x, y - dy, 0)
xyz:add(x, y + dy, 0)
end
return shape
end