A versatile graphic tool
James Hurley
jhurley0305 at sbcglobal.net
Fri Mar 6 11:30:53 EST 2009
Periodically I feel the need to call attention to Turtle Graphics as
a versatile graphic tool in Run Rev.
There has been recent discussions on the list about drawing a graph.
The following script will draw a simple graph:
on mouseUp
startTurtle --Initialize turtle graphics
put 0,30,120,20, 40 ,22, 104, 210 into tYdata
put 20 into dx
drawCoorAxes
put 0 into x
repeat with i = 1 to the number of items in tYdata
setxy x,item i of tYdata
add dx to x
end repeat
choose the browse tool
end mouseUp
on drawCoorAxes
forward 200
back 200
left 90
forward 200
back 200
end drawCoorAxes
With a simple change one could plot any analytic function, f(x)
As well as a vertical and horizontal mesh.
Jim Hurley
More information about the use-livecode
mailing list