Class Vector4i

All Implemented Interfaces:
Cloneable<Vector4i>, Printable

public class Vector4i extends VectorInt<Vector4i>
4-dimensional vector with integer precision. GLSL equivalent to ivec4.
  • Field Details Link icon

    • x Link icon

      public int x
    • y Link icon

      public int y
    • z Link icon

      public int z
    • w Link icon

      public int w
    • temp Link icon

      public static final Vector4i temp
      Reusable temporary vector, to avoid repeatedly creating new instances in performance-critical contexts.
  • Constructor Details Link icon

    • Vector4i Link icon

      public Vector4i()
      Creates a default 4-dimensional vector with all values set to 0.
    • Vector4i Link icon

      public Vector4i(int x, int y, int z, int w)
      Creates a 4-dimensional vector with given values.
  • Method Details Link icon

    • add Link icon

      public Vector4i add(int x, int y, int z, int w)
    • add Link icon

      public Vector4i add(Vector4i vector4i)
      Description copied from class: Vector
      Adds another vector to this vector.
      Specified by:
      add in class Vector<Vector4i>
      Returns:
      Self
    • scale Link icon

      public Vector4i scale(float scalar)
      Description copied from class: Vector
      Scales this vector by a scalar.
      Specified by:
      scale in class Vector<Vector4i>
      Returns:
      Self
    • lengthSquared Link icon

      public int lengthSquared()
      Description copied from class: VectorInt
      Calculates the squared length of this vector.
      Specified by:
      lengthSquared in class VectorInt<Vector4i>
    • dot Link icon

      public int dot(Vector4i vector4i)
      Description copied from class: VectorInt
      Calculates the dot product of this vector with another vector.
      Specified by:
      dot in class VectorInt<Vector4i>
      Returns:
      Dot product of this vector multiplied by another vector
    • toBuffer Link icon

      public void toBuffer(IntBuffer buffer)
      Description copied from class: VectorInt
      Stores the vector in a given buffer.
      Specified by:
      toBuffer in class VectorInt<Vector4i>
      Parameters:
      buffer - The buffer to store the vector data in
    • equals Link icon

      public boolean equals(Vector4i vector)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Specified by:
      equals in interface Cloneable<Vector4i>
      Specified by:
      equals in class Vector<Vector4i>
      Parameters:
      vector - Other object
      Returns:
      true if both objects are equal.
    • clone Link icon

      public Vector4i clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<Vector4i>
      Specified by:
      clone in class Vector<Vector4i>
      Returns:
      Clone of this object
    • toString Link icon

      public String toString()
      Converts this vector to a string representation in the format "(x,y,z,w)".
      Specified by:
      toString in interface Printable
      Specified by:
      toString in class Vector<Vector4i>
      Returns:
      String representation of this object.
    • parse Link icon

      public static Vector4i parse(String input) throws InvalidStringException
      Throws:
      InvalidStringException
    • getTemp Link icon

      public static Vector4i getTemp(int x, int y, int z, int w)
      Returns a temporary vector with given values. Note that this temporary vector is a global instance, so avoid concurrent usage.