public interface Vector3fc
Modifier and Type | Method and Description |
---|---|
Vector3f |
absolute(Vector3f dest)
Compute the absolute values of the individual components of
this and store the result in dest . |
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,
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,
Vector3f dest)
Compute the cross product of this vector and
(x, y, z) and store the result in dest . |
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 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,
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(Vector3fc v,
float delta)
Compare the vector components of
this vector with the given vector using the given delta
and return whether all of them are equal within a maximum difference of delta . |
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,
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. |
Vector3fc |
getToAddress(long address)
Store this vector at the given off-heap memory address.
|
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,
Vector3f dest)
Compute the half vector between this and the other vector and store the result in
dest . |
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,
Vector3f dest)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in dest . |
Vector3f |
max(Vector3fc v,
Vector3f 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.
|
Vector3f |
min(Vector3fc v,
Vector3f 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.
|
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(Matrix3dc mat,
Vector3f dest)
Multiply the given matrix with this Vector3f and store the result in
dest . |
Vector3f |
mul(Matrix3fc mat,
Vector3f dest)
Multiply the given matrix with this Vector3f and store the result in
dest . |
Vector3f |
mul(Matrix3x2fc mat,
Vector3f dest)
Multiply the given matrix
mat with this by assuming a
third row in the matrix of (0, 0, 1) and store the result in dest . |
Vector3f |
mul(Vector3fc v,
Vector3f dest)
Multiply this Vector3f component-wise by another Vector3f and store the result in
dest . |
Vector3f |
mulDirection(Matrix4dc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this and store the
result in dest . |
Vector3f |
mulDirection(Matrix4fc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this and store the
result in dest . |
Vector3f |
mulDirection(Matrix4x3fc mat,
Vector3f dest)
Multiply the given 4x3 matrix
mat with this and store the
result in dest . |
Vector3f |
mulPosition(Matrix4fc mat,
Vector3f dest)
Multiply the given 4x4 matrix
mat with this and store the
result in dest . |
Vector3f |
mulPosition(Matrix4x3fc mat,
Vector3f dest)
Multiply the given 4x3 matrix
mat with this and store the
result in dest . |
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,
Vector3f dest)
Multiply the given matrix
mat with this Vector3f, perform perspective division
and store the result in dest . |
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,
Vector3f dest)
Multiply the transpose of the given 4x4 matrix
mat with this and store the
result in dest . |
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(Vector3f dest)
Negate this vector and store the result in
dest . |
Vector3f |
normalize(float length,
Vector3f dest)
Scale this vector to have the given length and store the result in
dest . |
Vector3f |
normalize(Vector3f dest)
Normalize this vector and store the result in
dest . |
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,
Vector3f dest)
Transform
this vector so that it is orthogonal to the given unit vector v , normalize the result and store it into dest . |
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,
Vector3f dest)
Reflect this vector about the given
normal vector and store the result in dest . |
Vector3f |
rotate(Quaternionfc quat,
Vector3f dest)
Rotate this vector by the given quaternion
quat and store the result in dest . |
Vector3f |
rotateAxis(float angle,
float aX,
float aY,
float aZ,
Vector3f dest)
Rotate this vector the specified radians around the given rotation axis and store the result
into
dest . |
Vector3f |
rotateX(float angle,
Vector3f dest)
Rotate this vector the specified radians around the X axis and store the result
into
dest . |
Vector3f |
rotateY(float angle,
Vector3f dest)
Rotate this vector the specified radians around the Y axis and store the result
into
dest . |
Vector3f |
rotateZ(float angle,
Vector3f dest)
Rotate this vector the specified radians around the Z axis and store the result
into
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 |
smoothStep(Vector3fc v,
float t,
Vector3f dest)
Compute a smooth-step (i.e.
|
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,
Vector3f dest)
Subtract the supplied vector from this one and store the result in
dest . |
float |
x() |
float |
y() |
float |
z() |
float x()
float y()
float z()
FloatBuffer get(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 stored, use get(int, FloatBuffer)
, taking
the absolute position as parameter.
buffer
- will receive the values of this vector in x, y, z
orderget(int, FloatBuffer)
,
get(int, FloatBuffer)
FloatBuffer get(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
- will receive the values of this vector in x, y, z
orderByteBuffer get(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 stored, use get(int, ByteBuffer)
, taking
the absolute position as parameter.
buffer
- will receive the values of this vector in x, y, z
orderget(int, ByteBuffer)
,
get(int, ByteBuffer)
ByteBuffer get(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
- will receive the values of this vector in x, y, z
orderVector3fc getToAddress(long address)
This method will throw an UnsupportedOperationException
when 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.
address
- the off-heap address where to store this vectorVector3f sub(Vector3fc v, Vector3f dest)
dest
.v
- the vector to subtractdest
- will hold the resultVector3f sub(float x, float y, float z, Vector3f dest)
dest
.x
- the x component to subtracty
- the y component to subtractz
- the z component to subtractdest
- will hold the resultVector3f add(Vector3fc v, Vector3f dest)
dest
.v
- the vector to adddest
- will hold the resultVector3f add(float x, float y, float z, Vector3f dest)
dest
.x
- the x component to addy
- the y component to addz
- the z component to adddest
- will hold the resultVector3f fma(Vector3fc a, Vector3fc b, Vector3f dest)
a * b
to this vector
and store the result in dest
.a
- the first multiplicandb
- the second multiplicanddest
- will hold the resultVector3f fma(float a, Vector3fc b, Vector3f dest)
a * b
to this vector
and store the result in dest
.a
- the first multiplicandb
- the second multiplicanddest
- will hold the resultVector3f mul(Vector3fc v, Vector3f dest)
dest
.v
- the vector to multiply bydest
- will hold the resultVector3f div(Vector3fc v, Vector3f dest)
dest
.v
- the vector to divide bydest
- will hold the resultVector3f mulProject(Matrix4fc mat, Vector3f dest)
mat
with this Vector3f, perform perspective division
and store the result in dest
.
This method uses w=1.0
as the fourth vector component.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mul(Matrix3fc mat, Vector3f dest)
dest
.mat
- the matrixdest
- will hold the resultVector3f mul(Matrix3dc mat, Vector3f dest)
dest
.mat
- the matrixdest
- will hold the resultVector3f mul(Matrix3x2fc mat, Vector3f dest)
mat
with this
by assuming a
third row in the matrix of (0, 0, 1)
and store the result in dest
.mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulTranspose(Matrix3fc mat, Vector3f dest)
dest
.mat
- the matrixdest
- will hold the resultVector3f mulPosition(Matrix4fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 1.0
.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulPosition(Matrix4x3fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 1.0
.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulTransposePosition(Matrix4fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 1.0
.
mat
- the matrix whose transpose to multiply this vector bydest
- will hold the resultfloat mulPositionW(Matrix4fc mat, Vector3f dest)
mat
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
.
mat
- the matrix to multiply this vector bydest
- will hold the (x, y, z)
components of the resulting vectorVector3f mulDirection(Matrix4dc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 0.0
.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulDirection(Matrix4fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 0.0
.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulDirection(Matrix4x3fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 0.0
.
mat
- the matrix to multiply this vector bydest
- will hold the resultVector3f mulTransposeDirection(Matrix4fc mat, Vector3f dest)
mat
with this
and store the
result in dest
.
This method assumes the w
component of this
to be 0.0
.
mat
- the matrix whose transpose to multiply this vector bydest
- will hold the resultVector3f mul(float scalar, Vector3f dest)
Vector3f
by the given scalar
value and store the result in dest
.scalar
- the scalar to multiply this vector bydest
- will hold the resultVector3f mul(float x, float y, float z, Vector3f dest)
dest
.x
- the x component to multiply this vector byy
- the y component to multiply this vector byz
- the z component to multiply this vector bydest
- will hold the resultVector3f div(float scalar, Vector3f dest)
Vector3f
by the given scalar
value and store the result in dest
.scalar
- the scalar to divide bydest
- will hold the resultVector3f div(float x, float y, float z, Vector3f dest)
dest
.x
- the x component to divide this vector byy
- the y component to divide this vector byz
- the z component to divide this vector bydest
- will hold the resultVector3f rotate(Quaternionfc quat, Vector3f dest)
quat
and store the result in dest
.quat
- the quaternion to rotate this vectordest
- will hold the resultQuaternionfc.transform(Vector3f)
Quaternionf rotationTo(Vector3fc toDir, Quaternionf dest)
this
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.
toDir
- the destination directiondest
- will hold the resultQuaternionf.rotationTo(Vector3fc, Vector3fc)
Quaternionf rotationTo(float toDirX, float toDirY, float toDirZ, Quaternionf dest)
this
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.
toDirX
- 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)
Vector3f rotateAxis(float angle, float aX, float aY, float aZ, Vector3f dest)
dest
.angle
- the angle in radiansaX
- the x component of the rotation axisaY
- the y component of the rotation axisaZ
- the z component of the rotation axisdest
- will hold the resultVector3f rotateX(float angle, Vector3f dest)
dest
.angle
- the angle in radiansdest
- will hold the resultVector3f rotateY(float angle, Vector3f dest)
dest
.angle
- the angle in radiansdest
- will hold the resultVector3f rotateZ(float angle, Vector3f dest)
dest
.angle
- the angle in radiansdest
- will hold the resultfloat lengthSquared()
float length()
Vector3f normalize(Vector3f dest)
dest
.dest
- will hold the resultVector3f normalize(float length, Vector3f dest)
dest
.length
- the desired lengthdest
- will hold the resultVector3f cross(Vector3fc v, Vector3f dest)
v
and store the result in dest
.v
- the other vectordest
- will hold the resultVector3f cross(float x, float y, float z, Vector3f dest)
(x, y, z)
and store the result in dest
.x
- the x component of the other vectory
- the y component of the other vectorz
- the z component of the other vectordest
- will hold the resultfloat distance(Vector3fc v)
v
.v
- the other vectorfloat distance(float x, float y, float z)
this
vector and (x, y, z)
.x
- the x component of the other vectory
- the y component of the other vectorz
- the z component of the other vectorfloat distanceSquared(Vector3fc v)
v
.v
- the other vectorfloat distanceSquared(float x, float y, float z)
this
vector and (x, y, z)
.x
- the x component of the other vectory
- the y component of the other vectorz
- the z component of the other vectorfloat dot(Vector3fc v)
v
- the other vectorfloat dot(float x, float y, float z)
(x, y, z)
.x
- the x component of the other vectory
- the y component of the other vectorz
- the z component of the other vectorfloat angleCos(Vector3fc v)
v
- the other vectorangle(Vector3fc)
float angle(Vector3fc v)
v
- the other vectorangleCos(Vector3fc)
Vector3f min(Vector3fc v, Vector3f dest)
dest
to be the component-wise minimum of this and the other vector.v
- the other vectordest
- will hold the resultVector3f max(Vector3fc v, Vector3f dest)
dest
to be the component-wise maximum of this and the other vector.v
- the other vectordest
- will hold the resultVector3f negate(Vector3f dest)
dest
.dest
- will hold the resultVector3f absolute(Vector3f dest)
this
and store the result in dest
.dest
- will hold the resultVector3f reflect(Vector3fc normal, Vector3f dest)
normal
vector and store the result in dest
.normal
- the vector to reflect aboutdest
- will hold the resultVector3f reflect(float x, float y, float z, Vector3f dest)
dest
.x
- the x component of the normaly
- the y component of the normalz
- the z component of the normaldest
- will hold the resultVector3f half(Vector3fc other, Vector3f dest)
dest
.other
- the other vectordest
- will hold the resultVector3f half(float x, float y, float z, Vector3f dest)
(x, y, z)
and store the result in dest
.x
- the x component of the other vectory
- the y component of the other vectorz
- the z component of the other vectordest
- will hold the resultVector3f smoothStep(Vector3fc v, float t, Vector3f dest)
this
vector and the given vector v
and
store the result in dest
.v
- the other vectort
- the interpolation factor, within [0..1]
dest
- will hold the resultVector3f hermite(Vector3fc t0, Vector3fc v1, Vector3fc t1, float t, Vector3f dest)
this
vector with its
associated tangent t0
and the given vector v
with its tangent t1
and store the result in
dest
.t0
- the tangent of this
vectorv1
- the other vectort1
- the tangent of the other vectort
- the interpolation factor, within [0..1]
dest
- will hold the resultVector3f lerp(Vector3fc other, float t, Vector3f dest)
this
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
.
other
- the other vectort
- the interpolation factor between 0.0 and 1.0dest
- will hold the resultfloat get(int component) throws IllegalArgumentException
component
- the component, within [0..2]
IllegalArgumentException
- if component
is not within [0..2]
int maxComponent()
[0..2]
int minComponent()
[0..2]
Vector3f orthogonalize(Vector3fc v, Vector3f dest)
this
vector so that it is orthogonal to the given vector v
, normalize the result and store it into dest
.
Reference: Gram–Schmidt process
v
- the reference vector which the result should be orthogonal todest
- will hold the resultVector3f orthogonalizeUnit(Vector3fc v, Vector3f dest)
this
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
v
- the reference unit vector which the result should be orthogonal todest
- will hold the resultboolean equals(Vector3fc v, float delta)
this
vector with the given vector using the given delta
and return whether all of them are equal within a maximum difference of delta
.
Please note that this method is not used by any data structure such as ArrayList
HashSet
or HashMap
and their operations, such as ArrayList.contains(Object)
or HashSet.remove(Object)
, since those
data structures only use the Object.equals(Object)
and Object.hashCode()
methods.
v
- the other vectordelta
- the allowed maximum differencetrue
whether all of the vector components are equal; false
otherwiseCopyright © 2015–2018 JOML. All rights reserved.