Package org.joml

## Interface Vector2ic

• All Known Implementing Classes:
`Vector2i`

`public interface Vector2ic`
Interface to a read-only view of a 2-dimensional vector of integers.
Author:
Kai Burjack
• ### Method Summary

All Methods
Modifier and Type Method Description
`Vector2i` `absolute​(Vector2i dest)`
Compute the absolute of each of this vector's components and store the result into `dest`.
`Vector2i` ```add​(int x, int y, Vector2i dest)```
Increment the components of this vector by the given values and store the result in `dest`.
`Vector2i` ```add​(Vector2ic v, Vector2i dest)```
Add the supplied vector to this one and store the result in `dest`.
`double` ```distance​(int x, int y)```
Return the distance between `this` vector and `(x, y)`.
`double` `distance​(Vector2ic v)`
Return the distance between this Vector and `v`.
`long` ```distanceSquared​(int x, int y)```
Return the square of the distance between `this` vector and `(x, y)`.
`long` `distanceSquared​(Vector2ic v)`
Return the square of the distance between this vector and `v`.
`Vector2i` ```div​(float scalar, Vector2i dest)```
Divide all components of this `Vector2i` by the given scalar value and store the result in `dest`.
`Vector2i` ```div​(int scalar, Vector2i dest)```
Divide all components of this `Vector2i` by the given scalar value and store the result in `dest`.
`boolean` ```equals​(int x, int y)```
Compare the vector components of `this` vector with the given `(x, y)` and return whether all of them are equal.
`int` `get​(int component)`
Get the value of the specified component of this vector.
`java.nio.ByteBuffer` ```get​(int index, java.nio.ByteBuffer buffer)```
Store this vector into the supplied `ByteBuffer` starting at the specified absolute buffer position/index.
`java.nio.IntBuffer` ```get​(int index, java.nio.IntBuffer buffer)```
Store this vector into the supplied `IntBuffer` starting at the specified absolute buffer position/index.
`java.nio.ByteBuffer` `get​(java.nio.ByteBuffer buffer)`
Store this vector into the supplied `ByteBuffer` at the current buffer `position`.
`java.nio.IntBuffer` `get​(java.nio.IntBuffer buffer)`
Store this vector into the supplied `IntBuffer` at the current buffer `position`.
`Vector2ic` `getToAddress​(long address)`
Store this vector at the given off-heap memory address.
`long` ```gridDistance​(int x, int y)```
Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) `(x, y)`.
`long` `gridDistance​(Vector2ic v)`
Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) `(x, y)`.
`double` `length()`
Return the length of this vector.
`long` `lengthSquared()`
Return the length squared of this vector.
`Vector2i` ```max​(Vector2ic v, Vector2i 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.
`Vector2i` ```min​(Vector2ic v, Vector2i 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.
`Vector2i` ```mul​(int x, int y, Vector2i dest)```
Multiply the components of this vector by the given values and store the result in `dest`.
`Vector2i` ```mul​(int scalar, Vector2i dest)```
Multiply all components of this `Vector2ic` by the given scalar value and store the result in `dest`.
`Vector2i` ```mul​(Vector2ic v, Vector2i dest)```
Multiply the supplied vector by this one and store the result in `dest`.
`Vector2i` `negate​(Vector2i dest)`
Negate this vector and store the result in `dest`.
`Vector2i` ```sub​(int x, int y, Vector2i dest)```
Decrement the components of this vector by the given values and store the result in `dest`.
`Vector2i` ```sub​(Vector2ic v, Vector2i dest)```
Subtract the supplied vector from this one and store the result in `dest`.
`int` `x()`
`int` `y()`
• ### Method Detail

• #### x

`int x()`
Returns:
the value of the x component
• #### y

`int y()`
Returns:
the value of the y component
• #### get

`java.nio.ByteBuffer get​(java.nio.ByteBuffer buffer)`
Store this vector into 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 stored, use `get(int, ByteBuffer)`, taking the absolute position as parameter.

Parameters:
`buffer` - will receive the values of this vector in `x, y` order
Returns:
the passed in buffer
`get(int, ByteBuffer)`
• #### get

```java.nio.ByteBuffer get​(int index,
java.nio.ByteBuffer buffer)```
Store this vector into the supplied `ByteBuffer` starting 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 ByteBuffer
`buffer` - will receive the values of this vector in `x, y` order
Returns:
the passed in buffer
• #### get

`java.nio.IntBuffer get​(java.nio.IntBuffer buffer)`
Store this vector into the supplied `IntBuffer` at the current buffer `position`.

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 in `x, y` order
Returns:
the passed in buffer
`get(int, IntBuffer)`
• #### get

```java.nio.IntBuffer get​(int index,
java.nio.IntBuffer buffer)```
Store this vector into the supplied `IntBuffer` starting 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 IntBuffer
`buffer` - will receive the values of this vector in `x, y` order
Returns:
the passed in buffer

`Vector2ic getToAddress​(long address)`
Store this vector at the given off-heap memory 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.

Parameters:
`address` - the off-heap address where to store this vector
Returns:
this
• #### sub

```Vector2i sub​(Vector2ic v,
Vector2i dest)```
Subtract the supplied vector from this one and store the result in `dest`.
Parameters:
`v` - the vector to subtract
`dest` - will hold the result
Returns:
dest
• #### sub

```Vector2i sub​(int x,
int y,
Vector2i dest)```
Decrement the components of this vector by the given values and store the result in `dest`.
Parameters:
`x` - the x component to subtract
`y` - the y component to subtract
`dest` - 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​(Vector2ic v)`
Return the distance between this Vector and `v`.
Parameters:
`v` - the other vector
Returns:
the distance
• #### distance

```double distance​(int x,
int y)```
Return the distance between `this` vector and `(x, y)`.
Parameters:
`x` - the x component of the other vector
`y` - the y component of the other vector
Returns:
the euclidean distance
• #### distanceSquared

`long distanceSquared​(Vector2ic v)`
Return the square of the distance between this vector and `v`.
Parameters:
`v` - the other vector
Returns:
the squared of the distance
• #### distanceSquared

```long distanceSquared​(int x,
int y)```
Return the square of the distance between `this` vector and `(x, y)`.
Parameters:
`x` - the x component of the other vector
`y` - the y component of the other vector
Returns:
the square of the distance
• #### gridDistance

`long gridDistance​(Vector2ic 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​(int x,
int y)```
Return the grid distance in between (aka 1-Norm, Minkowski or Manhattan distance) `(x, y)`.
Parameters:
`x` - the x component of the other vector
`y` - the y component of the other vector
Returns:
the grid distance

```Vector2i add​(Vector2ic v,
Vector2i dest)```
Add the supplied vector to this one and store the result in `dest`.
Parameters:
`v` - the vector to add
`dest` - will hold the result
Returns:
dest

```Vector2i add​(int x,
int y,
Vector2i dest)```
Increment the components of this vector by the given values and store the result in `dest`.
Parameters:
`x` - the x component to add
`y` - the y component to add
`dest` - will hold the result
Returns:
dest
• #### mul

```Vector2i mul​(int scalar,
Vector2i dest)```
Multiply all components of this `Vector2ic` by the given scalar value and store the result in `dest`.
Parameters:
`scalar` - the scalar to multiply this vector by
`dest` - will hold the result
Returns:
dest
• #### mul

```Vector2i mul​(Vector2ic v,
Vector2i dest)```
Multiply the supplied vector by this one and store the result in `dest`.
Parameters:
`v` - the vector to multiply
`dest` - will hold the result
Returns:
dest
• #### mul

```Vector2i mul​(int x,
int y,
Vector2i dest)```
Multiply the components of this vector by the given values and store the result in `dest`.
Parameters:
`x` - the x component to multiply
`y` - the y component to multiply
`dest` - will hold the result
Returns:
dest
• #### div

```Vector2i div​(float scalar,
Vector2i dest)```
Divide all components of this `Vector2i` by the given scalar value and store the result in `dest`.
Parameters:
`scalar` - the scalar to divide by
`dest` - will hold the result
Returns:
dest
• #### div

```Vector2i div​(int scalar,
Vector2i dest)```
Divide all components of this `Vector2i` by the given scalar value and store the result in `dest`.
Parameters:
`scalar` - the scalar to divide by
`dest` - will hold the result
Returns:
dest
• #### negate

`Vector2i negate​(Vector2i dest)`
Negate this vector and store the result in `dest`.
Parameters:
`dest` - will hold the result
Returns:
dest
• #### min

```Vector2i min​(Vector2ic v,
Vector2i dest)```
Set the components of `dest` to be the component-wise minimum of this and the other vector.
Parameters:
`v` - the other vector
`dest` - will hold the result
Returns:
dest
• #### max

```Vector2i max​(Vector2ic v,
Vector2i dest)```
Set the components of `dest` to be the component-wise maximum of this and the other vector.
Parameters:
`v` - the other vector
`dest` - will hold the result
Returns:
dest
• #### maxComponent

`int maxComponent()`
Determine the component with the biggest absolute value.
Returns:
the component index, within `[0..1]`
• #### minComponent

`int minComponent()`
Determine the component with the smallest (towards zero) absolute value.
Returns:
the component index, within `[0..1]`
• #### absolute

`Vector2i absolute​(Vector2i dest)`
Compute the absolute of each of this vector's components and store the result into `dest`.
Parameters:
`dest` - will hold the result
Returns:
dest
• #### get

```int 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` - if `component` is not within `[0..1]`
• #### equals

```boolean equals​(int x,
int y)```
Compare the vector components of `this` vector with the given `(x, y)` and return whether all of them are equal.
Parameters:
`x` - the x component to compare to
`y` - the y component to compare to
Returns:
`true` if all the vector components are equal