- 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 Vector2fabs()Vector2fadd(double x, double y)Vector2fadd(float x, float y)Vector2fadd(Vector2f v)Vector2fceil()intcompareTo(Vector2f v)static 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)floatdistance(Vector2f v)floatdistanceSquared(double x, double y)floatdistanceSquared(float x, float y)floatdistanceSquared(Vector2f v)Vector2fdiv(double a)Vector2fdiv(double x, double y)Vector2fdiv(float a)Vector2fdiv(float x, float y)Vector2fdiv(Vector2f v)floatdot(double x, double y)floatdot(float x, float y)floatdot(Vector2f v)booleanequals(Object other)Vector2ffloor()intfloorX()intfloorY()static Vector2ffrom(float n)static Vector2ffrom(float x, float y)inthashCode()floatlength()floatlengthSquared()Vector2fmax(double x, double y)Vector2fmax(float x, float y)Vector2fmax(Vector2f v)intmaxAxis()Return the axis with the maximum value.Vector2fmin(double x, double y)Vector2fmin(float x, float y)Vector2fmin(Vector2f v)intminAxis()Return the axis with the minimal value.Vector2fmul(double a)Vector2fmul(double x, double y)Vector2fmul(float a)Vector2fmul(float x, float y)Vector2fmul(Vector2f v)Vector2fnegate()Vector2fnormalize()Vector2fpow(double pow)Vector2fpow(float power)Vector2fproject(double x, double y)Vector2fproject(float x, float y)Vector2fproject(Vector2f v)Vector2fround()Vector2fsub(double x, double y)Vector2fsub(float x, float y)Vector2fsub(Vector2f v)float[]toArray()Vector2dtoDouble()Vector2ftoFloat()Vector2itoInt()Vector2ltoLong()StringtoString()Vector3ftoVector3()Vector3ftoVector3(double z)Vector3ftoVector3(float z)Vector4ftoVector4()Vector4ftoVector4(double z, double w)Vector4ftoVector4(float z, float w)VectorNftoVectorN()floatx()floaty()
-
-
-
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:
lengthSquaredin 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:
compareToin 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
-
-