Graeme Geldenhuys wrote:
Hi,
How do I change this code to draw a spiral using the standard
Canvas.LineTo that only takes Integer X & Y co-ordinates? I did it
before, but for the live of me I can't get it right now! :-)
eg:
Draw(100, 100);
procedure TForm1.Draw(X, Y: Integer);
var
Theta: Single;
begin
Theta := 0;
Image.Bitmap.MoveToF(X, Y);
while Theta < 15 * 3.1415926535 do
begin
Image.Bitmap.LineToFSP(X + Cos(Theta) * Theta, Y + Sin(Theta) * Theta);
Bitmap.Canvas.LineTo(
Round(X + Cos(Theta) * Theta),
Round(Y + Sin(Theta) * Theta)
):
(or do I miss something here ?)
No that you only get a spiral with max radius = 15 here. If yo want to
draw it in a 100x100 box, with x,y as center:
Bitmap.Canvas.LineTo(
Round(X + Cos(Theta) * Theta * 50 / 15),
Round(Y + Sin(Theta) * Theta * 50 / 15)
):
Marc
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives