SCAR Code:
procedure CreateLine(out tpa: TPointArray; radial: Extended; radius, cx, cy: Integer);
var
r: Extended;
ex, sx, x: Integer;
begin
r := Tan(radial);
if (Abs(r) <= 1) then
begin
ex := Round(Cos(radial) * radius);
SetLength(tpa, iAbs(ex) + 1);
sx := Min(0, ex);
ex := Max(0, ex);
for x := sx to ex do
begin
tpa[-sx + x] := Point(cx + x, cy + Round(x * r));
end;
end
else
begin
ex := Round(Sin(radial) * radius);
SetLength(tpa, iAbs(ex) + 1);
sx := Min(0, ex);
ex := Max(0, ex);
for x := sx to ex do
begin
tpa[-sx + x] := Point(cx + Round(x / r), cy + x);
end;
end;
end;
I would hazard a guess that this method of point producing is faster since the main looping only involves 1 multiply or divide. It should produce a reasonable line and if you wanted filtering rather than creating, you could also adapt it to use Bullzeye's filtering method.