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:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(double x, double y) add
(float x, float y) ceil()
int
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
float
distanceSquared
(double x, double y) float
distanceSquared
(float x, float y) float
div
(double a) div
(double x, double y) div
(float a) div
(float x, float y) float
dot
(double x, double y) float
dot
(float x, float y) float
boolean
floor()
int
floorX()
int
floorY()
static Vector2f
from
(float n) static Vector2f
from
(float x, float y) int
hashCode()
float
length()
float
max
(double x, double y) max
(float x, float y) int
maxAxis()
Return the axis with the maximum value.min
(double x, double y) min
(float x, float y) int
minAxis()
Return the axis with the minimal value.mul
(double a) mul
(double x, double y) mul
(float a) mul
(float x, float y) negate()
pow
(double pow) pow
(float power) project
(double x, double y) project
(float x, float y) round()
sub
(double x, double y) sub
(float x, float y) float[]
toArray()
toDouble()
toFloat()
toInt()
toLong()
toString()
toVector3
(double z) toVector3
(float z) toVector4
(double z, double w) toVector4
(float z, float w) withX
(double x) withX
(float x) withY
(double y) withY
(float y) float
x()
float
y()
-
Field Details
-
ZERO
-
UNIT_X
-
UNIT_Y
-
ONE
-
-
Constructor Details
-
Vector2f
-
Vector2f
-
Vector2f
-
Vector2f
public Vector2f(double x, double y) -
Vector2f
public Vector2f(float x, float y)
-
-
Method Details
-
x
public float x() -
withX
-
withX
-
y
public float y() -
withY
-
withY
-
floorX
public int floorX() -
floorY
public int floorY() -
add
-
add
-
add
-
sub
-
sub
-
sub
-
mul
-
mul
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
div
-
div
-
dot
-
dot
public float dot(double x, double y) -
dot
public float dot(float x, float y) -
project
-
project
-
project
-
pow
-
pow
-
ceil
-
floor
-
round
-
abs
-
negate
-
min
-
min
-
min
-
max
-
max
-
max
-
distanceSquared
-
distanceSquared
public float distanceSquared(double x, double y) -
distanceSquared
public float distanceSquared(float x, float y) -
distance
-
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
-
length
public float length() -
normalize
-
minAxis
public int minAxis()Return the axis with the minimal value. -
maxAxis
public int maxAxis()Return the axis with the maximum value. -
toVector3
-
toVector3
-
toVector3
-
toVector4
-
toVector4
-
toVector4
-
toVectorN
-
toArray
public float[] toArray() -
toInt
-
toLong
-
toFloat
-
toDouble
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Vector2f>
-
equals
-
hashCode
public int hashCode() -
toString
-
from
-
from
-
createRandomDirection
Gets the direction vector of a random angle using the random specified.- Parameters:
random
- to use- Returns:
- the random direction vector
-
createDirectionDeg
Gets the direction vector of a certain angle in degrees.- Parameters:
angle
- in degrees- Returns:
- the direction vector
-
createDirectionDeg
Gets the direction vector of a certain angle in degrees.- Parameters:
angle
- in degrees- Returns:
- the direction vector
-
createDirectionRad
Gets the direction vector of a certain angle in radians.- Parameters:
angle
- in radians- Returns:
- the direction vector
-
createDirectionRad
Gets the direction vector of a certain angle in radians.- Parameters:
angle
- in radians- Returns:
- the direction vector
-