Class Vector2f

  • All Implemented Interfaces:
    java.io.Serializable

    public class Vector2f
    extends java.lang.Object
    implements java.io.Serializable
    2D Vector object.
    See Also:
    Serialized Form
    • Field Detail

      • ZERO

        public static final Vector2f ZERO
        Zero vector: (0,0)
      • UNIT_X

        public static final Vector2f UNIT_X
        Unit-X vector: (1,0)
      • UNIT_Y

        public static final Vector2f UNIT_Y
        Unit-Y vector: (0,1)
      • ONE

        public static final Vector2f ONE
        One vector: (1,1)
      • X

        public float X
        Vector data X-Component:
      • Y

        public float Y
        Vector data Y-Component:
    • Constructor Detail

      • Vector2f

        public Vector2f()
        construction, defaults to (0,0)
      • Vector2f

        public Vector2f​(float fX,
                        float fY)
        construction
        Parameters:
        fX - x-value
        fY - y-value
      • Vector2f

        public Vector2f​(float[] afTuple)
      • Vector2f

        public Vector2f​(Vector2f rkV)
        copy construction
        Parameters:
        rkV - vector to copy.
    • Method Detail

      • Add

        public void Add​(float fX,
                        float fY)
        Deprecated.
        Add. this.X = this.X + fX; this.Y = this.Y + fY;
        Parameters:
        fX - x-value to add to this.
        fY - y-value to add to this.
      • add

        public Vector2f add​(float fX,
                            float fY)
        Add. this.X = this.X + fX; this.Y = this.Y + fY;
        Parameters:
        fX - x-value to add to this.
        fY - y-value to add to this.
      • Add

        public void Add​(Vector2f rkV)
        Deprecated.
        Add. this = this + rkV
        Parameters:
        rkV - vector to add to this.
      • add

        public Vector2f add​(Vector2f rkV)
        Add. this = this + rkV
        Parameters:
        rkV - vector to add to this.
      • Add

        public void Add​(Vector2f rkV1,
                        Vector2f rkV2)
        Deprecated.
        Add. this = rkV1 + rkV2.
        Parameters:
        rkV1 - first vector.
        rkV2 - second vector.
      • add

        public static Vector2f add​(Vector2f rkV1,
                                   Vector2f rkV2)
        Add. this = rkV1 + rkV2.
        Parameters:
        rkV1 - first vector.
        rkV2 - second vector.
      • Copy

        public final void Copy​(Vector2f rkV)
        Deprecated.
        Parameters:
        rkV -
      • Cross

        public float Cross​(Vector2f kV)
        Deprecated.
        Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.
        Parameters:
        kV - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • cross

        public float cross​(Vector2f kV)
        Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.
        Parameters:
        kV - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • Dot

        public float Dot​(Vector2f rkV)
        Deprecated.
        Compute dot-product of this vector with input vector:
        Returns:
        dot-product of this vector with input vector:
      • dot

        public float dot​(Vector2f rkV)
        Compute dot-product of this vector with input vector:
        Returns:
        dot-product of this vector with input vector:
      • dotPerp

        public float dotPerp​(Vector2f vec)
      • equals

        public boolean equals​(java.lang.Object kObject)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • Length

        public float Length()
        Deprecated.
        Compute length this vector:
        Returns:
        length this vector
      • length

        public float length()
        Compute length this vector:
        Returns:
        length this vector
      • Neg

        public void Neg()
        Deprecated.
        Negate this vector: this = - this.
      • neg

        public Vector2f neg()
        Negate this vector: this = - this.
      • Normalize

        public float Normalize()
        Deprecated.
        Normalize this vector, return original length:
        Returns:
        original length:
      • normalize

        public float normalize()
        Normalize this vector, return original length:
        Returns:
        original length:
      • Perp

        public void Perp​(Vector2f kVector)
        Deprecated.
        Set this vector to the 'perp' of the specified vector.
        Parameters:
        kVector - DOCUMENT ME!
      • perp

        public Vector2f perp​(Vector2f kVector)
        Set this vector to the 'perp' of the specified vector.
        Parameters:
        kVector - DOCUMENT ME!
      • Scale

        public void Scale​(float fScalar)
        Deprecated.
        Scale this vector by input. this = this * fScalar.
        Parameters:
        fScalar - scale value.
      • scale

        public Vector2f scale​(float fScalar)
        Scale this vector by input. this = this * fScalar.
        Parameters:
        fScalar - scale value.
      • Scale

        public void Scale​(float fScalar,
                          Vector2f rkV)
        Deprecated.
        Scale the input vector by input. this = rkV * fScalar.
        Parameters:
        fScalar - scale value.
        rkV - input vector.
      • scale

        public static Vector2f scale​(float fScalar,
                                     Vector2f rkV)
        Scale the input vector by input. this = rkV * fScalar.
        Parameters:
        fScalar - scale value.
        rkV - input vector.
      • ScaleAdd

        public void ScaleAdd​(float fScalar,
                             Vector2f rkV1,
                             Vector2f rkV2)
        Deprecated.
        Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.
        Parameters:
        fScalar - scale value
        rkV1 - input vector
        rkV2 - input vector
      • scaleAdd

        public Vector2f scaleAdd​(float fScalar,
                                 Vector2f rkV1,
                                 Vector2f rkV2)
        Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.
        Parameters:
        fScalar - scale value
        rkV1 - input vector
        rkV2 - input vector
      • Set

        public final void Set​(float fX,
                              float fY)
        Deprecated.
        construction
        Parameters:
        fX - x-value
        fY - y-value
      • set

        public Vector2f set​(float fX,
                            float fY)
        construction
        Parameters:
        fX - x-value
        fY - y-value
      • SquaredLength

        public float SquaredLength()
        Deprecated.
        Compute squared-length this vector:
        Returns:
        squared-length this vector
      • squaredLength

        public float squaredLength()
        Compute squared-length this vector:
        Returns:
        squared-length this vector
      • Sub

        public void Sub​(float fX,
                        float fY)
        Deprecated.
        Sub. this.X = this.X - fX; this.Y = this.Y - fY;
        Parameters:
        fX - x-value to subtract from this.
        fY - y-value to subtract from this.
      • sub

        public Vector2f sub​(float fX,
                            float fY)
        Sub. this.X = this.X - fX; this.Y = this.Y - fY;
        Parameters:
        fX - x-value to subtract from this.
        fY - y-value to subtract from this.
      • Sub

        public void Sub​(Vector2f rkV)
        Deprecated.
        Sub. this = this - rkV
        Parameters:
        rkV - vector to subtract from this.
      • sub

        public Vector2f sub​(Vector2f rkV)
        Sub. this = this - rkV
        Parameters:
        rkV - vector to subtact from this.
      • Sub

        public void Sub​(Vector2f rkV1,
                        Vector2f rkV2)
        Deprecated.
        Sub. this = rkV1 - rkV2.
        Parameters:
        rkV1 - first vector.
        rkV2 - second vector.
      • sub

        public static Vector2f sub​(Vector2f rkV1,
                                   Vector2f rkV2)
        Sub. this = rkV1 - rkV2.
        Parameters:
        rkV1 - first vector.
        rkV2 - second vector.
      • Sum

        public float Sum()
        Deprecated.
        Sum the elements of the vector.
        Returns:
        vector sum
      • sum

        public float sum()
        Sum the elements of the vector.
        Returns:
        vector sum
      • toString

        public java.lang.String toString()
        Returns a string representation of the vector values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation of the vector values.