**Script Name:** Polygon Edge XY

**Script Description:** It finds the X and Y coordinates of a point on the edge of a polygon (not completely accurate, you may change the number 10 to a larger number for more accurate numbers) by the intersection of a specified line (made by 2 points) where as point 1 is outside of the polygon and point 2 is within the polygon.

**Original Author:** Curt (DorkeyDear)

**Core Version:** 2.6.2 (untested)

**Code:** `procedure GetPolygonEdgeXY(X1,Y1,X2,Y2: single; var X,Y: single; const MaxDist: integer);`

var

i: integer;

D: single;

begin

for i := 1 to 10 do begin

if RayCast(X1,Y1,X2,Y2,D,MaxDist) then begin

X1 := (X1 + X2) / 2;

Y1 := (Y1 + Y2) / 2;

end else begin

X2 := (X1 + X2) / 2;

Y2 := (Y1 + Y2) / 2;

end;

end;

X := (X1 + X2) / 2;

Y := (Y1 + Y2) / 2;

end;