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:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(double x, double y) add
(float x, float y) ceil()
int
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
double
distanceSquared
(double x, double y) double
distanceSquared
(float x, float y) double
div
(double a) div
(double x, double y) div
(float a) div
(float x, float y) double
dot
(double x, double y) double
dot
(float x, float y) double
boolean
floor()
int
floorX()
int
floorY()
static Vector2d
from
(double n) static Vector2d
from
(double x, double y) int
hashCode()
double
length()
double
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 power) pow
(float pow) project
(double x, double y) project
(float x, float y) round()
sub
(double x, double y) sub
(float x, float y) double[]
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) double
x()
double
y()
-
Field Details
-
ZERO
-
UNIT_X
-
UNIT_Y
-
ONE
-
-
Constructor Details
-
Vector2d
-
Vector2d
-
Vector2d
-
Vector2d
public Vector2d(float x, float y) -
Vector2d
public Vector2d(double x, double y)
-
-
Method Details
-
x
public double x() -
withX
-
withX
-
y
public double 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 double dot(float x, float y) -
dot
public double dot(double x, double y) -
project
-
project
-
project
-
pow
-
pow
-
ceil
-
floor
-
round
-
abs
-
negate
-
min
-
min
-
min
-
max
-
max
-
max
-
distanceSquared
-
distanceSquared
public double distanceSquared(float x, float y) -
distanceSquared
public double distanceSquared(double x, double y) -
distance
-
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
-
length
public double 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 double[] toArray() -
toInt
-
toLong
-
toFloat
-
toDouble
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Vector2d>
-
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
-