java.lang.Object
org.spongepowered.math.vector.Vector3d
- All Implemented Interfaces:
Serializable
,Comparable<Vector3d>
,Vectord
@Immutable
public final class Vector3d
extends Object
implements Vectord, Comparable<Vector3d>, Serializable
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(double x, double y, double z) add
(float x, float y, float z) ceil()
int
static Vector3d
createDirectionDeg
(double theta, double phi) Gets the direction vector of a certain theta and phi in degrees.static Vector3d
createDirectionDeg
(float theta, float phi) Gets the direction vector of a certain theta and phi in degrees.static Vector3d
createDirectionRad
(double theta, double phi) Gets the direction vector of a certain theta and phi in radians.static Vector3d
createDirectionRad
(float theta, float phi) Gets the direction vector of a certain theta and phi in radians.static Vector3d
createRandomDirection
(Random random) Gets the direction vector of a random pitch and yaw using the random specified.cross
(double x, double y, double z) cross
(float x, float y, float z) double
distance
(double x, double y, double z) double
distance
(float x, float y, float z) double
double
distanceSquared
(double x, double y, double z) double
distanceSquared
(float x, float y, float z) double
div
(double a) div
(double x, double y, double z) div
(float a) div
(float x, float y, float z) double
dot
(double x, double y, double z) double
dot
(float x, float y, float z) double
boolean
floor()
int
floorX()
int
floorY()
int
floorZ()
static Vector3d
from
(double n) static Vector3d
from
(double x, double y, double z) int
hashCode()
double
length()
double
max
(double x, double y, double z) max
(float x, float y, float z) int
maxAxis()
Returns the axis with the maximum value.min
(double x, double y, double z) min
(float x, float y, float z) int
minAxis()
Returns the axis with the minimal value.mul
(double a) mul
(double x, double y, double z) mul
(float a) mul
(float x, float y, float z) negate()
pow
(double power) pow
(float pow) project
(double x, double y, double z) project
(float x, float y, float z) round()
sub
(double x, double y, double z) sub
(float x, float y, float z) double[]
toArray()
toDouble()
toFloat()
toInt()
toLong()
toString()
toVector2
(boolean useZ) toVector4
(double w) toVector4
(float w) double
x()
double
y()
double
z()
-
Field Details
-
ZERO
-
UNIT_X
-
UNIT_Y
-
UNIT_Z
-
ONE
-
RIGHT
-
UP
-
FORWARD
-
-
Constructor Details
-
Vector3d
-
Vector3d
-
Vector3d
-
Vector3d
-
Vector3d
-
Vector3d
public Vector3d(float x, float y, float z) -
Vector3d
public Vector3d(double x, double y, double z)
-
-
Method Details
-
x
public double x() -
y
public double y() -
z
public double z() -
floorX
public int floorX() -
floorY
public int floorY() -
floorZ
public int floorZ() -
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, float z) -
dot
public double dot(double x, double y, double z) -
project
-
project
-
project
-
cross
-
cross
-
cross
-
pow
-
pow
-
ceil
-
floor
-
round
-
abs
-
negate
-
min
-
min
-
min
-
max
-
max
-
max
-
distanceSquared
-
distanceSquared
public double distanceSquared(float x, float y, float z) -
distanceSquared
public double distanceSquared(double x, double y, double z) -
distance
-
distance
public double distance(float x, float y, float z) -
distance
public double distance(double x, double y, double z) -
lengthSquared
public double lengthSquared()- Specified by:
lengthSquared
in interfaceVectord
-
length
public double length() -
normalize
-
minAxis
public int minAxis()Returns the axis with the minimal value. -
maxAxis
public int maxAxis()Returns the axis with the maximum value. -
toVector2
-
toVector2
-
toVector4
-
toVector4
-
toVector4
-
toVectorN
-
toArray
public double[] toArray() -
toInt
-
toLong
-
toFloat
-
toDouble
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Vector3d>
-
equals
-
hashCode
public int hashCode() -
toString
-
from
-
from
-
createRandomDirection
Gets the direction vector of a random pitch and yaw using the random specified.- Parameters:
random
- to use- Returns:
- the random direction vector
-
createDirectionDeg
Gets the direction vector of a certain theta and phi in degrees. This uses the standard math spherical coordinate system.- Parameters:
theta
- in degreesphi
- in degrees- Returns:
- the direction vector
-
createDirectionDeg
Gets the direction vector of a certain theta and phi in degrees. This uses the standard math spherical coordinate system.- Parameters:
theta
- in degreesphi
- in degrees- Returns:
- the direction vector
-
createDirectionRad
Gets the direction vector of a certain theta and phi in radians. This uses the standard math spherical coordinate system.- Parameters:
theta
- in radiansphi
- in radians- Returns:
- the direction vector
-
createDirectionRad
Gets the direction vector of a certain theta and phi in radians. This uses the standard math spherical coordinate system.- Parameters:
theta
- in radiansphi
- in radians- Returns:
- the direction vector
-