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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()add(double x, double y) add(float x, float y) ceil()intstatic Vector2fcreateDirectionDeg(double angle) Gets the direction vector of a certain angle in degrees.static Vector2fcreateDirectionDeg(float angle) Gets the direction vector of a certain angle in degrees.static Vector2fcreateDirectionRad(double angle) Gets the direction vector of a certain angle in radians.static Vector2fcreateDirectionRad(float angle) Gets the direction vector of a certain angle in radians.static Vector2fcreateRandomDirection(Random random) Gets the direction vector of a random angle using the random specified.floatdistance(double x, double y) floatdistance(float x, float y) floatfloatdistanceSquared(double x, double y) floatdistanceSquared(float x, float y) floatdiv(double a) div(double x, double y) div(float a) div(float x, float y) floatdot(double x, double y) floatdot(float x, float y) floatbooleanfloor()intfloorX()intfloorY()static Vector2ffrom(float n) static Vector2ffrom(float x, float y) inthashCode()floatlength()floatmax(double x, double y) max(float x, float y) intmaxAxis()Return the axis with the maximum value.min(double x, double y) min(float x, float y) intminAxis()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) floatx()floaty()
-
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:
lengthSquaredin 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:
compareToin 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
-