Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TPAtoATPAOval(TPA: TPointArray; w, h: Integer): T2DPointArray;
- var
- a, b, c, l, m: LongInt;
- r: Extended;
- begin
- r := h / w;
- m := Sqr(w);
- SetLength(Result, 0);
- l := High(TPA);
- c := 0;
- for a := 0 to l do
- begin
- for b := 0 to c -1 do
- begin
- if (Sqr(Abs(TPA[a].X - Result[b][0].X)) + (Sqr(Abs(TPA[a].Y - Result[b][0].Y)) * r) <= m) then
- Break;
- end;
- if (b < c) then
- begin
- SetLength(Result[b], Length(Result[b]) + 1);
- Result[b][High(Result[b])] := TPA[a];
- end else
- begin
- SetLength(Result, c + 1);
- SetLength(Result[c], 1);
- Result[c][0] := TPA[a];
- Inc(c);
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement