Package org.joml

Class Vector3L

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, Vector3Lc

    public class Vector3L
    extends java.lang.Object
    implements java.io.Externalizable, java.lang.Cloneable, Vector3Lc
    Contains the definition of a vector comprising 3 longs and associated transformations.
    See Also:
    Serialized Form
    • Field Summary

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

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

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

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

      • x

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

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

        public long z
        The z component of the vector.
    • Constructor Detail

      • Vector3L

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

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

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

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

        public Vector3L​(Vector2ic v,
                        int z)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(float x,
                        float y,
                        float z,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(double x,
                        double y,
                        double z,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(Vector2fc v,
                        float z,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(Vector3fc v,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(Vector2dc v,
                        float z,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(Vector3dc v,
                        int mode)
        Create a new Vector3L 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
      • Vector3L

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

        public Vector3L​(java.nio.ByteBuffer buffer)
        Create a new Vector3L 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 Vector3L(int, ByteBuffer), taking the absolute position as parameter.

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

        public Vector3L​(int index,
                        java.nio.ByteBuffer buffer)
        Create a new Vector3L 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
      • Vector3L

        public Vector3L​(java.nio.LongBuffer buffer)
        Create a new Vector3L and read this vector from the supplied LongBuffer at the current buffer position.

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

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

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

        public Vector3L​(int index,
                        java.nio.LongBuffer buffer)
        Create a new Vector3L and read this vector from the supplied LongBuffer starting at the specified absolute buffer position/index.

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

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

      • x

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

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

        public long z()
        Specified by:
        z in interface Vector3Lc
        Returns:
        the value of the z component
      • xy

        public Vector2f xy​(Vector2f dest)
        Copy the (x, y) components of this into the supplied dest vector and return it.
        Parameters:
        dest - will hold the result
        Returns:
        dest
      • xy

        public Vector2d xy​(Vector2d dest)
        Copy the (x, y) components of this into the supplied dest vector and return it.
        Parameters:
        dest - will hold the result
        Returns:
        dest
      • xy

        public Vector2L xy​(Vector2L dest)
        Copy the (x, y) components of this into the supplied dest vector and return it.
        Parameters:
        dest - will hold the result
        Returns:
        dest
      • set

        public Vector3L set​(Vector3Lc 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 Vector3L set​(Vector3dc v)
        Set this vector 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 Vector3L set​(Vector3dc v,
                            int mode)
        Set this vector 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 Vector3L set​(Vector3fc v,
                            int mode)
        Set this vector 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 Vector3L set​(Vector2ic v,
                            long 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 Vector3L set​(long d)
        Set the x, y, and z components to the supplied value.
        Parameters:
        d - the value of all three components
        Returns:
        this
      • set

        public Vector3L set​(long x,
                            long y,
                            long 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 Vector3L set​(long[] 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 Vector3L set​(java.nio.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 Vector3L set​(int index,
                            java.nio.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 Vector3L set​(java.nio.LongBuffer buffer)
        Read this vector from the supplied LongBuffer at the current buffer position.

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

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

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

        public Vector3L set​(int index,
                            java.nio.LongBuffer buffer)
        Read this vector from the supplied LongBuffer starting at the specified absolute buffer position/index.

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

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

        public Vector3L 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 long get​(int component)
                 throws java.lang.IllegalArgumentException
        Description copied from interface: Vector3Lc
        Get the value of the specified component of this vector.
        Specified by:
        get in interface Vector3Lc
        Parameters:
        component - the component, within [0..2]
        Returns:
        the value
        Throws:
        java.lang.IllegalArgumentException - if component is not within [0..2]
      • setComponent

        public Vector3L setComponent​(int component,
                                     int value)
                              throws java.lang.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:
        java.lang.IllegalArgumentException - if component is not within [0..2]
      • get

        public java.nio.LongBuffer get​(java.nio.LongBuffer buffer)
        Description copied from interface: Vector3Lc
        Store this vector into the supplied LongBuffer at the current buffer position.

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

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

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

        public java.nio.LongBuffer get​(int index,
                                       java.nio.LongBuffer buffer)
        Description copied from interface: Vector3Lc
        Store this vector into the supplied LongBuffer starting at the specified absolute buffer position/index.

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

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

        public java.nio.ByteBuffer get​(java.nio.ByteBuffer buffer)
        Description copied from interface: Vector3Lc
        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 Vector3Lc.get(int, ByteBuffer), taking the absolute position as parameter.

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

        public java.nio.ByteBuffer get​(int index,
                                       java.nio.ByteBuffer buffer)
        Description copied from interface: Vector3Lc
        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 Vector3Lc
        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 Vector3Lc getToAddress​(long address)
        Description copied from interface: Vector3Lc
        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 Vector3Lc
        Parameters:
        address - the off-heap address where to store this vector
        Returns:
        this
      • sub

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

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

        public Vector3L sub​(long x,
                            long y,
                            long 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 Vector3L sub​(long x,
                            long y,
                            long z,
                            Vector3L dest)
        Description copied from interface: Vector3Lc
        Decrement the components of this vector by the given values and store the result in dest.
        Specified by:
        sub in interface Vector3Lc
        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 Vector3L add​(Vector3Lc v)
        Add the supplied vector to this one.
        Parameters:
        v - the vector to add
        Returns:
        this
      • add

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

        public Vector3L add​(long x,
                            long y,
                            long 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 Vector3L add​(long x,
                            long y,
                            long z,
                            Vector3L dest)
        Description copied from interface: Vector3Lc
        Increment the components of this vector by the given values and store the result in dest.
        Specified by:
        add in interface Vector3Lc
        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 Vector3L mul​(long scalar)
        Multiply all components of this vector by the given scalar value.
        Parameters:
        scalar - the scalar to multiply this vector by
        Returns:
        this
      • mul

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

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

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

        public Vector3L mul​(long x,
                            long y,
                            long 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 Vector3L mul​(long x,
                            long y,
                            long z,
                            Vector3L dest)
        Description copied from interface: Vector3Lc
        Multiply the components of this vector by the given values and store the result in dest.
        Specified by:
        mul in interface Vector3Lc
        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 Vector3L div​(float scalar)
        Divide all components of this vector by the given scalar value.
        Parameters:
        scalar - the scalar to divide by
        Returns:
        this
      • div

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

        public Vector3L div​(long scalar)
        Divide all components of this vector by the given scalar value.
        Parameters:
        scalar - the scalar to divide by
        Returns:
        this
      • div

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

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

        public static long lengthSquared​(long x,
                                         long y,
                                         long 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: Vector3Lc
        Return the length of this vector.
        Specified by:
        length in interface Vector3Lc
        Returns:
        the length
      • length

        public static double length​(long x,
                                    long y,
                                    long 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​(Vector3Lc v)
        Description copied from interface: Vector3Lc
        Return the distance between this Vector and v.
        Specified by:
        distance in interface Vector3Lc
        Parameters:
        v - the other vector
        Returns:
        the distance
      • distance

        public double distance​(long x,
                               long y,
                               long z)
        Description copied from interface: Vector3Lc
        Return the distance between this vector and (x, y, z).
        Specified by:
        distance in interface Vector3Lc
        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​(Vector3Lc v)
        Description copied from interface: Vector3Lc
        Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
        Specified by:
        gridDistance in interface Vector3Lc
        Parameters:
        v - the other vector
        Returns:
        the grid distance
      • gridDistance

        public long gridDistance​(long x,
                                 long y,
                                 long z)
        Description copied from interface: Vector3Lc
        Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) (x, y).
        Specified by:
        gridDistance in interface Vector3Lc
        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​(Vector3Lc v)
        Description copied from interface: Vector3Lc
        Return the square of the distance between this vector and v.
        Specified by:
        distanceSquared in interface Vector3Lc
        Parameters:
        v - the other vector
        Returns:
        the squared of the distance
      • distanceSquared

        public long distanceSquared​(long x,
                                    long y,
                                    long z)
        Description copied from interface: Vector3Lc
        Return the square of the distance between this vector and (x, y, z).
        Specified by:
        distanceSquared in interface Vector3Lc
        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​(long x1,
                                      long y1,
                                      long z1,
                                      long x2,
                                      long y2,
                                      long 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​(long x1,
                                           long y1,
                                           long z1,
                                           long x2,
                                           long y2,
                                           long 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 Vector3L zero()
        Set all components to zero.
        Returns:
        this
      • toString

        public java.lang.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 java.lang.Object
        Returns:
        the string representation
      • toString

        public java.lang.String toString​(java.text.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​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • negate

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

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

        public Vector3L min​(Vector3Lc 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 Vector3L min​(Vector3Lc v,
                            Vector3L dest)
        Description copied from interface: Vector3Lc
        Set the components of dest to be the component-wise minimum of this and the other vector.
        Specified by:
        min in interface Vector3Lc
        Parameters:
        v - the other vector
        dest - will hold the result
        Returns:
        dest
      • max

        public Vector3L max​(Vector3Lc 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 Vector3L max​(Vector3Lc v,
                            Vector3L dest)
        Description copied from interface: Vector3Lc
        Set the components of dest to be the component-wise maximum of this and the other vector.
        Specified by:
        max in interface Vector3Lc
        Parameters:
        v - the other vector
        dest - will hold the result
        Returns:
        dest
      • maxComponent

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

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

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

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

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

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

        public boolean equals​(long x,
                              long y,
                              long z)
        Description copied from interface: Vector3Lc
        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 Vector3Lc
        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 java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException