- java.lang.Object
-
- org.spongepowered.math.vector.Vector2f
-
- All Implemented Interfaces:
Serializable
,Comparable<Vector2f>
,Vectorf
@Immutable public final class Vector2f extends Object implements Vectorf, Comparable<Vector2f>, Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2f
abs()
Vector2f
add(double x, double y)
Vector2f
add(float x, float y)
Vector2f
add(Vector2f v)
Vector2f
ceil()
int
compareTo(Vector2f v)
static Vector2f
createDirectionDeg(double angle)
Gets the direction vector of a certain angle in degrees.static Vector2f
createDirectionDeg(float angle)
Gets the direction vector of a certain angle in degrees.static Vector2f
createDirectionRad(double angle)
Gets the direction vector of a certain angle in radians.static Vector2f
createDirectionRad(float angle)
Gets the direction vector of a certain angle in radians.static Vector2f
createRandomDirection(Random random)
Gets the direction vector of a random angle using the random specified.float
distance(double x, double y)
float
distance(float x, float y)
float
distance(Vector2f v)
float
distanceSquared(double x, double y)
float
distanceSquared(float x, float y)
float
distanceSquared(Vector2f v)
Vector2f
div(double a)
Vector2f
div(double x, double y)
Vector2f
div(float a)
Vector2f
div(float x, float y)
Vector2f
div(Vector2f v)
float
dot(double x, double y)
float
dot(float x, float y)
float
dot(Vector2f v)
boolean
equals(Object other)
Vector2f
floor()
int
floorX()
int
floorY()
static Vector2f
from(float n)
static Vector2f
from(float x, float y)
int
hashCode()
float
length()
float
lengthSquared()
Vector2f
max(double x, double y)
Vector2f
max(float x, float y)
Vector2f
max(Vector2f v)
int
maxAxis()
Return the axis with the maximum value.Vector2f
min(double x, double y)
Vector2f
min(float x, float y)
Vector2f
min(Vector2f v)
int
minAxis()
Return the axis with the minimal value.Vector2f
mul(double a)
Vector2f
mul(double x, double y)
Vector2f
mul(float a)
Vector2f
mul(float x, float y)
Vector2f
mul(Vector2f v)
Vector2f
negate()
Vector2f
normalize()
Vector2f
pow(double pow)
Vector2f
pow(float power)
Vector2f
project(double x, double y)
Vector2f
project(float x, float y)
Vector2f
project(Vector2f v)
Vector2f
round()
Vector2f
sub(double x, double y)
Vector2f
sub(float x, float y)
Vector2f
sub(Vector2f v)
float[]
toArray()
Vector2d
toDouble()
Vector2f
toFloat()
Vector2i
toInt()
Vector2l
toLong()
String
toString()
Vector3f
toVector3()
Vector3f
toVector3(double z)
Vector3f
toVector3(float z)
Vector4f
toVector4()
Vector4f
toVector4(double z, double w)
Vector4f
toVector4(float z, float w)
VectorNf
toVectorN()
float
x()
float
y()
-
-
-
Method Detail
-
x
public float x()
-
y
public float y()
-
floorX
public int floorX()
-
floorY
public int floorY()
-
add
public Vector2f add(double x, double y)
-
add
public Vector2f add(float x, float y)
-
sub
public Vector2f sub(double x, double y)
-
sub
public Vector2f sub(float x, float y)
-
mul
public Vector2f mul(double a)
-
mul
public Vector2f mul(double x, double y)
-
mul
public Vector2f mul(float x, float y)
-
div
public Vector2f div(double a)
-
div
public Vector2f div(double x, double y)
-
div
public Vector2f div(float x, float y)
-
dot
public float dot(Vector2f v)
-
dot
public float dot(double x, double y)
-
dot
public float dot(float x, float y)
-
project
public Vector2f project(double x, double y)
-
project
public Vector2f project(float x, float y)
-
pow
public Vector2f pow(double pow)
-
min
public Vector2f min(double x, double y)
-
min
public Vector2f min(float x, float y)
-
max
public Vector2f max(double x, double y)
-
max
public Vector2f max(float x, float y)
-
distanceSquared
public float distanceSquared(Vector2f v)
-
distanceSquared
public float distanceSquared(double x, double y)
-
distanceSquared
public float distanceSquared(float x, float y)
-
distance
public float distance(Vector2f v)
-
distance
public float distance(double x, double y)
-
distance
public float distance(float x, float y)
-
lengthSquared
public float lengthSquared()
- Specified by:
lengthSquared
in interfaceVectorf
-
minAxis
public int minAxis()
Return the axis with the minimal value.
-
maxAxis
public int maxAxis()
Return the axis with the maximum value.
-
toVector3
public Vector3f toVector3()
-
toVector3
public Vector3f toVector3(double z)
-
toVector3
public Vector3f toVector3(float z)
-
toVector4
public Vector4f toVector4()
-
toVector4
public Vector4f toVector4(double z, double w)
-
toVector4
public Vector4f toVector4(float z, float w)
-
toVectorN
public VectorNf toVectorN()
-
compareTo
public int compareTo(Vector2f v)
- Specified by:
compareTo
in interfaceComparable<Vector2f>
-
from
public static Vector2f from(float n)
-
from
public static Vector2f from(float x, float y)
-
createRandomDirection
public static Vector2f createRandomDirection(Random random)
Gets the direction vector of a random angle using the random specified.- Parameters:
random
- to use- Returns:
- the random direction vector
-
createDirectionDeg
public static Vector2f createDirectionDeg(double angle)
Gets the direction vector of a certain angle in degrees.- Parameters:
angle
- in degrees- Returns:
- the direction vector
-
createDirectionDeg
public static Vector2f createDirectionDeg(float angle)
Gets the direction vector of a certain angle in degrees.- Parameters:
angle
- in degrees- Returns:
- the direction vector
-
createDirectionRad
public static Vector2f createDirectionRad(double angle)
Gets the direction vector of a certain angle in radians.- Parameters:
angle
- in radians- Returns:
- the direction vector
-
createDirectionRad
public static Vector2f createDirectionRad(float angle)
Gets the direction vector of a certain angle in radians.- Parameters:
angle
- in radians- Returns:
- the direction vector
-
-