public final class Vector2f extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
float |
x
The vector's X coordinate.
|
float |
y
The vector's Y coordinate.
|
static Vector2f |
ZERO
The zero vector.
|
Constructor and Description |
---|
Vector2f(float x,
float y)
Constructs a new vector with the given coordinates.
|
Vector2f(Vector2i v)
Constructs a new vector by converting an integral vector.
|
Modifier and Type | Method and Description |
---|---|
static Vector2f |
add(Vector2f a,
Vector2f b)
Adds two vectors.
|
static Vector2f |
componentwiseDiv(Vector2f a,
Vector2f b)
Performs a component-wise division of two vectors.
|
static Vector2f |
componentwiseMul(Vector2f a,
Vector2f b)
Performs a component-wise multiplication of two vectors.
|
static Vector2f |
div(Vector2f a,
float s)
Multiplies a vector by the inverse of a scalar.
|
boolean |
equals(Object o) |
int |
hashCode() |
static Vector2f |
mul(Vector2f a,
float s)
Multiplies a vector by a scalar.
|
static Vector2f |
neg(Vector2f v)
Computes the negation of a vector.
|
static Vector2f |
sub(Vector2f a,
Vector2f b)
Subtracts two vectors.
|
String |
toString() |
public static final Vector2f ZERO
public final float x
public final float y
public Vector2f(float x, float y)
x
- the X coordinate.y
- the Y coordinate.public Vector2f(Vector2i v)
v
- the vector to convert.public static Vector2f add(Vector2f a, Vector2f b)
a
- the first vector.b
- the second vector.public static Vector2f sub(Vector2f a, Vector2f b)
a
- the first vector.b
- the second vector.public static Vector2f componentwiseMul(Vector2f a, Vector2f b)
a
- the first vector.b
- the second vector.public static Vector2f componentwiseDiv(Vector2f a, Vector2f b)
a
- the first vector.b
- the second vector.public static Vector2f mul(Vector2f a, float s)
a
- the vector.s
- the scalar to multiply by.public static Vector2f div(Vector2f a, float s)
a
- the vector.s
- the scalar to divide by.public static Vector2f neg(Vector2f v)
v
- the vector.