Class Vector2L
- java.lang.Object
-
- org.joml.Vector2L
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,Vector2Lc
public class Vector2L extends java.lang.Object implements java.io.Externalizable, java.lang.Cloneable, Vector2Lc
Contains the definition of a vector comprising 2 longs and associated transformations.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Vector2L()Create a newVector2Land initialize its components to zero.Vector2L(double x, double y, int mode)Create a newVector2Land initialize its component values and round using the givenRoundingMode.Vector2L(float x, float y, int mode)Create a newVector2Land initialize its component values and round using the givenRoundingMode.Vector2L(int index, java.nio.ByteBuffer buffer)Create a newVector2Land read this vector from the suppliedByteBufferstarting at the specified absolute buffer position/index.Vector2L(int index, java.nio.LongBuffer buffer)Create a newVector2Land read this vector from the suppliedLongBufferstarting at the specified absolute buffer position/index.Vector2L(long s)Create a newVector2Land initialize both of its components with the given value.Vector2L(long[] xy)Create a newVector2Land initialize its two components from the first two elements of the given array.Vector2L(long x, long y)Create a newVector2Land initialize its components to the given values.Vector2L(java.nio.ByteBuffer buffer)Create a newVector2Land read this vector from the suppliedByteBufferat the current bufferposition.Vector2L(java.nio.LongBuffer buffer)Create a newVector2Land read this vector from the suppliedLongBufferat the current bufferposition.Vector2L(Vector2dc v, int mode)Create a newVector2Land initialize its components to the rounded value of the given vector.Vector2L(Vector2fc v, int mode)Create a newVector2Land initialize its components to the rounded value of the given vector.Vector2L(Vector2ic v)Create a newVector2Land initialize its components to the one of the given vector.Vector2L(Vector2Lc v)Create a newVector2Land initialize its components to the one of the given vector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2Labsolute()Setthisvector's components to their respective absolute values.Vector2Labsolute(Vector2L dest)Compute the absolute of each of this vector's components and store the result intodest.Vector2Ladd(long x, long y)Increment the components of this vector by the given values.Vector2Ladd(long x, long y, Vector2L dest)Increment the components of this vector by the given values and store the result indest.Vector2Ladd(Vector2ic v)Addvto this vector.Vector2Ladd(Vector2ic v, Vector2L dest)Vector2Ladd(Vector2Lc v)Addvto this vector.Vector2Ladd(Vector2Lc v, Vector2L dest)Add the supplied vector to this one and store the result indest.java.lang.Objectclone()doubledistance(long x, long y)Return the distance betweenthisvector and(x, y).static doubledistance(long x1, long y1, long x2, long y2)Return the distance between(x1, y1)and(x2, y2).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).static longdistanceSquared(long x1, long y1, long x2, long y2)Return the squared distance between(x1, y1)and(x2, y2).longdistanceSquared(Vector2Lc v)Return the square of the distance between this vector andv.Vector2Ldiv(float scalar)Divide all components of this vector by the given scalar value.Vector2Ldiv(float scalar, Vector2L dest)Divide all components of this vector by the given scalar value and store the result indest.Vector2Ldiv(long scalar)Divide all components of this vector by the given scalar value.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.booleanequals(java.lang.Object obj)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).inthashCode()doublelength()Return the length of this vector.static doublelength(long x, long y)Get the length of a 2-dimensional single-precision vector.longlengthSquared()Return the length squared of this vector.static longlengthSquared(long x, long y)Get the length squared of a 2-dimensional single-precision vector.Vector2Lmax(Vector2Lc v)Set the components of this vector to be the component-wise maximum of this and the other 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)Set the components of this vector to be the component-wise minimum of this and the other vector.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 scalar)Multiply all components of this vector by the given scalar value.Vector2Lmul(long x, long y)Multiply the components of this vector by the given values.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(Vector2ic v)Add the supplied vector by this one.Vector2Lmul(Vector2ic v, Vector2L dest)Vector2Lmul(Vector2Lc v)Add the supplied vector by this one.Vector2Lmul(Vector2Lc v, Vector2L dest)Multiply the supplied vector by this one and store the result indest.Vector2Lnegate()Negate this vector.Vector2Lnegate(Vector2L dest)Negate this vector and store the result indest.voidreadExternal(java.io.ObjectInput in)Vector2Lset(int index, java.nio.ByteBuffer buffer)Read this vector from the suppliedByteBufferstarting at the specified absolute buffer position/index.Vector2Lset(int index, java.nio.LongBuffer buffer)Read this vector from the suppliedLongBufferstarting at the specified absolute buffer position/index.Vector2Lset(long s)Set the x and y components to the supplied value.Vector2Lset(long[] xy)Set the two components of this vector to the first two elements of the given array.Vector2Lset(long x, long y)Set the x and y components to the supplied values.Vector2Lset(java.nio.ByteBuffer buffer)Read this vector from the suppliedByteBufferat the current bufferposition.Vector2Lset(java.nio.LongBuffer buffer)Read this vector from the suppliedLongBufferat the current bufferposition.Vector2Lset(Vector2dc v)Set this vector to the values of v usingRoundingMode.TRUNCATErounding.Vector2Lset(Vector2dc v, int mode)Set this vector to the values of v using the givenRoundingMode.Vector2Lset(Vector2fc v, int mode)Set this vector to the values of v using the givenRoundingMode.Vector2Lset(Vector2ic v)Set this vector to the values of v.Vector2Lset(Vector2Lc v)Set this vector to the values of v.Vector2LsetComponent(int component, long value)Set the value of the specified component of this vector.Vector2LsetFromAddress(long address)Set the values of this vector by reading 2 integer values from off-heap memory, starting at the given address.Vector2Lsub(long x, long y)Decrement the components of this vector by the given values.Vector2Lsub(long x, long y, Vector2L dest)Decrement the components of this vector by the given values and store the result indest.Vector2Lsub(Vector2ic v)Subtract the supplied vector from this one and store the result inthis.Vector2Lsub(Vector2ic v, Vector2L dest)Vector2Lsub(Vector2Lc v)Subtract the supplied vector from this one and store the result inthis.Vector2Lsub(Vector2Lc v, Vector2L dest)Subtract the supplied vector from this one and store the result indest.java.lang.StringtoString()Return a string representation of this vector.java.lang.StringtoString(java.text.NumberFormat formatter)Return a string representation of this vector by formatting the vector components with the givenNumberFormat.voidwriteExternal(java.io.ObjectOutput out)longx()longy()Vector2Lzero()Set all components to zero.
-
-
-
Constructor Detail
-
Vector2L
public Vector2L()
Create a newVector2Land initialize its components to zero.
-
Vector2L
public Vector2L(long s)
Create a newVector2Land initialize both of its components with the given value.- Parameters:
s- the value of both components
-
Vector2L
public Vector2L(long x, long y)Create a newVector2Land initialize its components to the given values.- Parameters:
x- the x componenty- the y component
-
Vector2L
public Vector2L(float x, float y, int mode)Create a newVector2Land initialize its component values and round using the givenRoundingMode.- Parameters:
x- the x componenty- the y componentmode- theRoundingModeto use
-
Vector2L
public Vector2L(double x, double y, int mode)Create a newVector2Land initialize its component values and round using the givenRoundingMode.- Parameters:
x- the x componenty- the y componentmode- theRoundingModeto use
-
Vector2L
public Vector2L(Vector2Lc v)
Create a newVector2Land initialize its components to the one of the given vector.- Parameters:
v- theVector2Lcto copy the values from
-
Vector2L
public Vector2L(Vector2ic v)
Create a newVector2Land initialize its components to the one of the given vector.- Parameters:
v- theVector2icto copy the values from
-
Vector2L
public Vector2L(Vector2fc v, int mode)
Create a newVector2Land initialize its components to the rounded value of the given vector.- Parameters:
v- theVector2fcto round and copy the values frommode- theRoundingModeto use
-
Vector2L
public Vector2L(Vector2dc v, int mode)
Create a newVector2Land initialize its components to the rounded value of the given vector.- Parameters:
v- theVector2dcto round and copy the values frommode- theRoundingModeto use
-
Vector2L
public Vector2L(long[] xy)
Create a newVector2Land initialize its two components from the first two elements of the given array.- Parameters:
xy- the array containing at least three elements
-
Vector2L
public Vector2L(java.nio.ByteBuffer buffer)
Create a newVector2Land read this vector from 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 read, use
Vector2L(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- values will be read inx, yorder- See Also:
Vector2L(int, ByteBuffer)
-
Vector2L
public Vector2L(int index, java.nio.ByteBuffer buffer)Create a newVector2Land read this vector from 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- values will be read inx, yorder
-
Vector2L
public Vector2L(java.nio.LongBuffer buffer)
Create a newVector2Land read this vector from 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 read, use
Vector2L(int, LongBuffer), taking the absolute position as parameter.- Parameters:
buffer- values will be read inx, yorder- See Also:
Vector2L(int, LongBuffer)
-
Vector2L
public Vector2L(int index, java.nio.LongBuffer buffer)Create a newVector2Land read this vector from 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- values will be read inx, yorder
-
-
Method Detail
-
set
public Vector2L set(long s)
Set the x and y components to the supplied value.- Parameters:
s- scalar value of both components- Returns:
- this
-
set
public Vector2L set(long x, long y)
Set the x and y components to the supplied values.- Parameters:
x- the x componenty- the y component- Returns:
- this
-
set
public Vector2L set(Vector2Lc v)
Set this vector to the values of v.- Parameters:
v- the vector to copy from- Returns:
- this
-
set
public Vector2L set(Vector2ic v)
Set this vector to the values of v.- Parameters:
v- the vector to copy from- Returns:
- this
-
set
public Vector2L set(Vector2dc v)
Set this vector to the values of v usingRoundingMode.TRUNCATErounding.Note that due to the given vector
vstoring the components in double-precision, there is the possibility to lose precision.- Parameters:
v- the vector to copy from- Returns:
- this
-
set
public Vector2L set(Vector2dc v, int mode)
Set this vector to the values of v using the givenRoundingMode.Note that due to the given vector
vstoring the components in double-precision, there is the possibility to lose precision.- Parameters:
v- the vector to copy frommode- theRoundingModeto use- Returns:
- this
-
set
public Vector2L set(Vector2fc v, int mode)
Set this vector to the values of v using the givenRoundingMode.Note that due to the given vector
vstoring the components in double-precision, there is the possibility to lose precision.- Parameters:
v- the vector to copy frommode- theRoundingModeto use- Returns:
- this
-
set
public Vector2L set(long[] xy)
Set the two components of this vector to the first two elements of the given array.- Parameters:
xy- the array containing at least two elements- Returns:
- this
-
set
public Vector2L set(java.nio.ByteBuffer buffer)
Read this vector from 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 read, use
set(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- values will be read inx, yorder- Returns:
- this
- See Also:
set(int, ByteBuffer)
-
set
public Vector2L set(int index, java.nio.ByteBuffer buffer)
Read this vector from 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- values will be read inx, yorder- Returns:
- this
-
set
public Vector2L set(java.nio.LongBuffer buffer)
Read this vector from 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 read, use
set(int, LongBuffer), taking the absolute position as parameter.- Parameters:
buffer- values will be read inx, yorder- Returns:
- this
- See Also:
set(int, LongBuffer)
-
set
public Vector2L set(int index, java.nio.LongBuffer buffer)
Read this vector from 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- values will be read inx, yorder- Returns:
- this
-
setFromAddress
public Vector2L setFromAddress(long address)
Set the values of this vector by reading 2 integer values from off-heap memory, starting at the given 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 memory address to read the vector values from- Returns:
- this
-
get
public long get(int component) throws java.lang.IllegalArgumentExceptionDescription copied from interface:Vector2LcGet the value of the specified component of this vector.
-
setComponent
public Vector2L setComponent(int component, long value) throws java.lang.IllegalArgumentException
Set the value of the specified component of this vector.- Parameters:
component- the component whose value to set, within[0..1]value- the value to set- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- ifcomponentis not within[0..1]
-
get
public java.nio.ByteBuffer get(java.nio.ByteBuffer buffer)
Description copied from interface:Vector2LcStore 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
Vector2Lc.get(int, ByteBuffer), taking the absolute position as parameter.- Specified by:
getin interfaceVector2Lc- Parameters:
buffer- will receive the values of this vector inx, yorder- Returns:
- the passed in buffer
- See Also:
Vector2Lc.get(int, ByteBuffer)
-
get
public java.nio.ByteBuffer get(int index, java.nio.ByteBuffer buffer)Description copied from interface:Vector2LcStore this vector into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
-
get
public java.nio.LongBuffer get(java.nio.LongBuffer buffer)
Description copied from interface:Vector2LcStore 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
Vector2Lc.get(int, LongBuffer), taking the absolute position as parameter.- Specified by:
getin interfaceVector2Lc- Parameters:
buffer- will receive the values of this vector inx, yorder- Returns:
- the passed in buffer
- See Also:
Vector2Lc.get(int, LongBuffer)
-
get
public java.nio.LongBuffer get(int index, java.nio.LongBuffer buffer)Description copied from interface:Vector2LcStore this vector into the suppliedLongBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given IntBuffer.
-
getToAddress
public Vector2Lc getToAddress(long address)
Description copied from interface:Vector2LcStore 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.
- Specified by:
getToAddressin interfaceVector2Lc- Parameters:
address- the off-heap address where to store this vector- Returns:
- this
-
sub
public Vector2L sub(Vector2Lc v)
Subtract the supplied vector from this one and store the result inthis.- Parameters:
v- the vector to subtract- Returns:
- this
-
sub
public Vector2L sub(Vector2Lc v, Vector2L dest)
Description copied from interface:Vector2LcSubtract the supplied vector from this one and store the result indest.
-
sub
public Vector2L sub(Vector2ic v)
Subtract the supplied vector from this one and store the result inthis.- Parameters:
v- the vector to subtract- Returns:
- this
-
sub
public Vector2L sub(long x, long y)
Decrement the components of this vector by the given values.- Parameters:
x- the x component to subtracty- the y component to subtract- Returns:
- this
-
sub
public Vector2L sub(long x, long y, Vector2L dest)
Description copied from interface:Vector2LcDecrement the components of this vector by the given values and store the result indest.
-
lengthSquared
public long lengthSquared()
Description copied from interface:Vector2LcReturn the length squared of this vector.- Specified by:
lengthSquaredin interfaceVector2Lc- Returns:
- the length squared
-
lengthSquared
public static long lengthSquared(long x, long y)Get the length squared of a 2-dimensional single-precision vector.- Parameters:
x- The vector's x componenty- The vector's y component- Returns:
- the length squared of the given vector
-
length
public double length()
Description copied from interface:Vector2LcReturn the length of this vector.
-
length
public static double length(long x, long y)Get the length of a 2-dimensional single-precision vector.- Parameters:
x- The vector's x componenty- The vector's y component- Returns:
- the length squared of the given vector
-
distance
public double distance(Vector2Lc v)
Description copied from interface:Vector2LcReturn the distance between this Vector andv.
-
distance
public double distance(long x, long y)Description copied from interface:Vector2LcReturn the distance betweenthisvector and(x, y).
-
distanceSquared
public long distanceSquared(Vector2Lc v)
Description copied from interface:Vector2LcReturn the square of the distance between this vector andv.- Specified by:
distanceSquaredin interfaceVector2Lc- Parameters:
v- the other vector- Returns:
- the squared of the distance
-
distanceSquared
public long distanceSquared(long x, long y)Description copied from interface:Vector2LcReturn the square of the distance betweenthisvector and(x, y).- Specified by:
distanceSquaredin interfaceVector2Lc- Parameters:
x- the x component of the other vectory- the y component of the other vector- Returns:
- the square of the distance
-
gridDistance
public long gridDistance(Vector2Lc v)
Description copied from interface:Vector2LcReturn the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).- Specified by:
gridDistancein interfaceVector2Lc- Parameters:
v- the other vector- Returns:
- the grid distance
-
gridDistance
public long gridDistance(long x, long y)Description copied from interface:Vector2LcReturn the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance)(x, y).- Specified by:
gridDistancein interfaceVector2Lc- Parameters:
x- the x component of the other vectory- the y component of the other vector- Returns:
- the grid distance
-
distance
public static double distance(long x1, long y1, long x2, long y2)Return the distance between(x1, y1)and(x2, y2).- Parameters:
x1- the x component of the first vectory1- the y component of the first vectorx2- the x component of the second vectory2- the y component of the second vector- Returns:
- the euclidean distance
-
distanceSquared
public static long distanceSquared(long x1, long y1, long x2, long y2)Return the squared distance between(x1, y1)and(x2, y2).- Parameters:
x1- the x component of the first vectory1- the y component of the first vectorx2- the x component of the second vectory2- the y component of the second vector- Returns:
- the euclidean distance squared
-
add
public Vector2L add(Vector2Lc v)
Addvto this vector.- Parameters:
v- the vector to add- Returns:
- this
-
add
public Vector2L add(Vector2Lc v, Vector2L dest)
Description copied from interface:Vector2LcAdd the supplied vector to this one and store the result indest.
-
add
public Vector2L add(Vector2ic v)
Addvto this vector.- Parameters:
v- the vector to add- Returns:
- this
-
add
public Vector2L add(long x, long y)
Increment the components of this vector by the given values.- Parameters:
x- the x component to addy- the y component to add- Returns:
- this
-
add
public Vector2L add(long x, long y, Vector2L dest)
Description copied from interface:Vector2LcIncrement the components of this vector by the given values and store the result indest.
-
mul
public Vector2L mul(long scalar)
Multiply all components of this vector by the given scalar value.- Parameters:
scalar- the scalar to multiply this vector by- Returns:
- this
-
mul
public Vector2L mul(long scalar, Vector2L dest)
Description copied from interface:Vector2LcMultiply all components of thisVector2Lcby the given scalar value and store the result indest.
-
mul
public Vector2L mul(Vector2Lc v)
Add the supplied vector by this one.- Parameters:
v- the vector to multiply- Returns:
- this
-
mul
public Vector2L mul(Vector2Lc v, Vector2L dest)
Description copied from interface:Vector2LcMultiply the supplied vector by this one and store the result indest.
-
mul
public Vector2L mul(Vector2ic v)
Add the supplied vector by this one.- Parameters:
v- the vector to multiply- Returns:
- this
-
mul
public Vector2L mul(long x, long y)
Multiply the components of this vector by the given values.- Parameters:
x- the x component to multiplyy- the y component to multiply- Returns:
- this
-
mul
public Vector2L mul(long x, long y, Vector2L dest)
Description copied from interface:Vector2LcMultiply the components of this vector by the given values and store the result indest.
-
div
public Vector2L div(float scalar)
Divide all components of this vector by the given scalar value.- Parameters:
scalar- the scalar to divide by- Returns:
- a vector holding the result
-
div
public Vector2L div(float scalar, Vector2L dest)
Description copied from interface:Vector2LcDivide all components of this vector by the given scalar value and store the result indest.
-
div
public Vector2L div(long scalar)
Divide all components of this vector by the given scalar value.- Parameters:
scalar- the scalar to divide by- Returns:
- a vector holding the result
-
div
public Vector2L div(long scalar, Vector2L dest)
Description copied from interface:Vector2LcDivide all components of this vector by the given scalar value and store the result indest.
-
zero
public Vector2L zero()
Set all components to zero.- Returns:
- this
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
negate
public Vector2L negate()
Negate this vector.- Returns:
- this
-
negate
public Vector2L negate(Vector2L dest)
Description copied from interface:Vector2LcNegate this vector and store the result indest.
-
min
public Vector2L min(Vector2Lc v)
Set the components of this vector to be the component-wise minimum of this and the other vector.- Parameters:
v- the other vector- Returns:
- this
-
min
public Vector2L min(Vector2Lc v, Vector2L dest)
Description copied from interface:Vector2LcSet the components ofdestto be the component-wise minimum of this and the other vector.
-
max
public Vector2L max(Vector2Lc v)
Set the components of this vector to be the component-wise maximum of this and the other vector.- Parameters:
v- the other vector- Returns:
- this
-
max
public Vector2L max(Vector2Lc v, Vector2L dest)
Description copied from interface:Vector2LcSet the components ofdestto be the component-wise maximum of this and the other vector.
-
maxComponent
public long maxComponent()
Description copied from interface:Vector2LcDetermine the component with the biggest absolute value.- Specified by:
maxComponentin interfaceVector2Lc- Returns:
- the component index, within
[0..1]
-
minComponent
public long minComponent()
Description copied from interface:Vector2LcDetermine the component with the smallest (towards zero) absolute value.- Specified by:
minComponentin interfaceVector2Lc- Returns:
- the component index, within
[0..1]
-
absolute
public Vector2L absolute()
Setthisvector's components to their respective absolute values.- Returns:
- this
-
absolute
public Vector2L absolute(Vector2L dest)
Description copied from interface:Vector2LcCompute the absolute of each of this vector's components and store the result intodest.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
equals
public boolean equals(long x, long y)Description copied from interface:Vector2LcCompare the vector components ofthisvector with the given(x, y)and return whether all of them are equal.
-
toString
public java.lang.String toString()
Return a string representation of this vector.This method creates a new
DecimalFormaton every invocation with the format string "0.000E0;-".- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
-
toString
public java.lang.String toString(java.text.NumberFormat formatter)
Return a string representation of this vector by formatting the vector components with the givenNumberFormat.- Parameters:
formatter- theNumberFormatused to format the vector components with- Returns:
- the string representation
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-