public class Vector3f extends Object implements Externalizable, Vector3fc
| Modifier and Type | Field and Description |
|---|---|
float |
x
The x component of the vector.
|
float |
y
The y component of the vector.
|
float |
z
The z component of the vector.
|
| Constructor and Description |
|---|
Vector3f()
Create a new
Vector3f of (0, 0, 0). |
Vector3f(ByteBuffer buffer)
Create a new
Vector3f and read this vector from the supplied ByteBuffer
at the current buffer position. |
Vector3f(float d)
Create a new
Vector3f and initialize all three components with the given value. |
Vector3f(FloatBuffer buffer)
Create a new
Vector3f and read this vector from the supplied FloatBuffer
at the current buffer position. |
Vector3f(float x,
float y,
float z)
Create a new
Vector3f with the given component values. |
Vector3f(int index,
ByteBuffer buffer)
Create a new
Vector3f and read this vector from the supplied ByteBuffer
starting at the specified absolute buffer position/index. |
Vector3f(int index,
FloatBuffer buffer)
Create a new
Vector3f and read this vector from the supplied FloatBuffer
starting at the specified absolute buffer position/index. |
Vector3f(Vector2fc v,
float z)
|
Vector3f(Vector3fc v)
Create a new
Vector3f with the same values as v. |
| Modifier and Type | Method and Description |
|---|---|
Vector3f |
add(float x,
float y,
float z)
Increment the components of this vector by the given values.
|
Vector3f |
add(float x,
float y,
float z,
Vector3f dest)
Increment the components of this vector by the given values and store the result in
dest. |
Vector3f |
add(Vector3fc v)
Add the supplied vector to this one.
|
Vector3f |
add(Vector3fc v,
Vector3f dest)
Add the supplied vector to this one and store the result in
dest. |
float |
angle(Vector3fc v)
Return the angle between this vector and the supplied vector.
|
float |
angleCos(Vector3fc v)
Return the cosine of the angle between this vector and the supplied vector.
|
Vector3f |
cross(float x,
float y,
float z)
Set this vector to be the cross product of itself and (x, y, z).
|
Vector3f |
cross(float x,
float y,
float z,
Vector3f dest)
Compute the cross product of this vector and (x, y, z) and store the result in
dest. |
Vector3f |
cross(Vector3fc v)
Set this vector to be the cross product of itself and
v. |
Vector3f |
cross(Vector3fc v,
Vector3f dest)
Compute the cross product of this vector and
v and store the result in dest. |
float |
distance(float x,
float y,
float z)
Return the distance between
this vector and (x, y, z). |
float |
distance(Vector3fc v)
Return the distance between this Vector and
v. |
float |
distanceSquared(float x,
float y,
float z)
Return the square of the distance between
this vector and (x, y, z). |
float |
distanceSquared(Vector3fc v)
Return the square of the distance between this vector and
v. |
Vector3f |
div(float scalar)
Divide all components of this
Vector3f by the given scalar
value. |
Vector3f |
div(float x,
float y,
float z)
Divide the components of this Vector3f by the given scalar values and store the result in
this. |
Vector3f |
div(float x,
float y,
float z,
Vector3f dest)
Divide the components of this Vector3f by the given scalar values and store the result in
dest. |
Vector3f |
div(float scalar,
Vector3f dest)
Divide all components of this
Vector3f by the given scalar
value and store the result in dest. |
Vector3f |
div(Vector3fc v)
Divide this Vector3f component-wise by another Vector3fc.
|
Vector3f |
div(Vector3fc v,
Vector3f dest)
Divide this Vector3f component-wise by another Vector3f and store the result in
dest. |
float |
dot(float x,
float y,
float z)
Return the dot product of this vector and the vector (x, y, z).
|
float |
dot(Vector3fc v)
Return the dot product of this vector and the supplied vector.
|
boolean |
equals(Object obj) |
Vector3f |
fma(float a,
Vector3fc b)
Add the component-wise multiplication of
a * b to this vector. |
Vector3f |
fma(float a,
Vector3fc b,
Vector3f dest)
Add the component-wise multiplication of
a * b to this vector
and store the result in dest. |
Vector3f |
fma(Vector3fc a,
Vector3fc b)
Add the component-wise multiplication of
a * b to this vector. |
Vector3f |
fma(Vector3fc a,
Vector3fc b,
Vector3f dest)
Add the component-wise multiplication of
a * b to this vector
and store the result in dest. |
ByteBuffer |
get(ByteBuffer buffer)
Store this vector into the supplied
ByteBuffer at the current
buffer position. |
FloatBuffer |
get(FloatBuffer buffer)
Store this vector into the supplied
FloatBuffer at the current
buffer position. |
float |
get(int component)
Get the value of the specified component of this vector.
|
ByteBuffer |
get(int index,
ByteBuffer buffer)
Store this vector into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
FloatBuffer |
get(int index,
FloatBuffer buffer)
Store this vector into the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
Vector3f |
half(float x,
float y,
float z)
Compute the half vector between this and the vector (x, y, z).
|
Vector3f |
half(float x,
float y,
float z,
Vector3f dest)
Compute the half vector between this and the vector (x, y, z)
and store the result in
dest. |
Vector3f |
half(Vector3fc other)
Compute the half vector between this and the other vector.
|
Vector3f |
half(Vector3fc other,
Vector3f dest)
Compute the half vector between this and the other vector and store the result in
dest. |
int |
hashCode() |
Vector3f |
hermite(Vector3fc t0,
Vector3fc v1,
Vector3fc t1,
float t,
Vector3f dest)
Compute a hermite interpolation between
this vector with its
associated tangent t0 and the given vector v
with its tangent t1 and store the result in
dest. |
float |
length()
Return the length of this vector.
|
float |
lengthSquared()
Return the length squared of this vector.
|
Vector3f |
lerp(Vector3fc other,
float t)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in this. |
Vector3f |
lerp(Vector3fc other,
float t,
Vector3f dest)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in dest. |
Vector3f |
max(Vector3fc v)
Set the components of this vector to be the component-wise maximum of this and the other vector.
|
int |
maxComponent()
Determine the component with the biggest absolute value.
|
Vector3f |
min(Vector3fc v)
Set the components of this vector to be the component-wise minimum of this and the other vector.
|
int |
minComponent()
Determine the component with the smallest (towards zero) absolute value.
|
Vector3f |
mul(float scalar)
Multiply all components of this
Vector3f by the given scalar
value. |
Vector3f |
mul(float x,
float y,
float z)
Multiply the components of this Vector3f by the given scalar values and store the result in
this. |
Vector3f |
mul(float x,
float y,
float z,
Vector3f dest)
Multiply the components of this Vector3f by the given scalar values and store the result in
dest. |
Vector3f |
mul(float scalar,
Vector3f dest)
Multiply all components of this
Vector3f by the given scalar
value and store the result in dest. |
Vector3f |
mul(Matrix3fc mat)
Multiply the given matrix with this Vector3f and store the result in
this. |
Vector3f |
mul(Matrix3fc mat,
Vector3f dest)
Multiply the given matrix with this Vector3f and store the result in
dest. |
Vector3f |
mul(Vector3fc v)
Multiply this Vector3f component-wise by another Vector3fc.
|
Vector3f |
mul(Vector3fc v,
Vector3f dest)
Multiply this Vector3f component-wise by another Vector3f and store the result in
dest. |
Vector3f |
mulDirection(Matrix4fc mat)
Multiply the given 4x4 matrix
mat with this. |
Vector3f |
mulDirection(Matrix4fc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this and store the
result in dest. |
Vector3f |
mulDirection(Matrix4x3fc mat)
Multiply the given 4x3 matrix
mat with this. |
Vector3f |
mulDirection(Matrix4x3fc mat,
Vector3f dest)
Multiply the given 4x3 matrix
mat with this and store the
result in dest. |
Vector3f |
mulPosition(Matrix4fc mat)
Multiply the given 4x4 matrix
mat with this. |
Vector3f |
mulPosition(Matrix4fc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this and store the
result in dest. |
Vector3f |
mulPosition(Matrix4x3fc mat)
Multiply the given 4x3 matrix
mat with this. |
Vector3f |
mulPosition(Matrix4x3fc mat,
Vector3f dest)
Multiply the given 4x3 matrix
mat with this and store the
result in dest. |
float |
mulPositionW(Matrix4fc mat)
Multiply the given 4x4 matrix
mat with this and return the w component
of the resulting 4D vector. |
float |
mulPositionW(Matrix4fc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this, store the
result in dest and return the w component of the resulting 4D vector. |
Vector3f |
mulProject(Matrix4fc mat)
Multiply the given matrix
mat with this Vector3f, perform perspective division. |
Vector3f |
mulProject(Matrix4fc mat,
Vector3f dest)
Multiply the given matrix
mat with this Vector3f, perform perspective division
and store the result in dest. |
Vector3f |
mulTranspose(Matrix3fc mat)
Multiply the transpose of the given matrix with this Vector3f store the result in
this. |
Vector3f |
mulTranspose(Matrix3fc mat,
Vector3f dest)
Multiply the transpose of the given matrix with this Vector3f and store the result in
dest. |
Vector3f |
mulTransposeDirection(Matrix4fc mat)
Multiply the transpose of the given 4x4 matrix
mat with this. |
Vector3f |
mulTransposeDirection(Matrix4fc mat,
Vector3f dest)
Multiply the transpose of the given 4x4 matrix
mat with this and store the
result in dest. |
Vector3f |
mulTransposePosition(Matrix4fc mat)
Multiply the transpose of the given 4x4 matrix
mat with this. |
Vector3f |
mulTransposePosition(Matrix4fc mat,
Vector3f dest)
Multiply the transpose of the given 4x4 matrix
mat with this and store the
result in dest. |
Vector3f |
negate()
Negate this vector.
|
Vector3f |
negate(Vector3f dest)
Negate this vector and store the result in
dest. |
Vector3f |
normalize()
Normalize this vector.
|
Vector3f |
normalize(Vector3f dest)
Normalize this vector and store the result in
dest. |
Vector3f |
orthogonalize(Vector3fc v)
Transform
this vector so that it is orthogonal to the given vector v and normalize the result. |
Vector3f |
orthogonalize(Vector3fc v,
Vector3f dest)
Transform
this vector so that it is orthogonal to the given vector v, normalize the result and store it into dest. |
Vector3f |
orthogonalizeUnit(Vector3fc v)
Transform
this vector so that it is orthogonal to the given unit vector v and normalize the result. |
Vector3f |
orthogonalizeUnit(Vector3fc v,
Vector3f dest)
Transform
this vector so that it is orthogonal to the given unit vector v, normalize the result and store it into dest. |
void |
readExternal(ObjectInput in) |
Vector3f |
reflect(float x,
float y,
float z)
Reflect this vector about the given normal vector.
|
Vector3f |
reflect(float x,
float y,
float z,
Vector3f dest)
Reflect this vector about the given normal vector and store the result in
dest. |
Vector3f |
reflect(Vector3fc normal)
Reflect this vector about the given
normal vector. |
Vector3f |
reflect(Vector3fc normal,
Vector3f dest)
Reflect this vector about the given
normal vector and store the result in dest. |
Vector3f |
rotate(Quaternionfc quat)
Rotate this vector by the given quaternion
quat and store the result in this. |
Vector3f |
rotate(Quaternionfc quat,
Vector3f dest)
Rotate this vector by the given quaternion
quat and store the result in dest. |
Quaternionf |
rotationTo(float toDirX,
float toDirY,
float toDirZ,
Quaternionf dest)
Compute the quaternion representing a rotation of
this vector to point along (toDirX, toDirY, toDirZ)
and store the result in dest. |
Quaternionf |
rotationTo(Vector3fc toDir,
Quaternionf dest)
Compute the quaternion representing a rotation of
this vector to point along toDir
and store the result in dest. |
Vector3f |
set(ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer at the current
buffer position. |
Vector3f |
set(float d)
Set the x, y, and z components to the supplied value.
|
Vector3f |
set(FloatBuffer buffer)
Read this vector from the supplied
FloatBuffer at the current
buffer position. |
Vector3f |
set(float x,
float y,
float z)
Set the x, y and z components to the supplied values.
|
Vector3f |
set(int index,
ByteBuffer buffer)
Read this vector from the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
Vector3f |
set(int component,
float value)
Set the value of the specified component of this vector.
|
Vector3f |
set(int index,
FloatBuffer buffer)
Read this vector from the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
Vector3f |
set(Vector2fc v,
float z)
Set the first two components from the given
v
and the z component from the given z |
Vector3f |
set(Vector3dc v)
Set the x, y and z components to match the supplied vector.
|
Vector3f |
set(Vector3fc v)
Set the x, y and z components to match the supplied vector.
|
Vector3f |
smoothStep(Vector3fc v,
float t,
Vector3f dest)
Compute a smooth-step (i.e. hermite with zero tangents) interpolation
between
this vector and the given vector v and
store the result in dest. |
Vector3f |
sub(float x,
float y,
float z)
Decrement the components of this vector by the given values.
|
Vector3f |
sub(float x,
float y,
float z,
Vector3f dest)
Decrement the components of this vector by the given values and store the result in
dest. |
Vector3f |
sub(Vector3fc v)
Subtract the supplied vector from this one and store the result in
this. |
Vector3f |
sub(Vector3fc v,
Vector3f dest)
Subtract the supplied vector from this one and store the result in
dest. |
Vector3fc |
toImmutable()
Create a new immutable view of this
Vector3f. |
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) |
float |
x() |
float |
y() |
float |
z() |
Vector3f |
zero()
Set all components to zero.
|
public float x
public float y
public float z
public Vector3f()
Vector3f of (0, 0, 0).public Vector3f(float d)
Vector3f and initialize all three components with the given value.d - the value of all three componentspublic Vector3f(float x,
float y,
float z)
Vector3f with the given component values.x - the value of xy - the value of yz - the value of zpublic Vector3f(Vector3fc v)
Vector3f with the same values as v.v - the Vector3fc to copy the values frompublic Vector3f(Vector2fc v, float z)
v - the Vector2fc to copy the values fromz - the z componentpublic Vector3f(ByteBuffer buffer)
Vector3f 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 Vector3f(int, ByteBuffer), taking
the absolute position as parameter.
buffer - values will be read in x, y, z orderVector3f(int, ByteBuffer)public Vector3f(int index,
ByteBuffer buffer)
Vector3f 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 Vector3f(FloatBuffer buffer)
Vector3f and read this vector from the supplied FloatBuffer
at the current buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the vector is read, use Vector3f(int, FloatBuffer), taking
the absolute position as parameter.
buffer - values will be read in x, y, z orderVector3f(int, FloatBuffer)public Vector3f(int index,
FloatBuffer buffer)
Vector3f and read this vector from the supplied FloatBuffer
starting at the specified absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
index - the absolute position into the FloatBufferbuffer - values will be read in x, y, z orderpublic Vector3f set(Vector3fc v)
v - contains the values of x, y and z to setpublic Vector3f 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 Vector3f set(Vector2fc v, float z)
v
and the z component from the given zv - the Vector2fc to copy the values fromz - the z componentpublic Vector3f set(float d)
d - the value of all three componentspublic Vector3f set(float x, float y, float z)
x - the x componenty - the y componentz - the z componentpublic Vector3f 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 Vector3f 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 Vector3f set(FloatBuffer buffer)
FloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the vector is read, use set(int, FloatBuffer), taking
the absolute position as parameter.
buffer - values will be read in x, y, z orderset(int, FloatBuffer)public Vector3f set(int index, FloatBuffer buffer)
FloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
index - the absolute position into the FloatBufferbuffer - values will be read in x, y, z orderpublic FloatBuffer get(FloatBuffer buffer)
Vector3fcFloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the vector is stored, use Vector3fc.get(int, FloatBuffer), taking
the absolute position as parameter.
get in interface Vector3fcbuffer - will receive the values of this vector in x, y, z orderVector3fc.get(int, FloatBuffer),
Vector3fc.get(int, FloatBuffer)public FloatBuffer get(int index, FloatBuffer buffer)
Vector3fcFloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
public ByteBuffer get(ByteBuffer buffer)
Vector3fcByteBuffer 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 Vector3fc.get(int, ByteBuffer), taking
the absolute position as parameter.
get in interface Vector3fcbuffer - will receive the values of this vector in x, y, z orderVector3fc.get(int, ByteBuffer),
Vector3fc.get(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
Vector3fcByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
public Vector3f sub(Vector3fc v)
this.v - the vector to subtractpublic Vector3f sub(Vector3fc v, Vector3f dest)
Vector3fcdest.public Vector3f sub(float x, float y, float z)
x - the x component to subtracty - the y component to subtractz - the z component to subtractpublic Vector3f sub(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f add(Vector3fc v)
v - the vector to addpublic Vector3f add(Vector3fc v, Vector3f dest)
Vector3fcdest.public Vector3f add(float x, float y, float z)
x - the x component to addy - the y component to addz - the z component to addpublic Vector3f add(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f fma(Vector3fc a, Vector3fc b)
a * b to this vector.a - the first multiplicandb - the second multiplicandpublic Vector3f fma(float a, Vector3fc b)
a * b to this vector.a - the first multiplicandb - the second multiplicandpublic Vector3f fma(Vector3fc a, Vector3fc b, Vector3f dest)
Vector3fca * b to this vector
and store the result in dest.public Vector3f fma(float a, Vector3fc b, Vector3f dest)
Vector3fca * b to this vector
and store the result in dest.public Vector3f mul(Vector3fc v)
v - the vector to multiply bypublic Vector3f mul(Vector3fc v, Vector3f dest)
Vector3fcdest.public Vector3f div(Vector3fc v)
v - the vector to divide bypublic Vector3f div(Vector3fc v, Vector3f dest)
Vector3fcdest.public Vector3f mulProject(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this Vector3f, perform perspective division
and store the result in dest.
This method uses w=1.0 as the fourth vector component.
mulProject in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the resultpublic Vector3f mulProject(Matrix4fc mat)
mat with this Vector3f, perform perspective division.
This method uses w=1.0 as the fourth vector component.
mat - the matrix to multiply this vector bypublic Vector3f mul(Matrix3fc mat)
this.mat - the matrixpublic Vector3f mul(Matrix3fc mat, Vector3f dest)
Vector3fcdest.public Vector3f mulTranspose(Matrix3fc mat)
this.mat - the matrixpublic Vector3f mulTranspose(Matrix3fc mat, Vector3f dest)
Vector3fcdest.mulTranspose in interface Vector3fcmat - the matrixdest - will hold the resultpublic Vector3f mulPosition(Matrix4fc mat)
mat with this.
This method assumes the w component of this to be 1.0.
mat - the matrix to multiply this vector bypublic Vector3f mulPosition(Matrix4x3fc mat)
mat with this.
This method assumes the w component of this to be 1.0.
mat - the matrix to multiply this vector bypublic Vector3f mulPosition(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 1.0.
mulPosition in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the resultpublic Vector3f mulPosition(Matrix4x3fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 1.0.
mulPosition in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the resultpublic Vector3f mulTransposePosition(Matrix4fc mat)
mat with this.
This method assumes the w component of this to be 1.0.
mat - the matrix whose transpose to multiply this vector bypublic Vector3f mulTransposePosition(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 1.0.
mulTransposePosition in interface Vector3fcmat - the matrix whose transpose to multiply this vector bydest - will hold the resultpublic float mulPositionW(Matrix4fc mat)
mat with this and return the w component
of the resulting 4D vector.
This method assumes the w component of this to be 1.0.
mat - the matrix to multiply this vector bypublic float mulPositionW(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this, store the
result in dest and return the w component of the resulting 4D vector.
This method assumes the w component of this to be 1.0.
mulPositionW in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the (x, y, z) components of the resulting vectorpublic Vector3f mulDirection(Matrix4fc mat)
mat with this.
This method assumes the w component of this to be 0.0.
mat - the matrix to multiply this vector bypublic Vector3f mulDirection(Matrix4x3fc mat)
mat with this.
This method assumes the w component of this to be 0.0.
mat - the matrix to multiply this vector bypublic Vector3f mulDirection(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 0.0.
mulDirection in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the resultpublic Vector3f mulDirection(Matrix4x3fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 0.0.
mulDirection in interface Vector3fcmat - the matrix to multiply this vector bydest - will hold the resultpublic Vector3f mulTransposeDirection(Matrix4fc mat)
mat with this.
This method assumes the w component of this to be 0.0.
mat - the matrix whose transpose to multiply this vector bypublic Vector3f mulTransposeDirection(Matrix4fc mat, Vector3f dest)
Vector3fcmat with this and store the
result in dest.
This method assumes the w component of this to be 0.0.
mulTransposeDirection in interface Vector3fcmat - the matrix whose transpose to multiply this vector bydest - will hold the resultpublic Vector3f mul(float scalar)
Vector3f by the given scalar
value.scalar - the scalar to multiply this vector bypublic Vector3f mul(float scalar, Vector3f dest)
Vector3fcVector3f by the given scalar
value and store the result in dest.public Vector3f mul(float x, float y, float z)
this.x - the x component to multiply this vector byy - the y component to multiply this vector byz - the z component to multiply this vector bypublic Vector3f mul(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f div(float scalar)
Vector3f by the given scalar
value.scalar - the scalar to divide bypublic Vector3f div(float scalar, Vector3f dest)
Vector3fcVector3f by the given scalar
value and store the result in dest.public Vector3f div(float x, float y, float z)
this.x - the x component to divide this vector byy - the y component to divide this vector byz - the z component to divide this vector bypublic Vector3f div(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f rotate(Quaternionfc quat)
quat and store the result in this.quat - the quaternion to rotate this vectorQuaternionfc.transform(Vector3f)public Vector3f rotate(Quaternionfc quat, Vector3f dest)
Vector3fcquat and store the result in dest.rotate in interface Vector3fcquat - the quaternion to rotate this vectordest - will hold the resultQuaternionfc.transform(Vector3f)public Quaternionf rotationTo(Vector3fc toDir, Quaternionf dest)
Vector3fcthis vector to point along toDir
and store the result in dest.
Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
rotationTo in interface Vector3fctoDir - the destination directiondest - will hold the resultQuaternionf.rotationTo(Vector3fc, Vector3fc)public Quaternionf rotationTo(float toDirX, float toDirY, float toDirZ, Quaternionf dest)
Vector3fcthis vector to point along (toDirX, toDirY, toDirZ)
and store the result in dest.
Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
rotationTo in interface Vector3fctoDirX - the x coordinate of the destination directiontoDirY - the y coordinate of the destination directiontoDirZ - the z coordinate of the destination directiondest - will hold the resultQuaternionf.rotationTo(float, float, float, float, float, float)public float lengthSquared()
Vector3fclengthSquared in interface Vector3fcpublic float length()
Vector3fcpublic Vector3f normalize()
public Vector3f normalize(Vector3f dest)
Vector3fcdest.public Vector3f cross(Vector3fc v)
v.v - the other vectorpublic Vector3f cross(float x, float y, float z)
x - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorpublic Vector3f cross(Vector3fc v, Vector3f dest)
Vector3fcv and store the result in dest.public Vector3f cross(float x, float y, float z, Vector3f dest)
Vector3fcdest.public float distance(Vector3fc v)
Vector3fcv.public float distance(float x,
float y,
float z)
Vector3fcthis vector and (x, y, z).public float distanceSquared(Vector3fc v)
Vector3fcv.distanceSquared in interface Vector3fcv - the other vectorpublic float distanceSquared(float x,
float y,
float z)
Vector3fcthis vector and (x, y, z).distanceSquared in interface Vector3fcx - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorpublic float dot(Vector3fc v)
Vector3fcpublic float dot(float x,
float y,
float z)
Vector3fcpublic float angleCos(Vector3fc v)
Vector3fcangleCos in interface Vector3fcv - the other vectorVector3fc.angle(Vector3fc)public float angle(Vector3fc v)
Vector3fcangle in interface Vector3fcv - the other vectorVector3fc.angleCos(Vector3fc)public Vector3f min(Vector3fc v)
v - the other vectorpublic Vector3f max(Vector3fc v)
v - the other vectorpublic Vector3f 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 Vector3f negate()
public Vector3f negate(Vector3f dest)
Vector3fcdest.public Vector3f reflect(Vector3fc normal)
normal vector.normal - the vector to reflect aboutpublic Vector3f reflect(float x, float y, float z)
x - the x component of the normaly - the y component of the normalz - the z component of the normalpublic Vector3f reflect(Vector3fc normal, Vector3f dest)
Vector3fcnormal vector and store the result in dest.public Vector3f reflect(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f half(Vector3fc other)
other - the other vectorpublic Vector3f half(float x, float y, float z)
x - the x component of the other vectory - the y component of the other vectorz - the z component of the other vectorpublic Vector3f half(Vector3fc other, Vector3f dest)
Vector3fcdest.public Vector3f half(float x, float y, float z, Vector3f dest)
Vector3fcdest.public Vector3f smoothStep(Vector3fc v, float t, Vector3f dest)
Vector3fcthis vector and the given vector v and
store the result in dest.smoothStep in interface Vector3fcv - the other vectort - the interpolation factor, within [0..1]dest - will hold the resultpublic Vector3f hermite(Vector3fc t0, Vector3fc v1, Vector3fc t1, float t, Vector3f dest)
Vector3fcthis vector with its
associated tangent t0 and the given vector v
with its tangent t1 and store the result in
dest.public Vector3f lerp(Vector3fc other, float t)
this and other using the given interpolation factor t
and store the result in this.
If t is 0.0 then the result is this. If the interpolation factor is 1.0
then the result is other.
other - the other vectort - the interpolation factor between 0.0 and 1.0public Vector3f lerp(Vector3fc other, float t, Vector3f dest)
Vector3fcthis and other using the given interpolation factor t
and store the result in dest.
If t is 0.0 then the result is this. If the interpolation factor is 1.0
then the result is other.
public float get(int component)
throws IllegalArgumentException
Vector3fcget in interface Vector3fccomponent - the component, within [0..2]IllegalArgumentException - if component is not within [0..2]public Vector3f set(int component, float 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 int maxComponent()
Vector3fcmaxComponent in interface Vector3fcpublic int minComponent()
Vector3fcminComponent in interface Vector3fcpublic Vector3f orthogonalize(Vector3fc v, Vector3f dest)
Vector3fcthis vector so that it is orthogonal to the given vector v, normalize the result and store it into dest.
Reference: Gram–Schmidt process
orthogonalize in interface Vector3fcv - the reference vector which the result should be orthogonal todest - will hold the resultpublic Vector3f orthogonalize(Vector3fc v)
this vector so that it is orthogonal to the given vector v and normalize the result.
Reference: Gram–Schmidt process
v - the reference vector which the result should be orthogonal topublic Vector3f orthogonalizeUnit(Vector3fc v, Vector3f dest)
Vector3fcthis vector so that it is orthogonal to the given unit vector v, normalize the result and store it into dest.
The vector v is assumed to be a unit vector.
Reference: Gram–Schmidt process
orthogonalizeUnit in interface Vector3fcv - the reference unit vector which the result should be orthogonal todest - will hold the resultpublic Vector3f orthogonalizeUnit(Vector3fc v)
this vector so that it is orthogonal to the given unit vector v and normalize the result.
The vector v is assumed to be a unit vector.
Reference: Gram–Schmidt process
v - the reference unit vector which the result should be orthogonal topublic Vector3fc toImmutable()
Vector3f.
The observable state of the returned object is the same as that of this, but casting
the returned object to Vector3f will not be possible.
This method allocates a new instance of a class implementing Vector3fc on every call.
Copyright © 2015–2016 JOML. All rights reserved.