Created
February 6, 2012 13:39
-
-
Save rep-movsd/1752092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TForm1.DrawCircle3(cx, cy, r: Integer); | |
var | |
angle, angleInc : Extended; | |
i : integer; | |
x, y, sina, sinb, cosa, cosb, sinab, cosab : Extended; | |
begin | |
PaintBox1.Canvas.MoveTo(cx + r, cy); | |
angleinc := 360 / r; | |
sinb := Sin(angleinc / (180.0 / 3.14159)); | |
cosb := Cos(angleinc / (180.0 / 3.14159)); | |
sina := 0; | |
cosa := 1; | |
i := Round(360 / angleinc); | |
while i > 0 do | |
begin | |
sinab := sina * cosb + cosa * sinb; | |
cosab := cosa * cosb - sina * sinb; | |
x := r * cosab; | |
y := r * sinab; | |
sina := sinab; | |
cosa := cosab; | |
Dec(i); | |
PaintBox1.Canvas.LineTo(Round(x) + cx, Round(y) + cy); | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment