Download Now

    Reference TVec2

    Declared in Codebot.Geometry.pas on line 33

    TVec2 is a two component vector
      TVec2 = record
      public
        { Returns true if both components match }
        function Equals(const Value: TVec2): Boolean; inline;
        { The angle in radians from the origin to this vector }
        function Angle: Float; overload;
        { The angle in radians from this vector to a point }
        function Angle(X, Y: Float): Float; overload;
        function Angle(const V: TVec2): Float; overload;
        { The length of the vector }
        function Distance: Float; overload;
        { The distance from this vector to a point }
        function Distance(X, Y: Float): Float; overload;
        function Distance(const V: TVec2): Float; overload;
        { Move this vector by an amount }
        procedure Offset(X, Y: Float); overload;
        procedure Offset(const V: TVec2); overload;
        { Return a copy of this vector moved by an amount }
        function Move(X, Y: Float): TVec2; overload;
        function Move(const V: TVec2): TVec2; overload;
        { Scale the vector to a length of 1 }
        procedure Normalize;
        { Return a copy of the vector scaled to a length of 1 }
        function Normal: TVec2;
        { Return the normal rotated 90 degrees }
        function Binormal: TVec2;
        { The point halfway between this vector and another }
        function Mid(const V: TVec2): TVec2;
        { The point a distance from this vector toward V }
        function Extend(const V: TVec2; Dist: Float): TVec2;
        { Rotate V around this vector by an angle in radians }
        function Rotate(const V: TVec2; Angle: Float): TVec2;
        X: Float;
        Y: Float;
        S: Float;
        T: Float;
        Vec1: TVec1;
        V: array[0..1] of Float;
      end;

    See also

    Float in Codebot.System.pas