Changeset 236 for trunk/UGeometry.pas


Ignore:
Timestamp:
Sep 20, 2018, 3:33:04 PM (6 years ago)
Author:
chronos
Message:
  • Added: Mouse focused and selected cells are now working.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGeometry.pas

    r235 r236  
    2525    class operator Multiply(const A, B: TGPoint<T>): TGPoint<T>;
    2626    //class operator Divide(const A, B: TGPoint<T>): TGPoint<T>;
     27    //class operator Modulus(A: TGPoint<T>; B: TGPoint<T>): TGPoint<T>;
    2728    function Min(const A, B: TGPoint<T>): TGPoint<T>;
    2829    function Max(const A, B: TGPoint<T>): TGPoint<T>;
     
    120121  TPolygonF = TGPolygon<TPointF>;
    121122
     123function TypedMod(Numerator, Denominator: Integer): Integer; overload;
     124function TypedMod(Numerator, Denominator: Single): Single; overload;
    122125function TypedDivide(Divident, Divisor: Integer): Integer; overload;
    123126function TypedDivide(Divident, Divisor: Single): Single; overload;
     
    126129function StdPointToPoint(Value: Classes.TPoint): TPoint;
    127130function PointToStdPoint(Value: TPoint): Classes.TPoint;
     131function ModNeg(A, B: Integer): Integer;
    128132
    129133
    130134implementation
     135
     136function ModNeg(A, B: Integer): Integer;
     137begin
     138  if A < 0 then A := A + Ceil(-A / B) * B;
     139  Result := A mod B;
     140end;
     141
     142function TypedMod(Numerator, Denominator: Integer): Integer; overload;
     143begin
     144  Result := Numerator mod Denominator;
     145end;
     146
     147function TypedMod(Numerator, Denominator: Single): Single; overload;
     148begin
     149  //Result := FMod(Numerator, Denominator);
     150end;
    131151
    132152function TypedDivide(Divident, Divisor: Integer): Integer;
     
    443463  Result.Y := TypedDivide(A.Y, B.Y);
    444464end;
     465
     466class operator TGPoint<T>.Modulus(A: TGPoint<T>; B: TGPoint<T>): TGPoint<T>;
     467begin
     468  Result.X := TypedMod(A.X, B.X);
     469  Result.Y := TypedMod(A.Y, B.Y);
     470end;
    445471}
    446472
Note: See TracChangeset for help on using the changeset viewer.