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). |
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). |
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(Object obj) |
ByteBuffer |
get(ByteBuffer buffer)
Store this vector into the supplied
ByteBuffer at the current
buffer position . |
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. |
int |
hashCode() |
double |
length()
Return the length of this vector.
|
long |
lengthSquared()
Return the length squared of this vector.
|
Vector4i |
max(Vector4ic v)
Set the components of this vector to be the component-wise maximum of
this and the other vector.
|
Vector4i |
min(Vector4ic v)
Set the components of this vector to be the component-wise minimum of
this and the other vector.
|
Vector4i |
mul(float scalar)
Multiply all components of this
Vector4i by the given scalar
value. |
Vector4i |
mul(float 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 . |
Vector4ic |
toImmutable()
Create a new immutable view of this
Vector4i . |
String |
toString()
Return a string representation of this vector.
|
String |
toString(NumberFormat formatter)
Return a string representation of this quaternion 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 Vector2ic
z
- 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 Vector2ic
z
- 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 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)
Vector4ic
IntBuffer
at the current
buffer position
.
This method will not increment the position of the given IntBuffer.
In order to specify the offset into the IntBuffer at which the vector is
stored, use Vector4ic.get(int, IntBuffer)
, taking the absolute position as
parameter.
get
in interface Vector4ic
buffer
- will receive the values of this vector in x, y, z, w orderVector4ic.get(int, IntBuffer)
public IntBuffer get(int index, IntBuffer buffer)
Vector4ic
IntBuffer
starting at the
specified absolute buffer position/index.
This method will not increment the position of the given IntBuffer.
public ByteBuffer get(ByteBuffer buffer)
Vector4ic
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 Vector4ic.get(int, ByteBuffer)
, taking the absolute position
as parameter.
get
in interface Vector4ic
buffer
- will receive the values of this vector in x, y, z, w orderVector4ic.get(int, ByteBuffer)
public ByteBuffer get(int index, ByteBuffer buffer)
Vector4ic
ByteBuffer
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
- 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)
Vector4ic
dest
.public Vector4i sub(int x, int y, int z, int w, Vector4i dest)
Vector4ic
dest
.public Vector4i add(Vector4ic v)
v
- the vector to addpublic Vector4i add(Vector4ic v, Vector4i dest)
Vector4ic
dest
.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)
Vector4ic
dest
.public Vector4i mul(Vector4ic v)
v
- the other vectorpublic Vector4i mul(Vector4ic v, Vector4i dest)
Vector4ic
dest
.public Vector4i div(Vector4ic v)
v
- the vector to divide bypublic Vector4i div(Vector4ic v, Vector4i dest)
Vector4ic
dest
.public Vector4i mul(float scalar)
Vector4i
by the given scalar
value.scalar
- the scalar to multiply bypublic Vector4i mul(float scalar, Vector4i dest)
Vector4ic
Vector4i
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)
Vector4ic
Vector4i
by the given scalar value
and store the result in dest
.public long lengthSquared()
Vector4ic
lengthSquared
in interface Vector4ic
public double length()
Vector4ic
public double distance(Vector4ic v)
Vector4ic
v
.public double distance(int x, int y, int z, int w)
Vector4ic
this
vector and (x, y, z, w).public int distanceSquared(Vector4ic v)
Vector4ic
v
.distanceSquared
in interface Vector4ic
v
- the other vectorpublic int distanceSquared(int x, int y, int z, int w)
Vector4ic
this
vector and
(x, y, z, w).distanceSquared
in interface Vector4ic
x
- 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 dot(Vector4ic v)
Vector4ic
v
.public Vector4i zero()
public Vector4i negate()
public Vector4i negate(Vector4i dest)
Vector4ic
dest
.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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public Vector4i min(Vector4ic v)
v
- the other vectorpublic Vector4i max(Vector4ic v)
v
- the other vectorpublic Vector4ic toImmutable()
Vector4i
.
The observable state of the returned object is the same as that of this
, but casting
the returned object to Vector4i will not be possible.
This method allocates a new instance of a class implementing Vector4ic on every call.
Copyright © 2015–2017 JOML. All rights reserved.