Richard
2009-06-06 17:39:48
I made it a bit more useful, gets the percent of a set area of the MM. Thanks to Zeph and mixster for fixing the annoying errors :)
{*******************************************************************************
function PercentBlackMM(StartRadial, EndRadial, StartRadius, EndRadius: Integer): integer;
By: Richard
Description: Gets the percent of an area of the minimap which is black, defined
by the radials, and the radius.
*******************************************************************************}
function PercentBlackMM(StartRadial, EndRadial, StartRadius, EndRadius: Integer): integer;
var
TPA: TPointArray;
A, Ps: Integer;
Sector1, Sector2, Area: Extended;
begin
A := EndRadial - StartRadial;
FindColors(TPA, 65536, MMX1, MMY1, MMX2, MMY2);
FilterPointsPie(TPA, StartRadial, EndRadial, StartRadius, EndRadius, MMCX, MMCY);
Sector1 := (Pi * (StartRadius * StartRadius)) * (A / 360.0);
Sector2 := (Pi * (EndRadius * EndRadius)) * (A / 360.0);
Area := Sector2 - Sector1;
Ps := Length(TPA);
Result := Round((Ps * 100) / Area);
end;