Documentation of 'Catalano.Math.Vector4' Java class
Vector4
Catalano.Math

Class Vector4



  • public class Vector4
    extends java.lang.Object
    4D Vector class with X, Y, Z and W coordinates. The class incapsulates X, Y, Z and W coordinates of a 4D vector and provides some operations with it.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      float w
      W coordinate of the vector.
      float x
      X coordinate of the vector.
      float y
      Y coordinate of the vector.
      float z
      Z coordinate of the vector.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Vector4()
      Initialize a new instance of the Vector4 class.
      Vector4(float value)
      Initialize a new instance of the Vector4 class.
      Vector4(float x, float y, float z, float w)
      Initialize a new instance of the Vector4 class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Vector4 Abs()
      Calculate absolute values of the vector.
      static Vector4 Add(Vector4 vector1, float value)
      Adds a value to all coordinates of the specified vector.
      static Vector4 Add(Vector4 vector1, Vector4 vector2)
      Adds corresponding coordinates of two vectors.
      static Vector4 Divide(Vector4 vector, float factor)
      Divides coordinates of the specified vector by the specified factor.
      static Vector4 Divide(Vector4 vector1, Vector4 vector2)
      Divides corresponding coordinates of two vectors.
      static float Dot(Vector4 vector1, Vector4 vector2)
      Calculates dot product of two vectors.
      boolean equals(java.lang.Object obj) 
      float getMax()
      Get maximum value of the vector.
      int getMaxIndex()
      Get index of the coordinate with maximum value.
      float getMin()
      Get minimum value of the vector.
      int getMinIndex()
      Get index of the coordinate with minimum value.
      Vector4 Inverse()
      Inverse the vector.
      static Vector4 Multiply(Vector4 vector, float factor)
      Multiplies coordinates of the specified vector by the specified factor.
      static Vector4 Multiply(Vector4 vector1, Vector4 vector2)
      Multiplies corresponding coordinates of two vectors.
      float Norm()
      Returns vector's normalization.
      float Normalize()
      Normalizes the vector by dividing it’s all coordinates with the vector's norm.
      float Square()
      Returns square of the vector's norm.
      static Vector4 Subtract(Vector4 vector1, float value)
      Subtracts a value from all coordinates of the specified vector.
      static Vector4 Subtract(Vector4 vector1, Vector4 vector2)
      Subtracts corresponding coordinates of two vectors.
      float[] toArray()
      Returns array representation of the vector.
      Vector3 toVector3()
      Converts the vector to a 3D vector.
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • x

        public float x
        X coordinate of the vector.
      • y

        public float y
        Y coordinate of the vector.
      • z

        public float z
        Z coordinate of the vector.
      • w

        public float w
        W coordinate of the vector.
    • Constructor Detail

      • Vector4

        public Vector4()
        Initialize a new instance of the Vector4 class.
      • Vector4

        public Vector4(float x,
                       float y,
                       float z,
                       float w)
        Initialize a new instance of the Vector4 class.
        Parameters:
        x - X coordinate of the vector.
        y - Y coordinate of the vector.
        z - Z coordinate of the vector.
        w - W coordinate of the vector.
      • Vector4

        public Vector4(float value)
        Initialize a new instance of the Vector4 class.
        Parameters:
        value - Value, which is set to all 4 coordinates of the vector.
    • Method Detail

      • getMax

        public float getMax()
        Get maximum value of the vector.
        Returns:
        Returns maximum value of all 4 vector's coordinates.
      • getMin

        public float getMin()
        Get minimum value of the vector.
        Returns:
        Returns minimum value of all 4 vector's coordinates.
      • getMaxIndex

        public int getMaxIndex()
        Get index of the coordinate with maximum value.
        Returns:
        Index of the coordinate with maximum value.
      • getMinIndex

        public int getMinIndex()
        Get index of the coordinate with minimum value.
        Returns:
        Index of the coordinate with minimum value.
      • Norm

        public float Norm()
        Returns vector's normalization.
        Returns:
        Euclidean normalization of the vector, which is a square root of the sum.
      • Square

        public float Square()
        Returns square of the vector's norm.
        Returns:
        Square of the vector's norm.
      • toArray

        public float[] toArray()
        Returns array representation of the vector.
        Returns:
        Array with 3 values containing X/Y/Z coordinates.
      • Add

        public static Vector4 Add(Vector4 vector1,
                                  Vector4 vector2)
        Adds corresponding coordinates of two vectors.
        Parameters:
        vector1 - First vector to use for dot product calculation.
        vector2 - Second vector to use for dot product calculation.
        Returns:
        Returns a vector which coordinates are equal to sum of corresponding coordinates of the two specified vectors.
      • Add

        public static Vector4 Add(Vector4 vector1,
                                  float value)
        Adds a value to all coordinates of the specified vector.
        Parameters:
        vector - Vector to add the specified value to.
        value - Value to add to all coordinates of the vector.
        Returns:
        Returns new vector with all coordinates increased by the specified value.
      • Subtract

        public static Vector4 Subtract(Vector4 vector1,
                                       Vector4 vector2)
        Subtracts corresponding coordinates of two vectors.
        Parameters:
        vector1 - First vector to use for dot product calculation.
        vector2 - Second vector to use for dot product calculation.
        Returns:
        Returns a vector which coordinates are equal to difference of corresponding coordinates of the two specified vectors.
      • Subtract

        public static Vector4 Subtract(Vector4 vector1,
                                       float value)
        Subtracts a value from all coordinates of the specified vector.
        Parameters:
        vector - Vector to subtract the specified value from.
        value - Value to subtract from all coordinates of the vector.
        Returns:
        Returns new vector with all coordinates decreased by the specified value.
      • Multiply

        public static Vector4 Multiply(Vector4 vector1,
                                       Vector4 vector2)
        Multiplies corresponding coordinates of two vectors.
        Parameters:
        vector1 - The first vector to multiply.
        vector2 - The second vector to multiply.
        Returns:
        Returns a vector which coordinates are equal to multiplication of corresponding coordinates of the two specified vectors.
      • Multiply

        public static Vector4 Multiply(Vector4 vector,
                                       float factor)
        Multiplies coordinates of the specified vector by the specified factor.
        Parameters:
        vector - Vector to multiply coordinates of.
        factor - Factor to multiple coordinates of the specified vector by.
        Returns:
        Returns new vector with all coordinates multiplied by the specified factor.
      • Divide

        public static Vector4 Divide(Vector4 vector1,
                                     Vector4 vector2)
        Divides corresponding coordinates of two vectors.
        Parameters:
        vector1 - The first vector to divide.
        vector2 - The second vector to divide.
        Returns:
        Returns a vector which coordinates are equal to coordinates of the first vector divided by corresponding coordinates of the second vector.
      • Divide

        public static Vector4 Divide(Vector4 vector,
                                     float factor)
        Divides coordinates of the specified vector by the specified factor.
        Parameters:
        vector - Vector to divide coordinates of.
        factor - Factor to divide coordinates of the specified vector by.
        Returns:
        Returns new vector with all coordinates divided by the specified factor.
      • Normalize

        public float Normalize()
        Normalizes the vector by dividing it’s all coordinates with the vector's norm.
        Returns:
        Returns the value of vectors’ norm before normalization.
      • Inverse

        public Vector4 Inverse()
        Inverse the vector.
        Returns:
        Returns a vector with all coordinates equal to 1.0 divided by the value of corresponding coordinate in this vector (or equal to 0.0 if this vector has corresponding coordinate also set to 0.0).
      • Abs

        public Vector4 Abs()
        Calculate absolute values of the vector.
        Returns:
        Returns a vector with all coordinates equal to absolute values of this vector's coordinates.
      • Dot

        public static float Dot(Vector4 vector1,
                                Vector4 vector2)
        Calculates dot product of two vectors.
        Parameters:
        vector1 - First vector to use for dot product calculation.
        vector2 - Second vector to use for dot product calculation.
        Returns:
        Returns dot product of the two specified vectors.
      • toVector3

        public Vector3 toVector3()
        Converts the vector to a 3D vector.
        Returns:
        Returns 3D vector which has X/Y/Z coordinates equal to X/Y/Z coordinates of this vector divided by W.
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.