- java.lang.Object
-
- org.spongepowered.math.vector.Vector2d
-
- All Implemented Interfaces:
Serializable,Comparable<Vector2d>,Vectord
@Immutable public final class Vector2d extends Object implements Vectord, Comparable<Vector2d>, Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2dabs()Vector2dadd(double x, double y)Vector2dadd(float x, float y)Vector2dadd(Vector2d v)Vector2dceil()intcompareTo(Vector2d v)static Vector2dcreateDirectionDeg(double angle)Gets the direction vector of a certain angle in degrees.static Vector2dcreateDirectionDeg(float angle)Gets the direction vector of a certain angle in degrees.static Vector2dcreateDirectionRad(double angle)Gets the direction vector of a certain angle in radians.static Vector2dcreateDirectionRad(float angle)Gets the direction vector of a certain angle in radians.static Vector2dcreateRandomDirection(Random random)Gets the direction vector of a random angle using the random specified.doubledistance(double x, double y)doubledistance(float x, float y)doubledistance(Vector2d v)doubledistanceSquared(double x, double y)doubledistanceSquared(float x, float y)doubledistanceSquared(Vector2d v)Vector2ddiv(double a)Vector2ddiv(double x, double y)Vector2ddiv(float a)Vector2ddiv(float x, float y)Vector2ddiv(Vector2d v)doubledot(double x, double y)doubledot(float x, float y)doubledot(Vector2d v)booleanequals(Object other)Vector2dfloor()intfloorX()intfloorY()static Vector2dfrom(double n)static Vector2dfrom(double x, double y)inthashCode()doublelength()doublelengthSquared()Vector2dmax(double x, double y)Vector2dmax(float x, float y)Vector2dmax(Vector2d v)intmaxAxis()Return the axis with the maximum value.Vector2dmin(double x, double y)Vector2dmin(float x, float y)Vector2dmin(Vector2d v)intminAxis()Return the axis with the minimal value.Vector2dmul(double a)Vector2dmul(double x, double y)Vector2dmul(float a)Vector2dmul(float x, float y)Vector2dmul(Vector2d v)Vector2dnegate()Vector2dnormalize()Vector2dpow(double power)Vector2dpow(float pow)Vector2dproject(double x, double y)Vector2dproject(float x, float y)Vector2dproject(Vector2d v)Vector2dround()Vector2dsub(double x, double y)Vector2dsub(float x, float y)Vector2dsub(Vector2d v)double[]toArray()Vector2dtoDouble()Vector2ftoFloat()Vector2itoInt()Vector2ltoLong()StringtoString()Vector3dtoVector3()Vector3dtoVector3(double z)Vector3dtoVector3(float z)Vector4dtoVector4()Vector4dtoVector4(double z, double w)Vector4dtoVector4(float z, float w)VectorNdtoVectorN()doublex()doubley()
-
-
-
Method Detail
-
x
public double x()
-
y
public double y()
-
floorX
public int floorX()
-
floorY
public int floorY()
-
add
public Vector2d add(float x, float y)
-
add
public Vector2d add(double x, double y)
-
sub
public Vector2d sub(float x, float y)
-
sub
public Vector2d sub(double x, double y)
-
mul
public Vector2d mul(float a)
-
mul
public Vector2d mul(float x, float y)
-
mul
public Vector2d mul(double x, double y)
-
div
public Vector2d div(float a)
-
div
public Vector2d div(float x, float y)
-
div
public Vector2d div(double x, double y)
-
dot
public double dot(Vector2d v)
-
dot
public double dot(float x, float y)
-
dot
public double dot(double x, double y)
-
project
public Vector2d project(float x, float y)
-
project
public Vector2d project(double x, double y)
-
pow
public Vector2d pow(float pow)
-
min
public Vector2d min(float x, float y)
-
min
public Vector2d min(double x, double y)
-
max
public Vector2d max(float x, float y)
-
max
public Vector2d max(double x, double y)
-
distanceSquared
public double distanceSquared(Vector2d v)
-
distanceSquared
public double distanceSquared(float x, float y)
-
distanceSquared
public double distanceSquared(double x, double y)
-
distance
public double distance(Vector2d v)
-
distance
public double distance(float x, float y)
-
distance
public double distance(double x, double y)
-
lengthSquared
public double lengthSquared()
- Specified by:
lengthSquaredin interfaceVectord
-
minAxis
public int minAxis()
Return the axis with the minimal value.
-
maxAxis
public int maxAxis()
Return the axis with the maximum value.
-
toVector3
public Vector3d toVector3()
-
toVector3
public Vector3d toVector3(float z)
-
toVector3
public Vector3d toVector3(double z)
-
toVector4
public Vector4d toVector4()
-
toVector4
public Vector4d toVector4(float z, float w)
-
toVector4
public Vector4d toVector4(double z, double w)
-
toVectorN
public VectorNd toVectorN()
-
compareTo
public int compareTo(Vector2d v)
- Specified by:
compareToin interfaceComparable<Vector2d>
-
from
public static Vector2d from(double n)
-
from
public static Vector2d from(double x, double y)
-
createRandomDirection
public static Vector2d 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 Vector2d createDirectionDeg(float angle)
Gets the direction vector of a certain angle in degrees.- Parameters:
angle- in degrees- Returns:
- the direction vector
-
createDirectionDeg
public static Vector2d createDirectionDeg(double angle)
Gets the direction vector of a certain angle in degrees.- Parameters:
angle- in degrees- Returns:
- the direction vector
-
createDirectionRad
public static Vector2d createDirectionRad(float angle)
Gets the direction vector of a certain angle in radians.- Parameters:
angle- in radians- Returns:
- the direction vector
-
createDirectionRad
public static Vector2d createDirectionRad(double angle)
Gets the direction vector of a certain angle in radians.- Parameters:
angle- in radians- Returns:
- the direction vector
-
-