Download Now

    Reference TPointF

    Declared in Codebot.Graphics.Types.pas on line 202

    TPointF is a floating point 2d point
      TPointF = record
      public
        { The coordinates of the point }
        X: Float;
        Y: Float;
        { Returns true if both coordinates match }
        function Equals(const Value: TPointF): Boolean;
        { Create a point at the origin }
        class function Create: TPointF; overload; static;
        { Create a point given its coordinates }
        class function Create(X, Y: Float): TPointF; overload; static;
        { Move this point by an amount }
        procedure Offset(X, Y: Float); overload;
        procedure Offset(const P: TPointF); overload;
        { Return a copy of this point moved by an amount }
        function Move(X, Y: Float): TPointF; overload;
        function Move(const P: TPointF): TPointF; overload;
        { The angle in radians from this point to another }
        function Angle(const P: TPointF): Float;
        { The distance from this point to another }
        function Dist(const P: TPointF): Float;
        { The point halfway between this point and another }
        function Mid(const P: TPointF): TPointF;
        { A point a distance beyond this point along the line from P }
        function Extend(const P: TPointF; Dist: Float): TPointF;
        { Rotate the point around P by an angle in radians }
        function Rotate(const P: TPointF; Angle: Float): TPointF; overload;
        { Rotate the point about the origin. A positive angle turns it
          counterclockwise on the screen, where Y points down, as in Tiny Sim. }
        function Rotate(Angle: Float): TPointF; overload;
        { The distance from the origin, or from a point }
        function Distance: Float; overload;
        function Distance(const P: TPointF): Float; overload;
        { Scale the point to a distance of 1 from the origin }
        procedure Normalize;
      end;

    See also

    Float in Codebot.System.pas