Changeset 235 for trunk/UGeometry.pas


Ignore:
Timestamp:
Sep 20, 2018, 11:44:42 AM (6 years ago)
Author:
chronos
Message:
  • Added: Show map multiple times side by side in cyclic mode.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGeometry.pas

    r234 r235  
    2424    class operator Equal(const A, B: TGPoint<T>): Boolean;
    2525    class operator Multiply(const A, B: TGPoint<T>): TGPoint<T>;
     26    //class operator Divide(const A, B: TGPoint<T>): TGPoint<T>;
    2627    function Min(const A, B: TGPoint<T>): TGPoint<T>;
    2728    function Max(const A, B: TGPoint<T>): TGPoint<T>;
     
    119120  TPolygonF = TGPolygon<TPointF>;
    120121
    121 function Divide(Divident, Divisor: Integer): Integer; overload;
    122 function Divide(Divident, Divisor: Double): Double; overload;
     122function TypedDivide(Divident, Divisor: Integer): Integer; overload;
     123function TypedDivide(Divident, Divisor: Single): Single; overload;
    123124function TypedRound(Value: Double): Integer; overload;
    124125function TypedRound(Value: Double): Double; overload;
     
    129130implementation
    130131
    131 function Divide(Divident, Divisor: Integer): Integer;
     132function TypedDivide(Divident, Divisor: Integer): Integer;
    132133begin
    133134  Result := Divident div Divisor;
    134135end;
    135136
    136 function Divide(Divident, Divisor: Double): Double;
     137function TypedDivide(Divident, Divisor: Single): Single;
    137138begin
    138139  Result := Divident / Divisor;
     
    334335function TGLine<T>.GetMiddle: T;
    335336begin
    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));
    337338end;
    338339
     
    437438end;
    438439
     440{class operator TGPoint<T>.Divide(const A, B: TGPoint<T>): TGPoint<T>;
     441begin
     442  Result.X := TypedDivide(A.X, B.X);
     443  Result.Y := TypedDivide(A.Y, B.Y);
     444end;
     445}
     446
    439447class operator TGPoint<T>.GreaterThan(const A, B: TGPoint<T>): Boolean;
    440448begin
     
    508516function TGRect<T>.Center: T;
    509517begin
    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);
    512520end;
    513521
Note: See TracChangeset for help on using the changeset viewer.