SCAR Code:
function CreateCircleTPA(origin: TPoint; radius: Integer; step: Extended): TPointArray;
var
a: Extended;
l: Integer;
begin
a := -step;
l := -1;
while (a < 360 - step) do
begin
l := l + 1;
a := a + step;
SetLength(Result, l + 1);
Result[l].x := origin.x + Round(Cos(Radians(a)) * radius);
Result[l].y := origin.y + Round(Sin(Radians(a)) * radius);
if (l = 0) then
Continue;
if ((Result[l].x = Result[l - 1].x) and (Result[l].y = Result[l - 1].y)) then
l := l - 1;
end;
end;
Lower step = higher accuracy, but really 1 works fine. Probably a better method for filtering duplicate TPoint's in an array (sure there was a function for it, but too lazy to trawl through functions for it).
n3ss3s's method would also work, but being able to set a step is useful for larger circles as 1 degrees accuracy can be quite fail if it's rather big
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.