Difference between revisions of "TPADistToPointEx"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> procedure TPADistToPointEx(const TPA: TPointArray; const Point: TPoint; out MinDist, MaxDist: Extended; out MinPoint, MaxPoin...") |
(No difference)
|
Latest revision as of 13:27, 21 November 2012
Definition
procedure TPADistToPointEx(const TPA: TPointArray; const Point: TPoint; out MinDist, MaxDist: Extended; out MinPoint, MaxPoint: TPoint);
Availability
SCAR Divi 3.37 > Current
Description
Calculates the minimum and maximum distance of the TPoint Point, to all of the points in the TPointArray TPA and returns the distances in MinDist and MaxDist. The point from TPA that was closest to Point is returned in MinPoint, the one furthest in MaxPoint.
Example
var MinDist, MaxDist: Extended; PMin, PMax: TPoint; begin TPADistToPointEx([Point(0, 0), Point(3, 0)], Point(1, 1), MinDist, MaxDist, PMin, PMax); WriteLn(FloatToStr(MinDist) + ' - ' + FloatToStr(MaxDist)); WriteLn(PointToStr(PMin) + ' - ' + PointToStr(PMax)); end.
Output:
1.4142135623731 - 2.23606797749979 (0,0) - (3,0)