Interface Vector2Lc
-
- All Known Implementing Classes:
Vector2L
public interface Vector2LcInterface to a read-only view of a 2-dimensional vector of integers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vector2Labsolute(Vector2L dest)Compute the absolute of each of this vector's components and store the result intodest.Vector2Ladd(long x, long y, Vector2L dest)Increment the components of this vector by the given values and store the result indest.Vector2Ladd(Vector2Lc v, Vector2L dest)Add the supplied vector to this one and store the result indest.doubledistance(long x, long y)Return the distance betweenthisvector and(x, y).doubledistance(Vector2Lc v)Return the distance between this Vector andv.longdistanceSquared(long x, long y)Return the square of the distance betweenthisvector and(x, y).longdistanceSquared(Vector2Lc v)Return the square of the distance between this vector andv.Vector2Ldiv(float scalar, Vector2L dest)Divide all components of this vector by the given scalar value and store the result indest.Vector2Ldiv(long scalar, Vector2L dest)Divide all components of this vector by the given scalar value and store the result indest.booleanequals(long x, long y)Compare the vector components ofthisvector with the given(x, y)and return whether all of them are equal.longget(int component)Get the value of the specified component of this vector.java.nio.ByteBufferget(int index, java.nio.ByteBuffer buffer)Store this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.LongBufferget(int index, java.nio.LongBuffer buffer)Store this vector into the suppliedLongBufferstarting at the specified absolute buffer position/index.java.nio.ByteBufferget(java.nio.ByteBuffer buffer)Store this vector into the suppliedByteBufferat the current bufferposition.java.nio.LongBufferget(java.nio.LongBuffer buffer)Store this vector into the suppliedLongBufferat the current bufferposition.Vector2LcgetToAddress(long address)Store this vector at the given off-heap memory address.longgridDistance(long x, long y)Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).longgridDistance(Vector2Lc v)Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).doublelength()Return the length of this vector.longlengthSquared()Return the length squared of this vector.Vector2Lmax(Vector2Lc v, Vector2L dest)Set the components ofdestto be the component-wise maximum of this and the other vector.longmaxComponent()Determine the component with the biggest absolute value.Vector2Lmin(Vector2Lc v, Vector2L dest)Set the components ofdestto be the component-wise minimum of this and the other vector.longminComponent()Determine the component with the smallest (towards zero) absolute value.Vector2Lmul(long x, long y, Vector2L dest)Multiply the components of this vector by the given values and store the result indest.Vector2Lmul(long scalar, Vector2L dest)Multiply all components of thisVector2Lcby the given scalar value and store the result indest.Vector2Lmul(Vector2Lc v, Vector2L dest)Multiply the supplied vector by this one and store the result indest.Vector2Lnegate(Vector2L dest)Negate this vector and store the result indest.Vector2Lsub(long x, long y, Vector2L dest)Decrement the components of this vector by the given values and store the result indest.Vector2Lsub(Vector2Lc v, Vector2L dest)Subtract the supplied vector from this one and store the result indest.longx()longy()
-
-
-
Method Detail
-
x
long x()
- Returns:
- the value of the x component
-
y
long y()
- Returns:
- the value of the y component
-
get
java.nio.ByteBuffer get(java.nio.ByteBuffer buffer)
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, yorder- Returns:
- the passed in buffer
- See Also:
get(int, ByteBuffer)
-
get
java.nio.ByteBuffer get(int index, java.nio.ByteBuffer buffer)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, yorder- Returns:
- the passed in buffer
-
get
java.nio.LongBuffer get(java.nio.LongBuffer buffer)
Store this vector into the suppliedLongBufferat 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, LongBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this vector inx, yorder- Returns:
- the passed in buffer
- See Also:
get(int, LongBuffer)
-
get
java.nio.LongBuffer get(int index, java.nio.LongBuffer buffer)Store this vector into the suppliedLongBufferstarting 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, yorder- Returns:
- the passed in buffer
-
getToAddress
Vector2Lc getToAddress(long address)
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
Vector2L sub(Vector2Lc v, Vector2L dest)
Subtract the supplied vector from this one and store the result indest.- Parameters:
v- the vector to subtractdest- will hold the result- Returns:
- dest
-
sub
Vector2L sub(long x, long y, Vector2L dest)
Decrement the components of this vector by the given values and store the result indest.- Parameters:
x- the x component to subtracty- the y component to subtractdest- 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
double distance(Vector2Lc v)
Return the distance between this Vector andv.- Parameters:
v- the other vector- Returns:
- the distance
-
distance
double distance(long x, long y)Return the distance betweenthisvector and(x, y).- Parameters:
x- the x component of the other vectory- the y component of the other vector- Returns:
- the euclidean distance
-
distanceSquared
long distanceSquared(Vector2Lc v)
Return the square of the distance between this vector andv.- Parameters:
v- the other vector- Returns:
- the squared of the distance
-
distanceSquared
long distanceSquared(long x, long y)Return the square of the distance betweenthisvector and(x, y).- Parameters:
x- the x component of the other vectory- the y component of the other vector- Returns:
- the square of the distance
-
gridDistance
long gridDistance(Vector2Lc v)
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(long x, long y)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 vector- Returns:
- the grid distance
-
add
Vector2L add(Vector2Lc v, Vector2L dest)
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
Vector2L add(long x, long y, Vector2L dest)
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 adddest- will hold the result- Returns:
- dest
-
mul
Vector2L mul(long scalar, Vector2L dest)
Multiply all components of thisVector2Lcby the given scalar value and store the result indest.- Parameters:
scalar- the scalar to multiply this vector bydest- will hold the result- Returns:
- dest
-
mul
Vector2L mul(Vector2Lc v, Vector2L dest)
Multiply the supplied vector by this one and store the result indest.- Parameters:
v- the vector to multiplydest- will hold the result- Returns:
- dest
-
mul
Vector2L mul(long x, long y, Vector2L dest)
Multiply the components of this vector by the given values and store the result indest.- Parameters:
x- the x component to multiplyy- the y component to multiplydest- will hold the result- Returns:
- dest
-
div
Vector2L div(float scalar, Vector2L dest)
Divide all components of this vector by the given scalar value and store the result indest.- Parameters:
scalar- the scalar to divide bydest- will hold the result- Returns:
- dest
-
div
Vector2L div(long scalar, Vector2L dest)
Divide all components of this vector by the given scalar value and store the result indest.- Parameters:
scalar- the scalar to divide bydest- will hold the result- Returns:
- dest
-
negate
Vector2L negate(Vector2L dest)
Negate this vector and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
min
Vector2L min(Vector2Lc v, Vector2L dest)
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
Vector2L max(Vector2Lc v, Vector2L dest)
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
-
maxComponent
long maxComponent()
Determine the component with the biggest absolute value.- Returns:
- the component index, within
[0..1]
-
minComponent
long minComponent()
Determine the component with the smallest (towards zero) absolute value.- Returns:
- the component index, within
[0..1]
-
absolute
Vector2L absolute(Vector2L dest)
Compute the absolute of each of this vector's components and store the result intodest.- Parameters:
dest- will hold the result- Returns:
- dest
-
get
long get(int component) throws java.lang.IllegalArgumentException
Get the value of the specified component of this vector.- Parameters:
component- the component, within[0..1]- Returns:
- the value
- Throws:
java.lang.IllegalArgumentException- ifcomponentis not within[0..1]
-
equals
boolean equals(long x, long y)Compare the vector components ofthisvector with the given(x, y)and return whether all of them are equal.- Parameters:
x- the x component to compare toy- the y component to compare to- Returns:
trueif all the vector components are equal
-
-