SCAR Code:
{*******************************************************************************
function DTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
By: Yakman
Description: First looks for a DTM without rotation, then increases the amount
of rotation around 0 gradually until it finds the DTM. A bit like the
ProgressiveTol Bitmap Engines.
*******************************************************************************}
function DTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
var
t, s, AngleFound: Extended;
begin
if (FindDTM(DTM, x, y, x1, y1, x2, y2)) then
begin
Result := True;
Exit;
end;
repeat
s := 0.3;
repeat
if (FindDTMRotated(DTM, x, y, x1, y1, x2, y2, 0 - t, 0 + t, s, AngleFound)) then
begin
Result := True;
Exit;
end;
s := s - 0.1;
until (s <= 0.1);
t := t + (Pi / 20);
until (t >= Pi / 3);
end;