Package org.joml

Class Vector3i

java.lang.Object
org.joml.Vector3i
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Vector3ic

public class Vector3i extends Object implements Externalizable, Cloneable, Vector3ic
Contains the definition of a Vector comprising 3 ints and associated transformations.
Author:
Richard Greenlees, Kai Burjack, Hans Uhlig
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    The x component of the vector.
    int
    The y component of the vector.
    int
    The z component of the vector.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new Vector3i of (0, 0, 0).
    Vector3i​(double x, double y, double z, int mode)
    Create a new Vector3i with the given component values and round using the given RoundingMode.
    Vector3i​(float x, float y, float z, int mode)
    Create a new Vector3i with the given component values and round using the given RoundingMode.
    Vector3i​(int d)
    Create a new Vector3i and initialize all three components with the given value.
    Vector3i​(int[] xyz)
    Create a new Vector3i and initialize its three components from the first three elements of the given array.
    Vector3i​(int x, int y, int z)
    Create a new Vector3i with the given component values.
    Vector3i​(int index, ByteBuffer buffer)
    Create a new Vector3i and read this vector from the supplied ByteBuffer starting at the specified absolute buffer position/index.
    Vector3i​(int index, IntBuffer buffer)
    Create a new Vector3i and read this vector from the supplied IntBuffer starting at the specified absolute buffer position/index.
    Vector3i​(ByteBuffer buffer)
    Create a new Vector3i and read this vector from the supplied ByteBuffer at the current buffer position.
    Vector3i​(IntBuffer buffer)
    Create a new Vector3i and read this vector from the supplied IntBuffer at the current buffer position.
    Vector3i​(Vector2dc v, float z, int mode)
    Create a new Vector3i with the first two components from the given v and the given z and round using the given RoundingMode.
    Vector3i​(Vector2fc v, float z, int mode)
    Create a new Vector3i with the first two components from the given v and the given z and round using the given RoundingMode.
    Vector3i​(Vector2ic v, int z)
    Create a new Vector3i with the first two components from the given v and the given z
    Vector3i​(Vector3dc v, int mode)
    Create a new Vector3i and initialize its components to the rounded value of the given vector.
    Vector3i​(Vector3fc v, int mode)
    Create a new Vector3i and initialize its components to the rounded value of the given vector.
    Create a new Vector3i with the same values as v.
  • Method Summary

    Modifier and Type
    Method
    Description
    Set this vector's components to their respective absolute values.
    absolute​(Vector3i dest)
    Compute the absolute of each of this vector's components and store the result into dest.
    add​(int x, int y, int z)
    Increment the components of this vector by the given values.
    add​(int x, int y, int z, Vector3i dest)
    Increment the components of this vector by the given values and store the result in dest.
    add​(Vector3ic v)
    Add the supplied vector to this one.
    add​(Vector3ic v, Vector3i dest)
    Add the supplied vector to this one and store the result in dest.
     
    double
    distance​(int x, int y, int z)
    Return the distance between this vector and (x, y, z).
    static double
    distance​(int x1, int y1, int z1, int x2, int y2, int z2)
    Return the distance between (x1, y1, z1) and (x2, y2, z2).
    double
    Return the distance between this Vector and v.
    long
    distanceSquared​(int x, int y, int z)
    Return the square of the distance between this vector and (x, y, z).
    static long
    distanceSquared​(int x1, int y1, int z1, int x2, int y2, int z2)
    Return the squared distance between (x1, y1, z1) and (x2, y2, z2).
    long
    Return the square of the distance between this vector and v.
    div​(float scalar)
    Divide all components of this Vector3i by the given scalar value.
    div​(float scalar, Vector3i dest)
    Divide all components of this Vector3i by the given scalar value and store the result in dest.
    div​(int scalar)
    Divide all components of this Vector3i by the given scalar value.
    div​(int scalar, Vector3i dest)
    Divide all components of this Vector3i by the given scalar value and store the result in dest.
    boolean
    equals​(int x, int y, int z)
    Compare the vector components of this vector with the given (x, y, z) and return whether all of them are equal.
    boolean
    equals​(Object obj)
     
    int
    get​(int component)
    Get the value of the specified component of this vector.
    get​(int index, ByteBuffer buffer)
    Store this vector into the supplied ByteBuffer starting at the specified absolute buffer position/index.
    get​(int index, IntBuffer buffer)
    Store this vector into the supplied IntBuffer starting at the specified absolute buffer position/index.
    get​(ByteBuffer buffer)
    Store this vector into the supplied ByteBuffer at the current buffer position.
    get​(IntBuffer buffer)
    Store this vector into the supplied IntBuffer at the current buffer position.
    getToAddress​(long address)
    Store this vector at the given off-heap memory address.
    long
    gridDistance​(int x, int y, int z)
    Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
    long
    Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
    int
     
    double
    Return the length of this vector.
    static double
    length​(int x, int y, int z)
    Get the length of a 3-dimensional single-precision vector.
    long
    Return the length squared of this vector.
    static long
    lengthSquared​(int x, int y, int z)
    Get the length squared of a 3-dimensional single-precision vector.
    max​(Vector3ic v)
    Set the components of this vector to be the component-wise maximum of this and the other vector.
    max​(Vector3ic v, Vector3i dest)
    Set the components of dest to be the component-wise maximum of this and the other vector.
    int
    Determine the component with the biggest absolute value.
    min​(Vector3ic v)
    Set the components of this vector to be the component-wise minimum of this and the other vector.
    min​(Vector3ic v, Vector3i dest)
    Set the components of dest to be the component-wise minimum of this and the other vector.
    int
    Determine the component with the smallest (towards zero) absolute value.
    mul​(int scalar)
    Multiply all components of this Vector3i by the given scalar value.
    mul​(int x, int y, int z)
    Multiply the components of this vector by the given values.
    mul​(int x, int y, int z, Vector3i dest)
    Multiply the components of this vector by the given values and store the result in dest.
    mul​(int scalar, Vector3i dest)
    Multiply the components of this vector by the given scalar and store the result in dest.
    mul​(Vector3ic v)
    Multiply all components of this Vector3i by the given vector.
    mul​(Vector3ic v, Vector3i dest)
    Multiply the supplied vector by this one and store the result in dest.
    Negate this vector.
    negate​(Vector3i dest)
    Negate this vector and store the result in dest.
    void
     
    set​(int d)
    Set the x, y, and z components to the supplied value.
    set​(int[] xyz)
    Set the three components of this vector to the first three elements of the given array.
    set​(int x, int y, int z)
    Set the x, y and z components to the supplied values.
    set​(int index, ByteBuffer buffer)
    Read this vector from the supplied ByteBuffer starting at the specified absolute buffer position/index.
    set​(int index, IntBuffer buffer)
    Read this vector from the supplied IntBuffer starting at the specified absolute buffer position/index.
    set​(ByteBuffer buffer)
    Read this vector from the supplied ByteBuffer at the current buffer position.
    set​(IntBuffer buffer)
    Read this vector from the supplied IntBuffer at the current buffer position.
    set​(Vector2ic v, int z)
    Set the first two components from the given v and the z component from the given z
    set​(Vector3dc v)
    Set this Vector3i to the values of v using RoundingMode.TRUNCATE rounding.
    set​(Vector3dc v, int mode)
    Set this Vector3i to the values of v using the given RoundingMode.
    set​(Vector3fc v, int mode)
    Set this Vector3i to the values of v using the given RoundingMode.
    set​(Vector3ic v)
    Set the x, y and z components to match the supplied vector.
    setComponent​(int component, int value)
    Set the value of the specified component of this vector.
    setFromAddress​(long address)
    Set the values of this vector by reading 3 integer values from off-heap memory, starting at the given address.
    sub​(int x, int y, int z)
    Decrement the components of this vector by the given values.
    sub​(int x, int y, int z, Vector3i dest)
    Decrement the components of this vector by the given values and store the result in dest.
    sub​(Vector3ic v)
    Subtract the supplied vector from this one and store the result in this.
    sub​(Vector3ic v, Vector3i dest)
    Subtract the supplied vector from this one and store the result in dest.
    Return a string representation of this vector.
    toString​(NumberFormat formatter)
    Return a string representation of this vector by formatting the vector components with the given NumberFormat.
    void
     
    int
    x()
     
    int
    y()
     
    int
    z()
     
    Set all components to zero.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public int x
      The x component of the vector.
    • y

      public int y
      The y component of the vector.
    • z

      public int z
      The z component of the vector.
  • Constructor Details

    • Vector3i

      public Vector3i()
      Create a new Vector3i of (0, 0, 0).
    • Vector3i

      public Vector3i(int d)
      Create a new Vector3i and initialize all three components with the given value.
      Parameters:
      d - the value of all three components
    • Vector3i

      public Vector3i(int x, int y, int z)
      Create a new Vector3i with the given component values.
      Parameters:
      x - the value of x
      y - the value of y
      z - the value of z
    • Vector3i

      public Vector3i(Vector3ic v)
      Create a new Vector3i with the same values as v.
      Parameters:
      v - the Vector3ic to copy the values from
    • Vector3i

      public Vector3i(Vector2ic v, int z)
      Create a new Vector3i with the first two components from the given v and the given z
      Parameters:
      v - the Vector2ic to copy the values from
      z - the z component
    • Vector3i

      public Vector3i(float x, float y, float z, int mode)
      Create a new Vector3i with the given component values and round using the given RoundingMode.
      Parameters:
      x - the value of x
      y - the value of y
      z - the value of z
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(double x, double y, double z, int mode)
      Create a new Vector3i with the given component values and round using the given RoundingMode.
      Parameters:
      x - the value of x
      y - the value of y
      z - the value of z
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(Vector2fc v, float z, int mode)
      Create a new Vector3i with the first two components from the given v and the given z and round using the given RoundingMode.
      Parameters:
      v - the Vector2fc to copy the values from
      z - the z component
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(Vector3fc v, int mode)
      Create a new Vector3i and initialize its components to the rounded value of the given vector.
      Parameters:
      v - the Vector3fc to round and copy the values from
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(Vector2dc v, float z, int mode)
      Create a new Vector3i with the first two components from the given v and the given z and round using the given RoundingMode.
      Parameters:
      v - the Vector2dc to copy the values from
      z - the z component
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(Vector3dc v, int mode)
      Create a new Vector3i and initialize its components to the rounded value of the given vector.
      Parameters:
      v - the Vector3dc to round and copy the values from
      mode - the RoundingMode to use
    • Vector3i

      public Vector3i(int[] xyz)
      Create a new Vector3i and initialize its three components from the first three elements of the given array.
      Parameters:
      xyz - the array containing at least three elements
    • Vector3i

      public Vector3i(ByteBuffer buffer)
      Create a new Vector3i and read this vector from the supplied ByteBuffer at the current buffer position.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the vector is read, use Vector3i(int, ByteBuffer), taking the absolute position as parameter.

      Parameters:
      buffer - values will be read in x, y, z order
      See Also:
      Vector3i(int, ByteBuffer)
    • Vector3i

      public Vector3i(int index, ByteBuffer buffer)
      Create a new Vector3i and read this vector from the supplied ByteBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given ByteBuffer.

      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - values will be read in x, y, z order
    • Vector3i

      public Vector3i(IntBuffer buffer)
      Create a new Vector3i and read this vector from the supplied IntBuffer at the current buffer position.

      This method will not increment the position of the given IntBuffer.

      In order to specify the offset into the IntBuffer at which the vector is read, use Vector3i(int, IntBuffer), taking the absolute position as parameter.

      Parameters:
      buffer - values will be read in x, y, z order
      See Also:
      Vector3i(int, IntBuffer)
    • Vector3i

      public Vector3i(int index, IntBuffer buffer)
      Create a new Vector3i and read this vector from the supplied IntBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given IntBuffer.

      Parameters:
      index - the absolute position into the IntBuffer
      buffer - values will be read in x, y, z order
  • Method Details

    • x

      public int x()
      Specified by:
      x in interface Vector3ic
      Returns:
      the value of the x component
    • y

      public int y()
      Specified by:
      y in interface Vector3ic
      Returns:
      the value of the y component
    • z

      public int z()
      Specified by:
      z in interface Vector3ic
      Returns:
      the value of the z component
    • set

      public Vector3i set(Vector3ic v)
      Set the x, y and z components to match the supplied vector.
      Parameters:
      v - contains the values of x, y and z to set
      Returns:
      this
    • set

      public Vector3i set(Vector3dc v)
      Set this Vector3i to the values of v using RoundingMode.TRUNCATE rounding.

      Note that due to the given vector v storing the components in double-precision, there is the possibility to lose precision.

      Parameters:
      v - the vector to copy from
      Returns:
      this
    • set

      public Vector3i set(Vector3dc v, int mode)
      Set this Vector3i to the values of v using the given RoundingMode.

      Note that due to the given vector v storing the components in double-precision, there is the possibility to lose precision.

      Parameters:
      v - the vector to copy from
      mode - the RoundingMode to use
      Returns:
      this
    • set

      public Vector3i set(Vector3fc v, int mode)
      Set this Vector3i to the values of v using the given RoundingMode.

      Note that due to the given vector v storing the components in double-precision, there is the possibility to lose precision.

      Parameters:
      v - the vector to copy from
      mode - the RoundingMode to use
      Returns:
      this
    • set

      public Vector3i set(Vector2ic v, int z)
      Set the first two components from the given v and the z component from the given z
      Parameters:
      v - the Vector2ic to copy the values from
      z - the z component
      Returns:
      this
    • set

      public Vector3i set(int d)
      Set the x, y, and z components to the supplied value.
      Parameters:
      d - the value of all three components
      Returns:
      this
    • set

      public Vector3i set(int x, int y, int z)
      Set the x, y and z components to the supplied values.
      Parameters:
      x - the x component
      y - the y component
      z - the z component
      Returns:
      this
    • set

      public Vector3i set(int[] xyz)
      Set the three components of this vector to the first three elements of the given array.
      Parameters:
      xyz - the array containing at least three elements
      Returns:
      this
    • set

      public Vector3i set(ByteBuffer buffer)
      Read this vector from the supplied ByteBuffer at the current buffer position.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the vector is read, use set(int, ByteBuffer), taking the absolute position as parameter.

      Parameters:
      buffer - values will be read in x, y, z order
      Returns:
      this
      See Also:
      set(int, ByteBuffer)
    • set

      public Vector3i set(int index, ByteBuffer buffer)
      Read this vector from the supplied ByteBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given ByteBuffer.

      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - values will be read in x, y, z order
      Returns:
      this
    • set

      public Vector3i set(IntBuffer buffer)
      Read this vector from the supplied IntBuffer at the current buffer position.

      This method will not increment the position of the given IntBuffer.

      In order to specify the offset into the IntBuffer at which the vector is read, use set(int, IntBuffer), taking the absolute position as parameter.

      Parameters:
      buffer - values will be read in x, y, z order
      Returns:
      this
      See Also:
      set(int, IntBuffer)
    • set

      public Vector3i set(int index, IntBuffer buffer)
      Read this vector from the supplied IntBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given IntBuffer.

      Parameters:
      index - the absolute position into the IntBuffer
      buffer - values will be read in x, y, z order
      Returns:
      this
    • setFromAddress

      public Vector3i setFromAddress(long address)
      Set the values of this vector by reading 3 integer values from off-heap memory, starting at the given address.

      This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

      This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

      Parameters:
      address - the off-heap memory address to read the vector values from
      Returns:
      this
    • get

      public int get(int component) throws IllegalArgumentException
      Description copied from interface: Vector3ic
      Get the value of the specified component of this vector.
      Specified by:
      get in interface Vector3ic
      Parameters:
      component - the component, within [0..2]
      Returns:
      the value
      Throws:
      IllegalArgumentException - if component is not within [0..2]
    • setComponent

      public Vector3i setComponent(int component, int value) throws IllegalArgumentException
      Set the value of the specified component of this vector.
      Parameters:
      component - the component whose value to set, within [0..2]
      value - the value to set
      Returns:
      this
      Throws:
      IllegalArgumentException - if component is not within [0..2]
    • get

      public IntBuffer get(IntBuffer buffer)
      Description copied from interface: Vector3ic
      Store this vector into the supplied IntBuffer at the current buffer position.

      This method will not increment the position of the given IntBuffer.

      In order to specify the offset into the IntBuffer at which the vector is stored, use Vector3ic.get(int, IntBuffer), taking the absolute position as parameter.

      Specified by:
      get in interface Vector3ic
      Parameters:
      buffer - will receive the values of this vector in x, y, z order
      Returns:
      the passed in buffer
      See Also:
      Vector3ic.get(int, IntBuffer)
    • get

      public IntBuffer get(int index, IntBuffer buffer)
      Description copied from interface: Vector3ic
      Store this vector into the supplied IntBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given IntBuffer.

      Specified by:
      get in interface Vector3ic
      Parameters:
      index - the absolute position into the IntBuffer
      buffer - will receive the values of this vector in x, y, z order
      Returns:
      the passed in buffer
    • get

      public ByteBuffer get(ByteBuffer buffer)
      Description copied from interface: Vector3ic
      Store this vector into the supplied ByteBuffer at the current buffer position.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the vector is stored, use Vector3ic.get(int, ByteBuffer), taking the absolute position as parameter.

      Specified by:
      get in interface Vector3ic
      Parameters:
      buffer - will receive the values of this vector in x, y, z order
      Returns:
      the passed in buffer
      See Also:
      Vector3ic.get(int, ByteBuffer)
    • get

      public ByteBuffer get(int index, ByteBuffer buffer)
      Description copied from interface: Vector3ic
      Store this vector into the supplied ByteBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given ByteBuffer.

      Specified by:
      get in interface Vector3ic
      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - will receive the values of this vector in x, y, z order
      Returns:
      the passed in buffer
    • getToAddress

      public Vector3ic getToAddress(long address)
      Description copied from interface: Vector3ic
      Store this vector at the given off-heap memory address.

      This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

      This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

      Specified by:
      getToAddress in interface Vector3ic
      Parameters:
      address - the off-heap address where to store this vector
      Returns:
      this
    • sub

      public Vector3i sub(Vector3ic v)
      Subtract the supplied vector from this one and store the result in this.
      Parameters:
      v - the vector to subtract
      Returns:
      this
    • sub

      public Vector3i sub(Vector3ic v, Vector3i dest)
      Description copied from interface: Vector3ic
      Subtract the supplied vector from this one and store the result in dest.
      Specified by:
      sub in interface Vector3ic
      Parameters:
      v - the vector to subtract
      dest - will hold the result
      Returns:
      dest
    • sub

      public Vector3i sub(int x, int y, int z)
      Decrement the components of this vector by the given values.
      Parameters:
      x - the x component to subtract
      y - the y component to subtract
      z - the z component to subtract
      Returns:
      this
    • sub

      public Vector3i sub(int x, int y, int z, Vector3i dest)
      Description copied from interface: Vector3ic
      Decrement the components of this vector by the given values and store the result in dest.
      Specified by:
      sub in interface Vector3ic
      Parameters:
      x - the x component to subtract
      y - the y component to subtract
      z - the z component to subtract
      dest - will hold the result
      Returns:
      dest
    • add

      public Vector3i add(Vector3ic v)
      Add the supplied vector to this one.
      Parameters:
      v - the vector to add
      Returns:
      this
    • add

      public Vector3i add(Vector3ic v, Vector3i dest)
      Description copied from interface: Vector3ic
      Add the supplied vector to this one and store the result in dest.
      Specified by:
      add in interface Vector3ic
      Parameters:
      v - the vector to add
      dest - will hold the result
      Returns:
      dest
    • add

      public Vector3i add(int x, int y, int z)
      Increment the components of this vector by the given values.
      Parameters:
      x - the x component to add
      y - the y component to add
      z - the z component to add
      Returns:
      this
    • add

      public Vector3i add(int x, int y, int z, Vector3i dest)
      Description copied from interface: Vector3ic
      Increment the components of this vector by the given values and store the result in dest.
      Specified by:
      add in interface Vector3ic
      Parameters:
      x - the x component to add
      y - the y component to add
      z - the z component to add
      dest - will hold the result
      Returns:
      dest
    • mul

      public Vector3i mul(int scalar)
      Multiply all components of this Vector3i by the given scalar value.
      Parameters:
      scalar - the scalar to multiply this vector by
      Returns:
      this
    • mul

      public Vector3i mul(int scalar, Vector3i dest)
      Description copied from interface: Vector3ic
      Multiply the components of this vector by the given scalar and store the result in dest.
      Specified by:
      mul in interface Vector3ic
      Parameters:
      scalar - the value to multiply this vector's components by
      dest - will hold the result
      Returns:
      dest
    • mul

      public Vector3i mul(Vector3ic v)
      Multiply all components of this Vector3i by the given vector.
      Parameters:
      v - the vector to multiply
      Returns:
      this
    • mul

      public Vector3i mul(Vector3ic v, Vector3i dest)
      Description copied from interface: Vector3ic
      Multiply the supplied vector by this one and store the result in dest.
      Specified by:
      mul in interface Vector3ic
      Parameters:
      v - the vector to multiply
      dest - will hold the result
      Returns:
      dest
    • mul

      public Vector3i mul(int x, int y, int z)
      Multiply the components of this vector by the given values.
      Parameters:
      x - the x component to multiply
      y - the y component to multiply
      z - the z component to multiply
      Returns:
      this
    • mul

      public Vector3i mul(int x, int y, int z, Vector3i dest)
      Description copied from interface: Vector3ic
      Multiply the components of this vector by the given values and store the result in dest.
      Specified by:
      mul in interface Vector3ic
      Parameters:
      x - the x component to multiply
      y - the y component to multiply
      z - the z component to multiply
      dest - will hold the result
      Returns:
      dest
    • div

      public Vector3i div(float scalar)
      Divide all components of this Vector3i by the given scalar value.
      Parameters:
      scalar - the scalar to divide by
      Returns:
      this
    • div

      public Vector3i div(float scalar, Vector3i dest)
      Description copied from interface: Vector3ic
      Divide all components of this Vector3i by the given scalar value and store the result in dest.
      Specified by:
      div in interface Vector3ic
      Parameters:
      scalar - the scalar to divide by
      dest - will hold the result
      Returns:
      dest
    • div

      public Vector3i div(int scalar)
      Divide all components of this Vector3i by the given scalar value.
      Parameters:
      scalar - the scalar to divide by
      Returns:
      this
    • div

      public Vector3i div(int scalar, Vector3i dest)
      Description copied from interface: Vector3ic
      Divide all components of this Vector3i by the given scalar value and store the result in dest.
      Specified by:
      div in interface Vector3ic
      Parameters:
      scalar - the scalar to divide by
      dest - will hold the result
      Returns:
      dest
    • lengthSquared

      public long lengthSquared()
      Description copied from interface: Vector3ic
      Return the length squared of this vector.
      Specified by:
      lengthSquared in interface Vector3ic
      Returns:
      the length squared
    • lengthSquared

      public static long lengthSquared(int x, int y, int z)
      Get the length squared of a 3-dimensional single-precision vector.
      Parameters:
      x - The vector's x component
      y - The vector's y component
      z - The vector's z component
      Returns:
      the length squared of the given vector
    • length

      public double length()
      Description copied from interface: Vector3ic
      Return the length of this vector.
      Specified by:
      length in interface Vector3ic
      Returns:
      the length
    • length

      public static double length(int x, int y, int z)
      Get the length of a 3-dimensional single-precision vector.
      Parameters:
      x - The vector's x component
      y - The vector's y component
      z - The vector's z component
      Returns:
      the length squared of the given vector
    • distance

      public double distance(Vector3ic v)
      Description copied from interface: Vector3ic
      Return the distance between this Vector and v.
      Specified by:
      distance in interface Vector3ic
      Parameters:
      v - the other vector
      Returns:
      the distance
    • distance

      public double distance(int x, int y, int z)
      Description copied from interface: Vector3ic
      Return the distance between this vector and (x, y, z).
      Specified by:
      distance in interface Vector3ic
      Parameters:
      x - the x component of the other vector
      y - the y component of the other vector
      z - the z component of the other vector
      Returns:
      the euclidean distance
    • gridDistance

      public long gridDistance(Vector3ic v)
      Description copied from interface: Vector3ic
      Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
      Specified by:
      gridDistance in interface Vector3ic
      Parameters:
      v - the other vector
      Returns:
      the grid distance
    • gridDistance

      public long gridDistance(int x, int y, int z)
      Description copied from interface: Vector3ic
      Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
      Specified by:
      gridDistance in interface Vector3ic
      Parameters:
      x - the x component of the other vector
      y - the y component of the other vector
      z - the y component of the other vector
      Returns:
      the grid distance
    • distanceSquared

      public long distanceSquared(Vector3ic v)
      Description copied from interface: Vector3ic
      Return the square of the distance between this vector and v.
      Specified by:
      distanceSquared in interface Vector3ic
      Parameters:
      v - the other vector
      Returns:
      the squared of the distance
    • distanceSquared

      public long distanceSquared(int x, int y, int z)
      Description copied from interface: Vector3ic
      Return the square of the distance between this vector and (x, y, z).
      Specified by:
      distanceSquared in interface Vector3ic
      Parameters:
      x - the x component of the other vector
      y - the y component of the other vector
      z - the z component of the other vector
      Returns:
      the square of the distance
    • distance

      public static double distance(int x1, int y1, int z1, int x2, int y2, int z2)
      Return the distance between (x1, y1, z1) and (x2, y2, z2).
      Parameters:
      x1 - the x component of the first vector
      y1 - the y component of the first vector
      z1 - the z component of the first vector
      x2 - the x component of the second vector
      y2 - the y component of the second vector
      z2 - the z component of the second vector
      Returns:
      the euclidean distance
    • distanceSquared

      public static long distanceSquared(int x1, int y1, int z1, int x2, int y2, int z2)
      Return the squared distance between (x1, y1, z1) and (x2, y2, z2).
      Parameters:
      x1 - the x component of the first vector
      y1 - the y component of the first vector
      z1 - the z component of the first vector
      x2 - the x component of the second vector
      y2 - the y component of the second vector
      z2 - the z component of the second vector
      Returns:
      the euclidean distance squared
    • zero

      public Vector3i zero()
      Set all components to zero.
      Returns:
      this
    • toString

      public String toString()
      Return a string representation of this vector.

      This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".

      Overrides:
      toString in class Object
      Returns:
      the string representation
    • toString

      public String toString(NumberFormat formatter)
      Return a string representation of this vector by formatting the vector components with the given NumberFormat.
      Parameters:
      formatter - the NumberFormat used to format the vector components with
      Returns:
      the string representation
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • negate

      public Vector3i negate()
      Negate this vector.
      Returns:
      this
    • negate

      public Vector3i negate(Vector3i dest)
      Description copied from interface: Vector3ic
      Negate this vector and store the result in dest.
      Specified by:
      negate in interface Vector3ic
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • min

      public Vector3i min(Vector3ic v)
      Set the components of this vector to be the component-wise minimum of this and the other vector.
      Parameters:
      v - the other vector
      Returns:
      this
    • min

      public Vector3i min(Vector3ic v, Vector3i dest)
      Description copied from interface: Vector3ic
      Set the components of dest to be the component-wise minimum of this and the other vector.
      Specified by:
      min in interface Vector3ic
      Parameters:
      v - the other vector
      dest - will hold the result
      Returns:
      dest
    • max

      public Vector3i max(Vector3ic v)
      Set the components of this vector to be the component-wise maximum of this and the other vector.
      Parameters:
      v - the other vector
      Returns:
      this
    • max

      public Vector3i max(Vector3ic v, Vector3i dest)
      Description copied from interface: Vector3ic
      Set the components of dest to be the component-wise maximum of this and the other vector.
      Specified by:
      max in interface Vector3ic
      Parameters:
      v - the other vector
      dest - will hold the result
      Returns:
      dest
    • maxComponent

      public int maxComponent()
      Description copied from interface: Vector3ic
      Determine the component with the biggest absolute value.
      Specified by:
      maxComponent in interface Vector3ic
      Returns:
      the component index, within [0..2]
    • minComponent

      public int minComponent()
      Description copied from interface: Vector3ic
      Determine the component with the smallest (towards zero) absolute value.
      Specified by:
      minComponent in interface Vector3ic
      Returns:
      the component index, within [0..2]
    • absolute

      public Vector3i absolute()
      Set this vector's components to their respective absolute values.
      Returns:
      this
    • absolute

      public Vector3i absolute(Vector3i dest)
      Description copied from interface: Vector3ic
      Compute the absolute of each of this vector's components and store the result into dest.
      Specified by:
      absolute in interface Vector3ic
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(int x, int y, int z)
      Description copied from interface: Vector3ic
      Compare the vector components of this vector with the given (x, y, z) and return whether all of them are equal.
      Specified by:
      equals in interface Vector3ic
      Parameters:
      x - the x component to compare to
      y - the y component to compare to
      z - the z component to compare to
      Returns:
      true if all the vector components are equal
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException