Skip to content

TPoint

Point in a plane.

Declaration

Source position: typshrdh.inc line 64

type
  TPoint = packed record
    X: LongInt;
    Y: LongInt;
    class function Zero : TPoint;
    function Add : TPoint;
    function Distance : ValReal;
    function IsZero : Boolean;
    function Subtract : TPoint;
    procedure SetLocation(const apt: TPoint);
    procedure SetLocation(ax: LongInt; ay: LongInt);
    procedure Offset(const apt: TPoint);
    procedure Offset(dx: LongInt; dy: LongInt);
    function Angle : Single;
    class function PointInCircle : Boolean;
    class operator =(const apt1: TPoint; const apt2: TPoint) : Boolean;
    class operator <>(const apt1: TPoint; const apt2: TPoint) : Boolean;
    class operator +(const apt1: TPoint; const apt2: TPoint) : TPoint;
    class operator -(const apt1: TPoint; const apt2: TPoint) : TPoint;
    class operator :=(const aspt: TSmallPoint) : TPoint;
    class operator explicit(const apt: TPoint) : TSmallPoint;
  end;

Description

TPoint is a generic definition of a point in a 2-dimensional discrete plane, where X indicates the horizontal position, and Y the vertical position (positions usually measured in pixels), and 0,0 is the origin of the plane.

Usually, the origin is the upper-left corner of the screen, with Y increasing as one moves further down the screen - this is opposite to the mathematical view where Y increases as one moves upwards.

The coordinates are integers, (32-bit, signed) so the coordinate system runs from -MaxInt to MaxInt.

See also

Name Description
TRect Rectangle in a plane.
TSize Area size.