Changeset 235 for trunk/UGeometry.pas
- Timestamp:
- Sep 20, 2018, 11:44:42 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGeometry.pas
r234 r235 24 24 class operator Equal(const A, B: TGPoint<T>): Boolean; 25 25 class operator Multiply(const A, B: TGPoint<T>): TGPoint<T>; 26 //class operator Divide(const A, B: TGPoint<T>): TGPoint<T>; 26 27 function Min(const A, B: TGPoint<T>): TGPoint<T>; 27 28 function Max(const A, B: TGPoint<T>): TGPoint<T>; … … 119 120 TPolygonF = TGPolygon<TPointF>; 120 121 121 function Divide(Divident, Divisor: Integer): Integer; overload;122 function Divide(Divident, Divisor: Double): Double; overload;122 function TypedDivide(Divident, Divisor: Integer): Integer; overload; 123 function TypedDivide(Divident, Divisor: Single): Single; overload; 123 124 function TypedRound(Value: Double): Integer; overload; 124 125 function TypedRound(Value: Double): Double; overload; … … 129 130 implementation 130 131 131 function Divide(Divident, Divisor: Integer): Integer;132 function TypedDivide(Divident, Divisor: Integer): Integer; 132 133 begin 133 134 Result := Divident div Divisor; 134 135 end; 135 136 136 function Divide(Divident, Divisor: Double): Double;137 function TypedDivide(Divident, Divisor: Single): Single; 137 138 begin 138 139 Result := Divident / Divisor; … … 334 335 function TGLine<T>.GetMiddle: T; 335 336 begin 336 Result := T.Create(P1.X + Divide((P2.X - P1.X), 2), P1.Y +Divide((P2.Y - P1.Y), 2));337 Result := T.Create(P1.X + TypedDivide((P2.X - P1.X), 2), P1.Y + TypedDivide((P2.Y - P1.Y), 2)); 337 338 end; 338 339 … … 437 438 end; 438 439 440 {class operator TGPoint<T>.Divide(const A, B: TGPoint<T>): TGPoint<T>; 441 begin 442 Result.X := TypedDivide(A.X, B.X); 443 Result.Y := TypedDivide(A.Y, B.Y); 444 end; 445 } 446 439 447 class operator TGPoint<T>.GreaterThan(const A, B: TGPoint<T>): Boolean; 440 448 begin … … 508 516 function TGRect<T>.Center: T; 509 517 begin 510 Result.X := Divide(P2.X - P1.X, 2);511 Result.Y := Divide(P2.Y - P1.Y, 2);518 Result.X := TypedDivide(P2.X - P1.X, 2); 519 Result.Y := TypedDivide(P2.Y - P1.Y, 2); 512 520 end; 513 521
Note:
See TracChangeset
for help on using the changeset viewer.