Satimage Previous | Next
Broken lines with many points
Home Documentation Smile The graphic library Samples Broken lines with many points  
The sample script below shows how to use LineTo with a list of points, which is faster than point after point

Also you see how to use SetTransformation to shift the origin of the drawing: here we take the center of the page as the origin of the coordinates.

(The result on your machine will be different from the illustration. Try changing npts and resizing the window with the ⌘ key pressed.)
Import script

set npts to 86
set w to BeginFigure(0)
SetPenColor({1, 0.2, 0.2})
SetPenWidth(0.5)
set pts to {}
set {i, j, di, dj} to frame of w
SetTransformation({1, 0, 0, 1, di / 2, dj / 2})
repeat with n from 0 to npts
    set r to di * 0.45 * n / npts
    set end of pts to {r * (cos r), r * (sin r)}
end repeat
MoveTo(item 1 of pts)
LineTo(pts)
DrawPath(2)
EndFigure()
Version française
Copyright ©2008 Paris, Satimage