public class Vector4i extends Object implements Externalizable, Vector4ic
| Modifier and Type | Field and Description |
|---|---|
int |
w
The w component of the vector.
|
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 |
|---|
Vector4i()
Create a new
Vector4i of (0, 0, 0, 1). |
Vector4i(ByteBuffer buffer)
Create a new
Vector4i and read this vector from the supplied
ByteBuffer at the current buffer
position. |
Vector4i(int s)
Create a new
Vector4i and initialize all four components with the
given value. |
Vector4i(IntBuffer buffer)
|
Vector4i(int index,
ByteBuffer buffer)
Create a new
Vector4i and read this vector from the supplied
ByteBuffer starting at the specified absolute buffer
position/index. |
Vector4i(int index,
IntBuffer buffer)
|
Vector4i(int x,
int y,
int z,
int w)
Create a new
Vector4i with the given component values. |
Vector4i(Vector2ic v,
int z,
int w)
|
Vector4i(Vector3ic v,
int w)
|
Vector4i(Vector4ic v)
Create a new
Vector4i with the same values as v. |
| Modifier and Type | Method and Description |
|---|---|
Vector4i |
add(int x,
int y,
int z,
int w)
Increment the components of this vector by the given values.
|
Vector4i |
add(int x,
int y,
int z,
int w,
Vector4i dest)
Increment the components of this vector by the given values and store the
result in
dest. |
Vector4i |
add(Vector4ic v)
Add the supplied vector to this one.
|
Vector4i |
add(Vector4ic v,
Vector4i dest)
Add the supplied vector to this one and store the result in
dest. |
double |
distance(int x,
int y,
int z,
int w)
Return the distance between
this vector and (x, y, z, w). |
static double |
distance(int x1,
int y1,
int z1,
int w1,
int x2,
int y2,
int z2,
int w2)
Return the distance between
(x1, y1, z1, w1) and (x2, y2, z2, w2). |
double |
distance(Vector4ic v)
Return the distance between this Vector and
v. |
int |
distanceSquared(int x,
int y,
int z,
int w)
Return the square of the distance between
this vector and
(x, y, z, w). |
static long |
distanceSquared(int x1,
int y1,
int z1,
int w1,
int x2,
int y2,
int z2,
int w2)
Return the squared distance between
(x1, y1, z1, w1) and (x2, y2, z2, w2). |
int |
distanceSquared(Vector4ic v)
Return the square of the distance between this vector and
v. |
Vector4i |
div(float scalar,
Vector4i dest)
Divide all components of this
Vector4i by the given scalar value
and store the result in dest. |
Vector4i |
div(int scalar)
Divide all components of this
Vector4i by the given scalar value. |
Vector4i |
div(Vector4ic v)
Divide this Vector4i component-wise by another Vector4i.
|
Vector4i |
div(Vector4ic v,
Vector4i dest)
Divide this Vector4i component-wise by another Vector4ic and store the
result in
dest. |
int |
dot(Vector4ic v)
Compute the dot product (inner product) of this vector and
v. |
boolean |
equals(int x,
int y,
int z,
int w)
Compare the vector components of
this vector with the given (x, y, z, w)
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,
int w)
Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)
(x, y). |
long |
gridDistance(Vector4ic 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(int x,
int y,
int z,
int w)
Get the length of a 4-dimensional single-precision vector.
|
long |
lengthSquared()
Return the length squared of this vector.
|
static long |
lengthSquared(int x,
int y,
int z,
int w)
Get the length squared of a 4-dimensional single-precision vector.
|
Vector4i |
max(Vector4ic v)
Set the components of this vector to be the component-wise maximum of this and the other vector.
|
Vector4i |
max(Vector4ic v,
Vector4i 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.
|
Vector4i |
min(Vector4ic v)
Set the components of this vector to be the component-wise minimum of this and the other vector.
|
Vector4i |
min(Vector4ic v,
Vector4i 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.
|
Vector4i |
mul(int scalar)
Multiply all components of this
Vector4i by the given scalar
value. |
Vector4i |
mul(int scalar,
Vector4i dest)
Multiply all components of this
Vector4i by the given scalar
value and store the result in dest. |
Vector4i |
mul(Vector4ic v)
Multiply this Vector4i component-wise by another Vector4i.
|
Vector4i |
mul(Vector4ic v,
Vector4i dest)
Multiply this Vector4i component-wise by another Vector4ic and store the
result in
dest. |
Vector4i |
negate()
Negate this vector.
|
Vector4i |
negate(Vector4i dest)
Negate this vector and store the result in
dest. |
void |
readExternal(ObjectInput in) |
Vector4i |
set(ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer at the current
buffer position. |
Vector4i |
set(int s)
Set the x, y, z, and w components to the supplied value.
|
Vector4i |
set(IntBuffer buffer)
|
Vector4i |
set(int index,
ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer starting at the
specified absolute buffer position/index. |
Vector4i |
set(int index,
IntBuffer buffer)
Read this vector from the supplied
IntBuffer starting at the
specified absolute buffer position/index. |
Vector4i |
set(int x,
int y,
int z,
int w)
Set the x, y, z, and w components to the supplied values.
|
Vector4i |
set(Vector2ic v,
int z,
int w)
Sets the first two components of this to the components of given
v and last two components to the given z, and
w. |
Vector4i |
set(Vector3ic v,
int w)
Set the first three components of this to the components of
v and the last component to w. |
Vector4i |
set(Vector4ic v)
Set this
Vector4i to the values of the given v. |
Vector4i |
setComponent(int component,
int value)
Set the value of the specified component of this vector.
|
Vector4i |
sub(int x,
int y,
int z,
int w)
Subtract
(x, y, z, w) from this. |
Vector4i |
sub(int x,
int y,
int z,
int w,
Vector4i dest)
Subtract
(x, y, z, w) from this and store the result in
dest. |
Vector4i |
sub(Vector4ic v)
Subtract the supplied vector from this one.
|
Vector4i |
sub(Vector4ic v,
Vector4i 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. |
int |
w() |
void |
writeExternal(ObjectOutput out) |
int |
x() |
int |
y() |
int |
z() |
Vector4i |
zero()
Set all components to zero.
|
public int x
public int y
public int z
public int w
public Vector4i()
Vector4i of (0, 0, 0, 1).public Vector4i(Vector4ic v)
Vector4i with the same values as v.v - the Vector4ic to copy the values frompublic Vector4i(Vector2ic v, int z, int w)
v - the Vector2icz - the z componentw - the w componentpublic Vector4i(int s)
Vector4i and initialize all four components with the
given value.s - scalar value of all four componentspublic Vector4i(int x,
int y,
int z,
int w)
Vector4i with the given component values.x - the x componenty - the y componentz - the z componentw - the w componentpublic Vector4i(ByteBuffer buffer)
Vector4i 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 Vector4i(int, ByteBuffer), taking the absolute
position as parameter.
buffer - values will be read in x, y, z, w orderVector4i(int, ByteBuffer)public Vector4i(int index,
ByteBuffer buffer)
Vector4i 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, w orderpublic Vector4i(IntBuffer buffer)
Vector4i 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 Vector4i(int, IntBuffer), taking the absolute position
as parameter.
buffer - values will be read in x, y, z, w orderVector4i(int, IntBuffer)public Vector4i(int index,
IntBuffer buffer)
Vector4i 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, w orderpublic Vector4i set(Vector4ic v)
Vector4i to the values of the given v.v - the vector whose values will be copied into thispublic Vector4i set(Vector3ic v, int w)
v and the last component to w.v - the Vector3ic to copyw - the w componentpublic Vector4i set(Vector2ic v, int z, int w)
v and last two components to the given z, and
w.v - the Vector2icz - the z componentw - the w componentpublic Vector4i set(int s)
s - the value of all four componentspublic Vector4i set(int x, int y, int z, int w)
x - the x componenty - the y componentz - the z componentw - the w componentpublic Vector4i 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, w orderset(int, ByteBuffer)public Vector4i 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, w orderpublic Vector4i 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, w orderset(int, IntBuffer)public Vector4i 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, w orderpublic int get(int component)
throws IllegalArgumentException
Vector4icget in interface Vector4iccomponent - the component, within [0..3]IllegalArgumentException - if component is not within [0..3]public int maxComponent()
Vector4icmaxComponent in interface Vector4ic[0..3]public int minComponent()
Vector4icminComponent in interface Vector4ic[0..3]public Vector4i setComponent(int component, int value) throws IllegalArgumentException
component - the component whose value to set, within [0..3]value - the value to setIllegalArgumentException - if component is not within [0..3]public IntBuffer get(IntBuffer buffer)
Vector4icIntBuffer 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 Vector4ic.get(int, IntBuffer), taking the absolute position as
parameter.
get in interface Vector4icbuffer - will receive the values of this vector in x, y, z, w orderVector4ic.get(int, IntBuffer)public IntBuffer get(int index, IntBuffer buffer)
Vector4icIntBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given IntBuffer.
public ByteBuffer get(ByteBuffer buffer)
Vector4icByteBuffer 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 Vector4ic.get(int, ByteBuffer), taking the absolute position
as parameter.
get in interface Vector4icbuffer - will receive the values of this vector in x, y, z, w orderVector4ic.get(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
Vector4icByteBuffer starting at the
specified absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
public Vector4i sub(Vector4ic v)
v - the vector to subtractpublic Vector4i sub(int x, int y, int z, int w)
(x, y, z, w) from this.x - the x component to subtracty - the y component to subtractz - the z component to subtractw - the w component to subtractpublic Vector4i sub(Vector4ic v, Vector4i dest)
Vector4icdest.public Vector4i sub(int x, int y, int z, int w, Vector4i dest)
Vector4ic(x, y, z, w) from this and store the result in
dest.public Vector4i add(Vector4ic v)
v - the vector to addpublic Vector4i add(Vector4ic v, Vector4i dest)
Vector4icdest.public Vector4i add(int x, int y, int z, int w)
x - the x component to addy - the y component to addz - the z component to addw - the w component to addpublic Vector4i add(int x, int y, int z, int w, Vector4i dest)
Vector4icdest.public Vector4i mul(Vector4ic v)
v - the other vectorpublic Vector4i mul(Vector4ic v, Vector4i dest)
Vector4icdest.public Vector4i div(Vector4ic v)
v - the vector to divide bypublic Vector4i div(Vector4ic v, Vector4i dest)
Vector4icdest.public Vector4i mul(int scalar)
Vector4i by the given scalar
value.scalar - the scalar to multiply bypublic Vector4i mul(int scalar, Vector4i dest)
Vector4icVector4i by the given scalar
value and store the result in dest.public Vector4i div(int scalar)
Vector4i by the given scalar value.scalar - the scalar to divide bypublic Vector4i div(float scalar, Vector4i dest)
Vector4icVector4i by the given scalar value
and store the result in dest.public long lengthSquared()
Vector4iclengthSquared in interface Vector4icpublic static long lengthSquared(int x,
int y,
int z,
int w)
x - The vector's x componenty - The vector's y componentz - The vector's z componentw - The vector's w componentpublic double length()
Vector4icpublic static double length(int x,
int y,
int z,
int w)
x - The vector's x componenty - The vector's y componentz - The vector's z componentw - The vector's w componentpublic double distance(Vector4ic v)
Vector4icv.public double distance(int x,
int y,
int z,
int w)
Vector4icthis vector and (x, y, z, w).public long gridDistance(Vector4ic v)
Vector4ic(x, y).gridDistance in interface Vector4icv - the other vectorpublic long gridDistance(int x,
int y,
int z,
int w)
Vector4ic(x, y).gridDistance in interface Vector4icx - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorw - the w component of the other vectorpublic int distanceSquared(Vector4ic v)
Vector4icv.distanceSquared in interface Vector4icv - the other vectorpublic int distanceSquared(int x,
int y,
int z,
int w)
Vector4icthis vector and
(x, y, z, w).distanceSquared in interface Vector4icx - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorw - the w component of the other vectorpublic static double distance(int x1,
int y1,
int z1,
int w1,
int x2,
int y2,
int z2,
int w2)
(x1, y1, z1, w1) and (x2, y2, z2, w2).x1 - the x component of the first vectory1 - the y component of the first vectorz1 - the z component of the first vectorw1 - the w 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 vectorw2 - the 2 component of the second vectorpublic static long distanceSquared(int x1,
int y1,
int z1,
int w1,
int x2,
int y2,
int z2,
int w2)
(x1, y1, z1, w1) and (x2, y2, z2, w2).x1 - the x component of the first vectory1 - the y component of the first vectorz1 - the z component of the first vectorw1 - the w 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 vectorw2 - the w component of the second vectorpublic int dot(Vector4ic v)
Vector4icv.public Vector4i zero()
public Vector4i negate()
public Vector4i negate(Vector4i dest)
Vector4icdest.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 Vector4i min(Vector4ic v)
v - the other vectorpublic Vector4i min(Vector4ic v, Vector4i dest)
Vector4icdest to be the component-wise minimum of this and the other vector.public Vector4i max(Vector4ic v)
v - the other vectorpublic Vector4i max(Vector4ic v, Vector4i dest)
Vector4icdest to be the component-wise maximum of this and the other vector.public boolean equals(int x,
int y,
int z,
int w)
Vector4icthis vector with the given (x, y, z, w)
and return whether all of them are equal.Copyright © 2015–2019 JOML. All rights reserved.