public class Vector3i extends Object implements Externalizable, Vector3ic
| Modifier and Type | Field and Description |
|---|---|
int |
x
The x component of the vector.
|
int |
y
The y component of the vector.
|
int |
z
The z component of the vector.
|
| Constructor and Description |
|---|
Vector3i()
Create a new
Vector3i of (0, 0, 0). |
Vector3i(ByteBuffer buffer)
Create a new
Vector3i and read this vector from the supplied
ByteBuffer at the current buffer
position. |
Vector3i(int d)
Create a new
Vector3i and initialize all three components with
the given value. |
Vector3i(IntBuffer buffer)
|
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)
|
Vector3i(int x,
int y,
int z)
Create a new
Vector3i with the given component values. |
Vector3i(Vector2ic v,
int z)
|
Vector3i(Vector3ic v)
Create a new
Vector3i with the same values as v. |
| Modifier and Type | Method and Description |
|---|---|
Vector3i |
add(int x,
int y,
int z)
Increment the components of this vector by the given values.
|
Vector3i |
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. |
Vector3i |
add(Vector3ic v)
Add the supplied vector to this one.
|
Vector3i |
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 |
distance(Vector3ic v)
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 |
distanceSquared(Vector3ic v)
Return the square of the distance between this vector and
v. |
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) |
ByteBuffer |
get(ByteBuffer buffer)
Store this vector into the supplied
ByteBuffer at the current
buffer position. |
int |
get(int component)
Get the value of the specified component of this vector.
|
IntBuffer |
get(IntBuffer buffer)
|
ByteBuffer |
get(int index,
ByteBuffer buffer)
Store this vector into the supplied
ByteBuffer starting at the
specified absolute buffer position/index. |
IntBuffer |
get(int index,
IntBuffer buffer)
Store this vector into the supplied
IntBuffer starting at the
specified absolute buffer position/index. |
long |
gridDistance(int x,
int y,
int z)
(non-Javadoc)
|
long |
gridDistance(Vector3ic v)
(non-Javadoc)
|
int |
hashCode() |
double |
length()
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 |
lengthSquared()
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.
|
Vector3i |
max(Vector3ic v)
Set the components of this vector to be the component-wise maximum of this and the other vector.
|
Vector3i |
max(Vector3ic v,
Vector3i 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.
|
Vector3i |
min(Vector3ic v)
Set the components of this vector to be the component-wise minimum of this and the other vector.
|
Vector3i |
min(Vector3ic v,
Vector3i 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.
|
Vector3i |
mul(int scalar)
Multiply all components of this
Vector3i by the given scalar
value. |
Vector3i |
mul(int x,
int y,
int z)
Multiply the components of this vector by the given values.
|
Vector3i |
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. |
Vector3i |
mul(int scalar,
Vector3i dest)
Multiply the components of this vector by the given scalar and store the result in
dest. |
Vector3i |
mul(Vector3ic v)
Multiply all components of this
Vector3i by the given vector. |
Vector3i |
mul(Vector3ic v,
Vector3i dest)
Multiply the supplied vector by this one and store the result in
dest. |
Vector3i |
negate()
Negate this vector.
|
Vector3i |
negate(Vector3i dest)
Negate this vector and store the result in
dest. |
void |
readExternal(ObjectInput in) |
Vector3i |
set(ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer at the current
buffer position. |
Vector3i |
set(int d)
Set the x, y, and z components to the supplied value.
|
Vector3i |
set(IntBuffer buffer)
|
Vector3i |
set(int index,
ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer starting at the
specified absolute buffer position/index. |
Vector3i |
set(int index,
IntBuffer buffer)
Read this vector from the supplied
IntBuffer starting at the
specified absolute buffer position/index. |
Vector3i |
set(int x,
int y,
int z)
Set the x, y and z components to the supplied values.
|
Vector3i |
set(Vector2ic v,
int z)
Set the first two components from the given
v and the z
component from the given z |
Vector3i |
set(Vector3dc v)
Set the x, y and z components to match the supplied vector.
|
Vector3i |
set(Vector3ic v)
Set the x, y and z components to match the supplied vector.
|
Vector3i |
setComponent(int component,
int value)
Set the value of the specified component of this vector.
|
Vector3i |
sub(int x,
int y,
int z)
Decrement the components of this vector by the given values.
|
Vector3i |
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. |
Vector3i |
sub(Vector3ic v)
Subtract the supplied vector from this one and store the result in
this. |
Vector3i |
sub(Vector3ic v,
Vector3i dest)
Subtract the supplied vector from this one and store the result in
dest. |
String |
toString()
Return a string representation of this vector.
|
String |
toString(NumberFormat formatter)
Return a string representation of this vector by formatting the vector components with the given
NumberFormat. |
void |
writeExternal(ObjectOutput out) |
int |
x() |
int |
y() |
int |
z() |
Vector3i |
zero()
Set all components to zero.
|
public int x
public int y
public int z
public Vector3i()
Vector3i of (0, 0, 0).public Vector3i(int d)
Vector3i and initialize all three components with
the given value.d - the value of all three componentspublic Vector3i(int x,
int y,
int z)
Vector3i with the given component values.x - the value of xy - the value of yz - the value of zpublic Vector3i(Vector3ic v)
Vector3i with the same values as v.v - the Vector3ic to copy the values frompublic Vector3i(Vector2ic v, int z)
v - the Vector2ic to copy the values fromz - the z componentpublic Vector3i(ByteBuffer buffer)
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.
buffer - values will be read in x, y, z orderVector3i(int, ByteBuffer)public Vector3i(int index,
ByteBuffer buffer)
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.
index - the absolute position into the ByteBufferbuffer - values will be read in x, y, z orderpublic Vector3i(IntBuffer buffer)
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.
buffer - values will be read in x, y, z orderVector3i(int, IntBuffer)public Vector3i(int index,
IntBuffer buffer)
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.
index - the absolute position into the IntBufferbuffer - values will be read in x, y, z orderpublic Vector3i set(Vector3ic v)
v - contains the values of x, y and z to setpublic Vector3i set(Vector3dc v)
Note that due to the given vector v storing the components
in double-precision, there is the possibility to lose precision.
v - contains the values of x, y and z to setpublic Vector3i set(Vector2ic v, int z)
v and the z
component from the given zv - the Vector2ic to copy the values fromz - the z componentpublic Vector3i set(int d)
d - the value of all three componentspublic Vector3i set(int x, int y, int z)
x - the x componenty - the y componentz - the z componentpublic Vector3i set(ByteBuffer buffer)
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.
buffer - values will be read in x, y, z orderset(int, ByteBuffer)public Vector3i set(int index, ByteBuffer buffer)
ByteBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
index - the absolute position into the ByteBufferbuffer - values will be read in x, y, z orderpublic Vector3i set(IntBuffer buffer)
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.
buffer - values will be read in x, y, z orderset(int, IntBuffer)public Vector3i set(int index, IntBuffer buffer)
IntBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given IntBuffer.
index - the absolute position into the IntBufferbuffer - values will be read in x, y, z orderpublic int get(int component)
throws IllegalArgumentException
Vector3icget in interface Vector3iccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public Vector3i setComponent(int component, int value) throws IllegalArgumentException
component - the component whose value to set, within [0..2]value - the value to setIllegalArgumentException - if component is not within [0..2]public IntBuffer get(IntBuffer buffer)
Vector3icIntBuffer 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.
get in interface Vector3icbuffer - will receive the values of this vector in x, y, z orderVector3ic.get(int, IntBuffer)public IntBuffer get(int index, IntBuffer buffer)
Vector3icIntBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given IntBuffer.
public ByteBuffer get(ByteBuffer buffer)
Vector3icByteBuffer 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.
get in interface Vector3icbuffer - will receive the values of this vector in x, y, z orderVector3ic.get(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
Vector3icByteBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
public Vector3i sub(Vector3ic v)
this.v - the vector to subtractpublic Vector3i sub(Vector3ic v, Vector3i dest)
Vector3icdest.public Vector3i sub(int x, int y, int z)
x - the x component to subtracty - the y component to subtractz - the z component to subtractpublic Vector3i sub(int x, int y, int z, Vector3i dest)
Vector3icdest.public Vector3i add(Vector3ic v)
v - the vector to addpublic Vector3i add(Vector3ic v, Vector3i dest)
Vector3icdest.public Vector3i add(int x, int y, int z)
x - the x component to addy - the y component to addz - the z component to addpublic Vector3i add(int x, int y, int z, Vector3i dest)
Vector3icdest.public Vector3i mul(int scalar)
Vector3i by the given scalar
value.scalar - the scalar to multiply this vector bypublic Vector3i mul(int scalar, Vector3i dest)
Vector3icdest.public Vector3i mul(Vector3ic v)
Vector3i by the given vector.v - the vector to multiplypublic Vector3i mul(Vector3ic v, Vector3i dest)
Vector3icdest.public Vector3i mul(int x, int y, int z)
x - the x component to multiplyy - the y component to multiplyz - the z component to multiplypublic Vector3i mul(int x, int y, int z, Vector3i dest)
Vector3icdest.public long lengthSquared()
Vector3iclengthSquared in interface Vector3icpublic static long lengthSquared(int x,
int y,
int z)
x - The vector's x componenty - The vector's y componentz - The vector's z componentpublic double length()
Vector3icpublic static double length(int x,
int y,
int z)
x - The vector's x componenty - The vector's y componentz - The vector's z componentpublic double distance(Vector3ic v)
Vector3icv.public double distance(int x,
int y,
int z)
Vector3icthis vector and (x, y, z).public long gridDistance(Vector3ic v)
gridDistance in interface Vector3icv - the other vectorVector3ic.gridDistance(org.joml.Vector3ic)public long gridDistance(int x,
int y,
int z)
gridDistance in interface Vector3icx - the x component of the other vectory - the y component of the other vectorz - the y component of the other vectorVector3ic.gridDistance(org.joml.Vector3ic)public long distanceSquared(Vector3ic v)
Vector3icv.distanceSquared in interface Vector3icv - the other vectorpublic long distanceSquared(int x,
int y,
int z)
Vector3icthis vector and (x, y, z).distanceSquared in interface Vector3icx - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorpublic static double distance(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
(x1, y1, z1) and (x2, y2, z2).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 vectorpublic static long distanceSquared(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
(x1, y1, z1) and (x2, y2, z2).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 vectorpublic Vector3i zero()
public String toString()
This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the vector components withpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic Vector3i negate()
public Vector3i negate(Vector3i dest)
Vector3icdest.public Vector3i min(Vector3ic v)
v - the other vectorpublic Vector3i min(Vector3ic v, Vector3i dest)
Vector3icdest to be the component-wise minimum of this and the other vector.public Vector3i max(Vector3ic v)
v - the other vectorpublic Vector3i max(Vector3ic v, Vector3i dest)
Vector3icdest to be the component-wise maximum of this and the other vector.public int maxComponent()
Vector3icmaxComponent in interface Vector3ic[0..2]public int minComponent()
Vector3icminComponent in interface Vector3ic[0..2]public boolean equals(int x,
int y,
int z)
Vector3icthis vector with the given (x, y, z)
and return whether all of them are equal.Copyright © 2015–2019 JOML. All rights reserved.