Interface Vector4ic
- All Known Implementing Classes:
Vector4i
- Author:
- Kai Burjack
-
Method Summary
Modifier and TypeMethodDescriptionCompute the absolute of each of this vector's components and store the result intodest.Increment the components of this vector by the given values and store the result indest.Add the supplied vector to this one and store the result indest.doubledistance(int x, int y, int z, int w) Return the distance betweenthisvector and(x, y, z, w).doubleReturn the distance between this Vector andv.intdistanceSquared(int x, int y, int z, int w) Return the square of the distance betweenthisvector and(x, y, z, w).intReturn the square of the distance between this vector andv.Divide all components of thisVector4iby the given scalar value and store the result indest.Divide all components of thisVector4iby the given scalar value and store the result indest.Divide this Vector4i component-wise by another Vector4ic and store the result indest.intCompute the dot product (inner product) of this vector andv.booleanequals(int x, int y, int z, int w) Compare the vector components ofthisvector with the given(x, y, z, w)and return whether all of them are equal.intget(int component) Get the value of the specified component of this vector.get(int index, ByteBuffer buffer) Store this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.Store this vector into the suppliedIntBufferstarting at the specified absolute buffer position/index.get(ByteBuffer buffer) Store this vector into the suppliedByteBufferat the current bufferposition.getToAddress(long address) Store this vector at the given off-heap memory address.longgridDistance(int x, int y, int z, int w) Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).longReturn the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).doublelength()Return the length of this vector.longReturn the length squared of this vector.Set the components ofdestto be the component-wise maximum of this and the other vector.intDetermine the component with the biggest absolute value.Set the components ofdestto be the component-wise minimum of this and the other vector.intDetermine the component with the smallest (towards zero) absolute value.Multiply all components of thisVector4iby the given scalar value and store the result indest.Multiply this Vector4i component-wise by another Vector4ic and store the result indest.Negate this vector and store the result indest.Subtract(x, y, z, w)from this and store the result indest.Subtract the supplied vector from this one and store the result indest.intw()intx()inty()intz()
-
Method Details
-
x
int x()- Returns:
- the value of the x component
-
y
int y()- Returns:
- the value of the y component
-
z
int z()- Returns:
- the value of the z component
-
w
int w()- Returns:
- the value of the w component
-
get
Store this vector into the suppliedIntBufferat the current bufferposition.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
get(int, IntBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this vector inx, y, z, worder- Returns:
- the passed in buffer
- See Also:
-
get
Store this vector into the suppliedIntBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given IntBuffer.
- Parameters:
index- the absolute position into the IntBufferbuffer- will receive the values of this vector inx, y, z, worder- Returns:
- the passed in buffer
-
get
Store this vector into the suppliedByteBufferat the current bufferposition.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.- Parameters:
buffer- will receive the values of this vector inx, y, z, worder- Returns:
- the passed in buffer
- See Also:
-
get
Store this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this vector inx, y, z, worder- Returns:
- the passed in buffer
-
getToAddress
Store this vector at the given off-heap memory address.This method will throw an
UnsupportedOperationExceptionwhen 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.
- Parameters:
address- the off-heap address where to store this vector- Returns:
- this
-
sub
Subtract the supplied vector from this one and store the result indest.- Parameters:
v- the vector to subtract fromthisdest- will hold the result- Returns:
- dest
-
sub
Subtract(x, y, z, w)from this and store the result indest.- Parameters:
x- the x component to subtracty- the y component to subtractz- the z component to subtractw- the w component to subtractdest- will hold the result- Returns:
- dest
-
add
Add the supplied vector to this one and store the result indest.- Parameters:
v- the vector to adddest- will hold the result- Returns:
- dest
-
add
Increment the components of this vector by the given values and store the result indest.- Parameters:
x- the x component to addy- the y component to addz- the z component to addw- the w component to adddest- will hold the result- Returns:
- dest
-
mul
Multiply this Vector4i component-wise by another Vector4ic and store the result indest.- Parameters:
v- the other vectordest- will hold the result- Returns:
- dest
-
div
Divide this Vector4i component-wise by another Vector4ic and store the result indest.- Parameters:
v- the vector to divide bydest- will hold the result- Returns:
- dest
-
mul
Multiply all components of thisVector4iby the given scalar value and store the result indest.- Parameters:
scalar- the scalar to multiply bydest- will hold the result- Returns:
- dest
-
div
Divide all components of thisVector4iby the given scalar value and store the result indest.- Parameters:
scalar- the scalar to divide bydest- will hold the result- Returns:
- dest
-
div
Divide all components of thisVector4iby the given scalar value and store the result indest.- Parameters:
scalar- the scalar to divide bydest- will hold the result- Returns:
- dest
-
lengthSquared
long lengthSquared()Return the length squared of this vector.- Returns:
- the length squared
-
length
double length()Return the length of this vector.- Returns:
- the length
-
distance
Return the distance between this Vector andv.- Parameters:
v- the other vector- Returns:
- the distance
-
distance
double distance(int x, int y, int z, int w) Return the distance betweenthisvector and(x, y, z, w).- Parameters:
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 vector- Returns:
- the euclidean distance
-
gridDistance
Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).- Parameters:
v- the other vector- Returns:
- the grid distance
-
gridDistance
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).- Parameters:
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 vector- Returns:
- the grid distance
-
distanceSquared
Return the square of the distance between this vector andv.- Parameters:
v- the other vector- Returns:
- the squared of the distance
-
distanceSquared
int distanceSquared(int x, int y, int z, int w) Return the square of the distance betweenthisvector and(x, y, z, w).- Parameters:
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 vector- Returns:
- the square of the distance
-
dot
Compute the dot product (inner product) of this vector andv.- Parameters:
v- the other vector- Returns:
- the dot product
-
negate
Negate this vector and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
min
Set the components ofdestto be the component-wise minimum of this and the other vector.- Parameters:
v- the other vectordest- will hold the result- Returns:
- dest
-
max
Set the components ofdestto be the component-wise maximum of this and the other vector.- Parameters:
v- the other vectordest- will hold the result- Returns:
- dest
-
get
Get the value of the specified component of this vector.- Parameters:
component- the component, within[0..3]- Returns:
- the value
- Throws:
IllegalArgumentException- ifcomponentis not within[0..3]
-
maxComponent
int maxComponent()Determine the component with the biggest absolute value.- Returns:
- the component index, within
[0..3]
-
minComponent
int minComponent()Determine the component with the smallest (towards zero) absolute value.- Returns:
- the component index, within
[0..3]
-
absolute
Compute the absolute of each of this vector's components and store the result intodest.- Parameters:
dest- will hold the result- Returns:
- dest
-
equals
boolean equals(int x, int y, int z, int w) Compare the vector components ofthisvector with the given(x, y, z, w)and return whether all of them are equal.- Parameters:
x- the x component to compare toy- the y component to compare toz- the z component to compare tow- the w component to compare to- Returns:
trueif all the vector components are equal
-