org.jsfml.system

## Class Vector2i

• All Implemented Interfaces:
Serializable

```public final class Vector2i
extends Object
implements Serializable```
Represents two-dimensional vectors using integer coordinates and provides arithmetic operations on integral 2D vectors.
Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`int` `x`
The vector's X coordinate.
`int` `y`
The vector's Y coordinate.
`static Vector2i` `ZERO`
The zero vector.
• ### Constructor Summary

Constructors
Constructor and Description
```Vector2i(int x, int y)```
Constructs a new vector with the given coordinates.
`Vector2i(Vector2f v)`
Constructs a new vector by converting a floating point vector.
• ### Method Summary

Methods
Modifier and Type Method and Description
`static Vector2i` ```add(Vector2i a, Vector2i b)```
`static Vector2i` ```componentwiseDiv(Vector2i a, Vector2i b)```
Performs a component-wise division of two vectors.
`static Vector2i` ```componentwiseMul(Vector2i a, Vector2i b)```
Performs a component-wise multiplication of two vectors.
`static Vector2i` ```div(Vector2i a, int s)```
Multiplies a vector by the inverse of a scalar.
`boolean` `equals(Object o)`
`int` `hashCode()`
`static Vector2i` ```mul(Vector2i a, int s)```
Multiplies a vector by a scalar.
`static Vector2i` `neg(Vector2i v)`
Computes the negation of a vector.
`static Vector2i` ```sub(Vector2i a, Vector2i b)```
Subtracts two vectors.
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### ZERO

`public static final Vector2i ZERO`
The zero vector.
• #### x

`public final int x`
The vector's X coordinate.
• #### y

`public final int y`
The vector's Y coordinate.
• ### Constructor Detail

• #### Vector2i

```public Vector2i(int x,
int y)```
Constructs a new vector with the given coordinates.
Parameters:
`x` - the X coordinate.
`y` - the Y coordinate.
• #### Vector2i

`public Vector2i(Vector2f v)`
Constructs a new vector by converting a floating point vector.

The fractions of the coordinates will be cut off.

Parameters:
`v` - the vector to convert.
• ### Method Detail

```public static Vector2i add(Vector2i a,
Vector2i b)```
Parameters:
`a` - the first vector.
`b` - the second vector.
Returns:
a new vector, representing the sum of the two vectors.
• #### sub

```public static Vector2i sub(Vector2i a,
Vector2i b)```
Subtracts two vectors.
Parameters:
`a` - The first vector.
`b` - The second vector.
Returns:
a new vector, representing the difference between the two vectors.
• #### componentwiseMul

```public static Vector2i componentwiseMul(Vector2i a,
Vector2i b)```
Performs a component-wise multiplication of two vectors.
Parameters:
`a` - the left vector.
`b` - the right vector.
Returns:
a new vector, representing the "product" of the two vectors.
• #### componentwiseDiv

```public static Vector2i componentwiseDiv(Vector2i a,
Vector2i b)```
Performs a component-wise division of two vectors.
Parameters:
`a` - the left vector.
`b` - the right vector.
Returns:
a new vector, representing the "quotient" of the two vectors.
• #### mul

```public static Vector2i mul(Vector2i a,
int s)```
Multiplies a vector by a scalar.
Parameters:
`a` - the vector.
`s` - the scalar.
Returns:
a new vector, representing the scaled vector.
• #### div

```public static Vector2i div(Vector2i a,
int s)```
Multiplies a vector by the inverse of a scalar.
Parameters:
`a` - the vector.
`s` - the scalar to multiply by.
Returns:
a new vector, representing the scaled vector.
• #### neg

`public static Vector2i neg(Vector2i v)`
Computes the negation of a vector.
Parameters:
`v` - the vector.
Returns:
a new vector, representing the negation of the given vector.
• #### equals

`public boolean equals(Object o)`
Overrides:
`equals` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`