Changeset 105 for trunk/Packages
- Timestamp:
- Oct 4, 2022, 11:25:28 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UGeometric.pas
r93 r105 22 22 function AddPoint(const P1, P2: TPoint): TPoint; 23 23 function SubPoint(const P1, P2: TPoint): TPoint; 24 function PointToLineDistance(const P, V, W: TPoint ): Integer;24 function PointToLineDistance(const P, V, W: TPoint; out Intersect: TPoint): Integer; 25 25 function ComparePoint(P1, P2: TPoint): Boolean; 26 26 function RotatePoint(Center, P: TPoint; Angle: Double): TPoint; … … 59 59 end; 60 60 61 function PointToLineDistance(const P, V, W: TPoint ): Integer;61 function PointToLineDistance(const P, V, W: TPoint; out Intersect: TPoint): Integer; 62 62 var 63 63 l2, t: Double; … … 77 77 if T < 0 then begin 78 78 Result := Distance(P, V); // Beyond the 'v' end of the segment 79 exit; 79 Intersect := V; 80 Exit; 80 81 end 81 82 else if T > 1 then begin 82 83 Result := Distance(P, W); // Beyond the 'w' end of the segment 84 Intersect := W; 83 85 Exit; 84 86 end; … … 86 88 TT.Y := Trunc(V.Y + T * (W.Y - V.Y)); 87 89 Result := Distance(P, TT); 90 Intersect := TT; 88 91 end; 89 92
Note:
See TracChangeset
for help on using the changeset viewer.