- 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 Vector2d
abs()
Vector2d
add(double x, double y)
Vector2d
add(float x, float y)
Vector2d
add(Vector2d v)
Vector2d
ceil()
int
compareTo(Vector2d v)
static Vector2d
createDirectionDeg(double angle)
Gets the direction vector of a certain angle in degrees.static Vector2d
createDirectionDeg(float angle)
Gets the direction vector of a certain angle in degrees.static Vector2d
createDirectionRad(double angle)
Gets the direction vector of a certain angle in radians.static Vector2d
createDirectionRad(float angle)
Gets the direction vector of a certain angle in radians.static Vector2d
createRandomDirection(Random random)
Gets the direction vector of a random angle using the random specified.double
distance(double x, double y)
double
distance(float x, float y)
double
distance(Vector2d v)
double
distanceSquared(double x, double y)
double
distanceSquared(float x, float y)
double
distanceSquared(Vector2d v)
Vector2d
div(double a)
Vector2d
div(double x, double y)
Vector2d
div(float a)
Vector2d
div(float x, float y)
Vector2d
div(Vector2d v)
double
dot(double x, double y)
double
dot(float x, float y)
double
dot(Vector2d v)
boolean
equals(Object other)
Vector2d
floor()
int
floorX()
int
floorY()
static Vector2d
from(double n)
static Vector2d
from(double x, double y)
int
hashCode()
double
length()
double
lengthSquared()
Vector2d
max(double x, double y)
Vector2d
max(float x, float y)
Vector2d
max(Vector2d v)
int
maxAxis()
Return the axis with the maximum value.Vector2d
min(double x, double y)
Vector2d
min(float x, float y)
Vector2d
min(Vector2d v)
int
minAxis()
Return the axis with the minimal value.Vector2d
mul(double a)
Vector2d
mul(double x, double y)
Vector2d
mul(float a)
Vector2d
mul(float x, float y)
Vector2d
mul(Vector2d v)
Vector2d
negate()
Vector2d
normalize()
Vector2d
pow(double power)
Vector2d
pow(float pow)
Vector2d
project(double x, double y)
Vector2d
project(float x, float y)
Vector2d
project(Vector2d v)
Vector2d
round()
Vector2d
sub(double x, double y)
Vector2d
sub(float x, float y)
Vector2d
sub(Vector2d v)
double[]
toArray()
Vector2d
toDouble()
Vector2f
toFloat()
Vector2i
toInt()
Vector2l
toLong()
String
toString()
Vector3d
toVector3()
Vector3d
toVector3(double z)
Vector3d
toVector3(float z)
Vector4d
toVector4()
Vector4d
toVector4(double z, double w)
Vector4d
toVector4(float z, float w)
VectorNd
toVectorN()
double
x()
double
y()
-
-
-
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:
lengthSquared
in 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:
compareTo
in 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
-
-