Class Vector4f

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Vector4f>

    public class Vector4f
    extends java.lang.Object
    implements java.lang.Comparable<Vector4f>, java.io.Serializable
    3D Vector object (X,Y,Z,W).
    See Also:
    Serialized Form
    • Field Detail

      • ZERO

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

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

        public static final Vector4f UNIT_Y
        Unit-Y vector: (0,1,0,0)
      • UNIT_Z

        public static final Vector4f UNIT_Z
        Unit-Z vector: (0,0,1,0)
      • UNIT_W

        public static final Vector4f UNIT_W
        Unit-W vector: (0,0,0,1)
      • ONE

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

        public float X
        Vector data:
      • Y

        public float Y
      • Z

        public float Z
      • W

        public float W
    • Constructor Detail

      • Vector4f

        public Vector4f()
        construction, initialized to 0,0,0,0
      • Vector4f

        public Vector4f​(float fX,
                        float fY,
                        float fZ,
                        float fW)
        construction
        Parameters:
        fX - x-value
        fY - y-value
        fZ - z-value
        fW - w-value
      • Vector4f

        public Vector4f​(float[] afTuple)
        construction
        Parameters:
        afTuple - x,y,z,w values
      • Vector4f

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

      • Copy

        public void Copy​(Vector4f rkV)
        Deprecated.
        Set the values of this vector.
        Parameters:
        rkV - vector to copy.
      • copy

        public Vector4f copy​(Vector4f rkV)
        Set the values of this vector.
        Parameters:
        rkV - vector to copy.
      • Dot

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

        public float dot​(Vector4f rkV)
        Compute dot-product of this vector with input vector:
        Returns:
        dot-product of this vector with input vector:
      • 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
      • IsEqual

        public boolean IsEqual​(Vector4f rkV)
        Deprecated.
        Return true if the input Vector4f is equal to this.
        Parameters:
        rkV - input vector to compare to this
        Returns:
        true if the input Vector4f is equal to this, false otherwise.
      • isEqual

        public boolean isEqual​(Vector4f rkV)
        Return true if the input Vector4f is equal to this.
        Parameters:
        rkV - input vector to compare to this
        Returns:
        true if the input Vector4f is equal to this, false otherwise.
      • 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​(Vector4f kV)
        Deprecated.
        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:
      • Scale

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

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

        public void Set​(float fX,
                        float fY,
                        float fZ,
                        float fW)
        Deprecated.
        Set the values of this vector.
        Parameters:
        fX - x-value
        fY - y-value
        fZ - z-value
        fW - w-value
      • set

        public Vector4f set​(float fX,
                            float fY,
                            float fZ,
                            float fW)
        Set the values of this vector.
        Parameters:
        fX - x-value
        fY - y-value
        fZ - z-value
        fW - w-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
      • 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.
      • getVector3

        public Vector3f getVector3()
      • add

        public Vector4f add​(Vector4f rkV)
        Add the input vector to this: this = this + rkV
        Parameters:
        rkV -
        Returns:
        this
      • add

        public static Vector4f add​(Vector4f rkV1,
                                   Vector4f rkV2)
        Add the two input vectors, setting this: this = rkV1 + rkV2
        Parameters:
        rkV1 - first input vector
        rkV2 - second input vector
      • compare

        public int compare​(Vector4f arg0,
                           Vector4f arg1)
        Sorting a list of Vector3f in order, where each element is a column when two Vector3f have equal X then the sort is by Y, then by Z.
        Parameters:
        arg0 -
        arg1 -
        Returns:
      • compareTo

        public int compareTo​(Vector4f v)
        Specified by:
        compareTo in interface java.lang.Comparable<Vector4f>