Пожалуйста, иначе мне

function min(a, b: double): double;
begin
min := a;
if b < a then min := b;
end;
function max(a, b: double): double;
begin
max := a;
if b > a then max := b;
end;
type
point = record
x, y: double;
end;
function InsidePolygon(var polygon: array of point;
const n: integer; p: point): boolean;
var
i, counter: integer;
xinters: double;
p1, p2: point;
begin
counter := 0;
p1 := polygon[0];
for i := 1 to n do begin
p2 := polygon[i mod n];
if p.y > min(p1.y, p2.y) then begin
if p.y <= max(p1.y, p2.y) then begin
if p.x <= max(p1.x, p2.x) then begin
if p1.y <> p2.y then begin
xinters := (p.y - p1.y)*(p2.x - p1.x) / (p2.y-p1.y) + p1.x;
if (p1.x = p2.x) or (p.x <= xinters) then inc(counter);
end;
end;
end;
end;
p1 := p2;
end;
if (counter mod 2) = 0 then InsidePolygon := false
else InsidePolygon := true;
end;