function PtInPoly( const Points : Array of TPoint; X, Y : Integer ) : Boolean;
var
Count,
I,
J : Integer;
begin
Result := False;
Count := Length(Points);
J := Count-1;
for I := 0 to Count-1 do begin
if ((Points[I].Y <=Y) and (Y < Points[J].Y)) or
((Points[J].Y <=Y) and (Y < Points[I].Y)) then
begin
if (x < (Points[j].X - Points[i].X) * (y - Points[i].Y) /
(Points[j].Y - Points[i].Y) + Points[i].X) then
Result := not Result;
end;
J := I;
end;
end;
|