Changeset 174 for trunk/Packages/Common/UGeometry.pas
- Timestamp:
- Nov 26, 2017, 11:35:25 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UGeometry.pas
r172 r174 95 95 constructor Create(const Rect: TGRect<T>); overload; 96 96 function GetRect: TGRect<T>; 97 function EdgeDistance(Polygon: TGPolygon<T>): Double; 97 98 procedure AddPoint(const P: T); 98 99 procedure Clear; … … 157 158 end; 158 159 159 { T Polygon }160 { TGPolygon } 160 161 161 162 function TGPolygon<T>.GetPoint(const Index: Integer): T; … … 282 283 end; 283 284 284 { TLine } 285 function TGPolygon<T>.EdgeDistance(Polygon: TGPolygon<T>): Double; 286 var 287 I, J: Integer; 288 Dist: Double; 289 begin 290 Result := Infinity; 291 for I := 0 to Length(Points) - 1 do 292 for J := 0 to Length(Polygon.Points) - 1 do begin 293 Dist := TGLine<T>.Create(Points[I], Polygon.Points[J]).Distance; 294 if Dist < Result then Result := Dist; 295 end; 296 end; 297 298 { TGLine } 285 299 286 300 function TGLine<T>.GetDistance: Double;
Note:
See TracChangeset
for help on using the changeset viewer.