Class Vector3i
- java.lang.Object
-
- org.joml.Vector3i
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,Vector3ic
public class Vector3i extends java.lang.Object implements java.io.Externalizable, java.lang.Cloneable, Vector3ic
Contains the definition of a Vector comprising 3 ints and associated transformations.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Vector3i()Create a newVector3iof(0, 0, 0).Vector3i(double x, double y, double z, int mode)Create a newVector3iwith the given component values and round using the givenRoundingMode.Vector3i(float x, float y, float z, int mode)Create a newVector3iwith the given component values and round using the givenRoundingMode.Vector3i(int d)Create a newVector3iand initialize all three components with the given value.Vector3i(int[] xyz)Create a newVector3iand initialize its three components from the first three elements of the given array.Vector3i(int x, int y, int z)Create a newVector3iwith the given component values.Vector3i(int index, java.nio.ByteBuffer buffer)Create a newVector3iand read this vector from the suppliedByteBufferstarting at the specified absolute buffer position/index.Vector3i(int index, java.nio.IntBuffer buffer)Create a newVector3iand read this vector from the suppliedIntBufferstarting at the specified absolute buffer position/index.Vector3i(java.nio.ByteBuffer buffer)Create a newVector3iand read this vector from the suppliedByteBufferat the current bufferposition.Vector3i(java.nio.IntBuffer buffer)Create a newVector3iand read this vector from the suppliedIntBufferat the current bufferposition.Vector3i(Vector2dc v, float z, int mode)Create a newVector3iwith the first two components from the givenvand the givenzand round using the givenRoundingMode.Vector3i(Vector2fc v, float z, int mode)Create a newVector3iwith the first two components from the givenvand the givenzand round using the givenRoundingMode.Vector3i(Vector2ic v, int z)Vector3i(Vector3dc v, int mode)Create a newVector3iand initialize its components to the rounded value of the given vector.Vector3i(Vector3fc v, int mode)Create a newVector3iand initialize its components to the rounded value of the given vector.Vector3i(Vector3ic v)Create a newVector3iwith the same values asv.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3iabsolute()Setthisvector's components to their respective absolute values.Vector3iabsolute(Vector3i dest)Compute the absolute of each of this vector's components and store the result intodest.Vector3iadd(int x, int y, int z)Increment the components of this vector by the given values.Vector3iadd(int x, int y, int z, Vector3i dest)Increment the components of this vector by the given values and store the result indest.Vector3iadd(Vector3ic v)Add the supplied vector to this one.Vector3iadd(Vector3ic v, Vector3i dest)Add the supplied vector to this one and store the result indest.java.lang.Objectclone()doubledistance(int x, int y, int z)Return the distance betweenthisvector and(x, y, z).static doubledistance(int x1, int y1, int z1, int x2, int y2, int z2)Return the distance between(x1, y1, z1)and(x2, y2, z2).doubledistance(Vector3ic v)Return the distance between this Vector andv.longdistanceSquared(int x, int y, int z)Return the square of the distance betweenthisvector and(x, y, z).static longdistanceSquared(int x1, int y1, int z1, int x2, int y2, int z2)Return the squared distance between(x1, y1, z1)and(x2, y2, z2).longdistanceSquared(Vector3ic v)Return the square of the distance between this vector andv.Vector3idiv(float scalar)Divide all components of this vector by the given scalar value.Vector3idiv(float scalar, Vector3i dest)Divide all components of this vector by the given scalar value and store the result indest.Vector3idiv(int scalar)Divide all components of this vector by the given scalar value.Vector3idiv(int scalar, Vector3i dest)Divide all components of this vector by the given scalar value and store the result indest.booleanequals(int x, int y, int z)Compare the vector components ofthisvector with the given(x, y, z)and return whether all of them are equal.booleanequals(java.lang.Object obj)intget(int component)Get the value of the specified component of this vector.java.nio.ByteBufferget(int index, java.nio.ByteBuffer buffer)Store this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.IntBufferget(int index, java.nio.IntBuffer buffer)Store this vector into the suppliedIntBufferstarting at the specified absolute buffer position/index.java.nio.ByteBufferget(java.nio.ByteBuffer buffer)Store this vector into the suppliedByteBufferat the current bufferposition.java.nio.IntBufferget(java.nio.IntBuffer buffer)Store this vector into the suppliedIntBufferat the current bufferposition.Vector3icgetToAddress(long address)Store this vector at the given off-heap memory address.longgridDistance(int x, int y, int z)Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).longgridDistance(Vector3ic v)Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).inthashCode()doublelength()Return the length of this vector.static doublelength(int x, int y, int z)Get the length of a 3-dimensional single-precision vector.longlengthSquared()Return the length squared of this vector.static longlengthSquared(int x, int y, int z)Get the length squared of a 3-dimensional single-precision vector.Vector3imax(Vector3ic v)Set the components of this vector to be the component-wise maximum of this and the other vector.Vector3imax(Vector3ic v, Vector3i dest)Set the components ofdestto be the component-wise maximum of this and the other vector.intmaxComponent()Determine the component with the biggest absolute value.Vector3imin(Vector3ic v)Set the components of this vector to be the component-wise minimum of this and the other vector.Vector3imin(Vector3ic v, Vector3i dest)Set the components ofdestto be the component-wise minimum of this and the other vector.intminComponent()Determine the component with the smallest (towards zero) absolute value.Vector3imul(int scalar)Multiply all components of this vector by the given scalar value.Vector3imul(int x, int y, int z)Multiply the components of this vector by the given values.Vector3imul(int x, int y, int z, Vector3i dest)Multiply the components of this vector by the given values and store the result indest.Vector3imul(int scalar, Vector3i dest)Multiply the components of this vector by the given scalar and store the result indest.Vector3imul(Vector3ic v)Multiply all components of this vector by the given vector.Vector3imul(Vector3ic v, Vector3i dest)Multiply the supplied vector by this one and store the result indest.Vector3inegate()Negate this vector.Vector3inegate(Vector3i dest)Negate this vector and store the result indest.voidreadExternal(java.io.ObjectInput in)Vector3iset(int d)Set the x, y, and z components to the supplied value.Vector3iset(int[] xyz)Set the three components of this vector to the first three elements of the given array.Vector3iset(int x, int y, int z)Set the x, y and z components to the supplied values.Vector3iset(int index, java.nio.ByteBuffer buffer)Read this vector from the suppliedByteBufferstarting at the specified absolute buffer position/index.Vector3iset(int index, java.nio.IntBuffer buffer)Read this vector from the suppliedIntBufferstarting at the specified absolute buffer position/index.Vector3iset(java.nio.ByteBuffer buffer)Read this vector from the suppliedByteBufferat the current bufferposition.Vector3iset(java.nio.IntBuffer buffer)Read this vector from the suppliedIntBufferat the current bufferposition.Vector3iset(Vector2ic v, int z)Set the first two components from the givenvand the z component from the givenzVector3iset(Vector3dc v)Set this vector to the values of v usingRoundingMode.TRUNCATErounding.Vector3iset(Vector3dc v, int mode)Set this vector to the values of v using the givenRoundingMode.Vector3iset(Vector3fc v, int mode)Set this vector to the values of v using the givenRoundingMode.Vector3iset(Vector3ic v)Set the x, y and z components to match the supplied vector.Vector3isetComponent(int component, int value)Set the value of the specified component of this vector.Vector3isetFromAddress(long address)Set the values of this vector by reading 3 integer values from off-heap memory, starting at the given address.Vector3isub(int x, int y, int z)Decrement the components of this vector by the given values.Vector3isub(int x, int y, int z, Vector3i dest)Decrement the components of this vector by the given values and store the result indest.Vector3isub(Vector3ic v)Subtract the supplied vector from this one and store the result inthis.Vector3isub(Vector3ic v, Vector3i dest)Subtract the supplied vector from this one and store the result indest.java.lang.StringtoString()Return a string representation of this vector.java.lang.StringtoString(java.text.NumberFormat formatter)Return a string representation of this vector by formatting the vector components with the givenNumberFormat.voidwriteExternal(java.io.ObjectOutput out)intx()Vector2dxy(Vector2d dest)Copy the(x, y)components ofthisinto the supplieddestvector and return it.Vector2fxy(Vector2f dest)Copy the(x, y)components ofthisinto the supplieddestvector and return it.Vector2ixy(Vector2i dest)Copy the(x, y)components ofthisinto the supplieddestvector and return it.Vector2Lxy(Vector2L dest)Copy the(x, y)components ofthisinto the supplieddestvector and return it.inty()intz()Vector3izero()Set all components to zero.
-
-
-
Constructor Detail
-
Vector3i
public Vector3i()
Create a newVector3iof(0, 0, 0).
-
Vector3i
public Vector3i(int d)
Create a newVector3iand 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 newVector3iwith the given component values.- Parameters:
x- the value of xy- the value of yz- the value of z
-
Vector3i
public Vector3i(Vector3ic v)
Create a newVector3iwith the same values asv.- Parameters:
v- theVector3icto copy the values from
-
Vector3i
public Vector3i(Vector2ic v, int z)
- Parameters:
v- theVector2icto copy the values fromz- the z component
-
Vector3i
public Vector3i(float x, float y, float z, int mode)Create a newVector3iwith the given component values and round using the givenRoundingMode.- Parameters:
x- the value of xy- the value of yz- the value of zmode- theRoundingModeto use
-
Vector3i
public Vector3i(double x, double y, double z, int mode)Create a newVector3iwith the given component values and round using the givenRoundingMode.- Parameters:
x- the value of xy- the value of yz- the value of zmode- theRoundingModeto use
-
Vector3i
public Vector3i(Vector2fc v, float z, int mode)
Create a newVector3iwith the first two components from the givenvand the givenzand round using the givenRoundingMode.- Parameters:
v- theVector2fcto copy the values fromz- the z componentmode- theRoundingModeto use
-
Vector3i
public Vector3i(Vector3fc v, int mode)
Create a newVector3iand initialize its components to the rounded value of the given vector.- Parameters:
v- theVector3fcto round and copy the values frommode- theRoundingModeto use
-
Vector3i
public Vector3i(Vector2dc v, float z, int mode)
Create a newVector3iwith the first two components from the givenvand the givenzand round using the givenRoundingMode.- Parameters:
v- theVector2dcto copy the values fromz- the z componentmode- theRoundingModeto use
-
Vector3i
public Vector3i(Vector3dc v, int mode)
Create a newVector3iand initialize its components to the rounded value of the given vector.- Parameters:
v- theVector3dcto round and copy the values frommode- theRoundingModeto use
-
Vector3i
public Vector3i(int[] xyz)
Create a newVector3iand 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(java.nio.ByteBuffer buffer)
Create a newVector3iand read this vector from the suppliedByteBufferat the current bufferposition.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 inx, y, zorder- See Also:
Vector3i(int, ByteBuffer)
-
Vector3i
public Vector3i(int index, java.nio.ByteBuffer buffer)Create a newVector3iand read this vector from the suppliedByteBufferstarting 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 ByteBufferbuffer- values will be read inx, y, zorder
-
Vector3i
public Vector3i(java.nio.IntBuffer buffer)
Create a newVector3iand read this vector from the suppliedIntBufferat the current bufferposition.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 inx, y, zorder- See Also:
Vector3i(int, IntBuffer)
-
Vector3i
public Vector3i(int index, java.nio.IntBuffer buffer)Create a newVector3iand read this vector from the suppliedIntBufferstarting 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 IntBufferbuffer- values will be read inx, y, zorder
-
-
Method Detail
-
xy
public Vector2f xy(Vector2f dest)
Copy the(x, y)components ofthisinto the supplieddestvector and return it.- Parameters:
dest- will hold the result- Returns:
- dest
-
xy
public Vector2d xy(Vector2d dest)
Copy the(x, y)components ofthisinto the supplieddestvector and return it.- Parameters:
dest- will hold the result- Returns:
- dest
-
xy
public Vector2i xy(Vector2i dest)
Copy the(x, y)components ofthisinto the supplieddestvector and return it.- Parameters:
dest- will hold the result- Returns:
- dest
-
xy
public Vector2L xy(Vector2L dest)
Copy the(x, y)components ofthisinto the supplieddestvector and return it.- Parameters:
dest- will hold the result- Returns:
- dest
-
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 vector to the values of v usingRoundingMode.TRUNCATErounding.Note that due to the given vector
vstoring 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 vector to the values of v using the givenRoundingMode.Note that due to the given vector
vstoring the components in double-precision, there is the possibility to lose precision.- Parameters:
v- the vector to copy frommode- theRoundingModeto use- Returns:
- this
-
set
public Vector3i set(Vector3fc v, int mode)
Set this vector to the values of v using the givenRoundingMode.Note that due to the given vector
vstoring the components in double-precision, there is the possibility to lose precision.- Parameters:
v- the vector to copy frommode- theRoundingModeto use- Returns:
- this
-
set
public Vector3i set(Vector2ic v, int z)
Set the first two components from the givenvand the z component from the givenz- Parameters:
v- theVector2icto copy the values fromz- 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 componenty- the y componentz- 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(java.nio.ByteBuffer buffer)
Read this vector from the suppliedByteBufferat the current bufferposition.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 inx, y, zorder- Returns:
- this
- See Also:
set(int, ByteBuffer)
-
set
public Vector3i set(int index, java.nio.ByteBuffer buffer)
Read this vector from the suppliedByteBufferstarting 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 ByteBufferbuffer- values will be read inx, y, zorder- Returns:
- this
-
set
public Vector3i set(java.nio.IntBuffer buffer)
Read this vector from the suppliedIntBufferat the current bufferposition.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 inx, y, zorder- Returns:
- this
- See Also:
set(int, IntBuffer)
-
set
public Vector3i set(int index, java.nio.IntBuffer buffer)
Read this vector from the suppliedIntBufferstarting 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 IntBufferbuffer- values will be read inx, y, zorder- 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
UnsupportedOperationExceptionwhen 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 java.lang.IllegalArgumentExceptionDescription copied from interface:Vector3icGet the value of the specified component of this vector.
-
setComponent
public Vector3i 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- ifcomponentis not within[0..2]
-
get
public java.nio.IntBuffer get(java.nio.IntBuffer buffer)
Description copied from interface:Vector3icStore this vector into the suppliedIntBufferat the current bufferposition.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:
getin interfaceVector3ic- Parameters:
buffer- will receive the values of this vector inx, y, zorder- Returns:
- the passed in buffer
- See Also:
Vector3ic.get(int, IntBuffer)
-
get
public java.nio.IntBuffer get(int index, java.nio.IntBuffer buffer)Description copied from interface:Vector3icStore this vector into the suppliedIntBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given IntBuffer.
-
get
public java.nio.ByteBuffer get(java.nio.ByteBuffer buffer)
Description copied from interface:Vector3icStore this vector into the suppliedByteBufferat the current bufferposition.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:
getin interfaceVector3ic- Parameters:
buffer- will receive the values of this vector inx, y, zorder- Returns:
- the passed in buffer
- See Also:
Vector3ic.get(int, ByteBuffer)
-
get
public java.nio.ByteBuffer get(int index, java.nio.ByteBuffer buffer)Description copied from interface:Vector3icStore this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
-
getToAddress
public Vector3ic getToAddress(long address)
Description copied from interface:Vector3icStore this vector at the given off-heap memory address.This method will throw an
UnsupportedOperationExceptionwhen 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:
getToAddressin interfaceVector3ic- 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 inthis.- Parameters:
v- the vector to subtract- Returns:
- this
-
sub
public Vector3i sub(Vector3ic v, Vector3i dest)
Description copied from interface:Vector3icSubtract the supplied vector from this one and store the result indest.
-
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 subtracty- the y component to subtractz- the z component to subtract- Returns:
- this
-
sub
public Vector3i sub(int x, int y, int z, Vector3i dest)
Description copied from interface:Vector3icDecrement the components of this vector by the given values and store the result indest.
-
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:Vector3icAdd the supplied vector to this one and store the result indest.
-
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 addy- the y component to addz- the z component to add- Returns:
- this
-
add
public Vector3i add(int x, int y, int z, Vector3i dest)
Description copied from interface:Vector3icIncrement the components of this vector by the given values and store the result indest.
-
mul
public Vector3i mul(int 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 Vector3i mul(int scalar, Vector3i dest)
Description copied from interface:Vector3icMultiply the components of this vector by the given scalar and store the result indest.
-
mul
public Vector3i mul(Vector3ic v)
Multiply all components of this vector by the given vector.- Parameters:
v- the vector to multiply- Returns:
- this
-
mul
public Vector3i mul(Vector3ic v, Vector3i dest)
Description copied from interface:Vector3icMultiply the supplied vector by this one and store the result indest.
-
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 multiplyy- the y component to multiplyz- the z component to multiply- Returns:
- this
-
mul
public Vector3i mul(int x, int y, int z, Vector3i dest)
Description copied from interface:Vector3icMultiply the components of this vector by the given values and store the result indest.
-
div
public Vector3i 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 Vector3i div(float scalar, Vector3i dest)
Description copied from interface:Vector3icDivide all components of this vector by the given scalar value and store the result indest.
-
div
public Vector3i div(int scalar)
Divide all components of this vector 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:Vector3icDivide all components of this vector by the given scalar value and store the result indest.
-
lengthSquared
public long lengthSquared()
Description copied from interface:Vector3icReturn the length squared of this vector.- Specified by:
lengthSquaredin interfaceVector3ic- 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 componenty- The vector's y componentz- The vector's z component- Returns:
- the length squared of the given vector
-
length
public double length()
Description copied from interface:Vector3icReturn the length of this vector.
-
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 componenty- The vector's y componentz- The vector's z component- Returns:
- the length squared of the given vector
-
distance
public double distance(Vector3ic v)
Description copied from interface:Vector3icReturn the distance between this Vector andv.
-
distance
public double distance(int x, int y, int z)Description copied from interface:Vector3icReturn the distance betweenthisvector and(x, y, z).
-
gridDistance
public long gridDistance(Vector3ic v)
Description copied from interface:Vector3icReturn the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).- Specified by:
gridDistancein interfaceVector3ic- Parameters:
v- the other vector- Returns:
- the grid distance
-
gridDistance
public long gridDistance(int x, int y, int z)Description copied from interface:Vector3icReturn the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).- Specified by:
gridDistancein interfaceVector3ic- Parameters:
x- the x component of the other vectory- the y component of the other vectorz- the y component of the other vector- Returns:
- the grid distance
-
distanceSquared
public long distanceSquared(Vector3ic v)
Description copied from interface:Vector3icReturn the square of the distance between this vector andv.- Specified by:
distanceSquaredin interfaceVector3ic- 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:Vector3icReturn the square of the distance betweenthisvector and(x, y, z).- Specified by:
distanceSquaredin interfaceVector3ic- Parameters:
x- the x component of the other vectory- the y component of the other vectorz- 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 vectory1- the y component of the first vectorz1- the z component of the first vectorx2- the x component of the second vectory2- the y component of the second vectorz2- 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 vectory1- the y component of the first vectorz1- the z component of the first vectorx2- the x component of the second vectory2- the y component of the second vectorz2- 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 java.lang.String toString()
Return a string representation of this vector.This method creates a new
DecimalFormaton every invocation with the format string "0.000E0;-".- Overrides:
toStringin classjava.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 givenNumberFormat.- Parameters:
formatter- theNumberFormatused to format the vector components with- Returns:
- the string representation
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
negate
public Vector3i negate()
Negate this vector.- Returns:
- this
-
negate
public Vector3i negate(Vector3i dest)
Description copied from interface:Vector3icNegate this vector and store the result indest.
-
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:Vector3icSet the components ofdestto be the component-wise minimum of this and the other vector.
-
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:Vector3icSet the components ofdestto be the component-wise maximum of this and the other vector.
-
maxComponent
public int maxComponent()
Description copied from interface:Vector3icDetermine the component with the biggest absolute value.- Specified by:
maxComponentin interfaceVector3ic- Returns:
- the component index, within
[0..2]
-
minComponent
public int minComponent()
Description copied from interface:Vector3icDetermine the component with the smallest (towards zero) absolute value.- Specified by:
minComponentin interfaceVector3ic- Returns:
- the component index, within
[0..2]
-
absolute
public Vector3i absolute()
Setthisvector's components to their respective absolute values.- Returns:
- this
-
absolute
public Vector3i absolute(Vector3i dest)
Description copied from interface:Vector3icCompute the absolute of each of this vector's components and store the result intodest.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
equals
public boolean equals(int x, int y, int z)Description copied from interface:Vector3icCompare the vector components ofthisvector with the given(x, y, z)and return whether all of them are equal.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-