Changeset 236 for trunk/UGeometry.pas
- Timestamp:
- Sep 20, 2018, 3:33:04 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGeometry.pas
r235 r236 25 25 class operator Multiply(const A, B: TGPoint<T>): TGPoint<T>; 26 26 //class operator Divide(const A, B: TGPoint<T>): TGPoint<T>; 27 //class operator Modulus(A: TGPoint<T>; B: TGPoint<T>): TGPoint<T>; 27 28 function Min(const A, B: TGPoint<T>): TGPoint<T>; 28 29 function Max(const A, B: TGPoint<T>): TGPoint<T>; … … 120 121 TPolygonF = TGPolygon<TPointF>; 121 122 123 function TypedMod(Numerator, Denominator: Integer): Integer; overload; 124 function TypedMod(Numerator, Denominator: Single): Single; overload; 122 125 function TypedDivide(Divident, Divisor: Integer): Integer; overload; 123 126 function TypedDivide(Divident, Divisor: Single): Single; overload; … … 126 129 function StdPointToPoint(Value: Classes.TPoint): TPoint; 127 130 function PointToStdPoint(Value: TPoint): Classes.TPoint; 131 function ModNeg(A, B: Integer): Integer; 128 132 129 133 130 134 implementation 135 136 function ModNeg(A, B: Integer): Integer; 137 begin 138 if A < 0 then A := A + Ceil(-A / B) * B; 139 Result := A mod B; 140 end; 141 142 function TypedMod(Numerator, Denominator: Integer): Integer; overload; 143 begin 144 Result := Numerator mod Denominator; 145 end; 146 147 function TypedMod(Numerator, Denominator: Single): Single; overload; 148 begin 149 //Result := FMod(Numerator, Denominator); 150 end; 131 151 132 152 function TypedDivide(Divident, Divisor: Integer): Integer; … … 443 463 Result.Y := TypedDivide(A.Y, B.Y); 444 464 end; 465 466 class operator TGPoint<T>.Modulus(A: TGPoint<T>; B: TGPoint<T>): TGPoint<T>; 467 begin 468 Result.X := TypedMod(A.X, B.X); 469 Result.Y := TypedMod(A.Y, B.Y); 470 end; 445 471 } 446 472
Note:
See TracChangeset
for help on using the changeset viewer.