Changeset 93 for trunk/Packages/Common


Ignore:
Timestamp:
Sep 26, 2022, 10:39:03 PM (2 years ago)
Author:
chronos
Message:
  • Added: Support for train carriages.
  • Added: City support implementation preparation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UGeometric.pas

    r86 r93  
    88type
    99  TPointArray = array of TPoint;
     10
     11  { TVector }
     12
     13  TVector = record
     14    Position: TPoint;
     15    Direction: TPoint;
     16    function GetLength: Integer;
     17    function GetAngle: Double;
     18  end;
    1019
    1120function Distance(P1, P2: TPoint): Integer;
     
    162171end;
    163172
     173{ TVector }
     174
     175function TVector.GetLength: Integer;
     176begin
     177  Result := Trunc(Sqrt(Sqr(Direction.X) + Sqr(Direction.Y)));
     178end;
     179
     180function TVector.GetAngle: Double;
     181begin
     182  Result := ArcTan2(Direction.Y, Direction.X);
     183end;
    164184
    165185end.
Note: See TracChangeset for help on using the changeset viewer.