- 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:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3d
abs()
Vector3d
add(double x, double y, double z)
Vector3d
add(float x, float y, float z)
Vector3d
add(Vector3d v)
Vector3d
ceil()
int
compareTo(Vector3d v)
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.Vector3d
cross(double x, double y, double z)
Vector3d
cross(float x, float y, float z)
Vector3d
cross(Vector3d v)
double
distance(double x, double y, double z)
double
distance(float x, float y, float z)
double
distance(Vector3d v)
double
distanceSquared(double x, double y, double z)
double
distanceSquared(float x, float y, float z)
double
distanceSquared(Vector3d v)
Vector3d
div(double a)
Vector3d
div(double x, double y, double z)
Vector3d
div(float a)
Vector3d
div(float x, float y, float z)
Vector3d
div(Vector3d v)
double
dot(double x, double y, double z)
double
dot(float x, float y, float z)
double
dot(Vector3d v)
boolean
equals(Object other)
Vector3d
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
lengthSquared()
Vector3d
max(double x, double y, double z)
Vector3d
max(float x, float y, float z)
Vector3d
max(Vector3d v)
int
maxAxis()
Returns the axis with the maximum value.Vector3d
min(double x, double y, double z)
Vector3d
min(float x, float y, float z)
Vector3d
min(Vector3d v)
int
minAxis()
Returns the axis with the minimal value.Vector3d
mul(double a)
Vector3d
mul(double x, double y, double z)
Vector3d
mul(float a)
Vector3d
mul(float x, float y, float z)
Vector3d
mul(Vector3d v)
Vector3d
negate()
Vector3d
normalize()
Vector3d
pow(double power)
Vector3d
pow(float pow)
Vector3d
project(double x, double y, double z)
Vector3d
project(float x, float y, float z)
Vector3d
project(Vector3d v)
Vector3d
round()
Vector3d
sub(double x, double y, double z)
Vector3d
sub(float x, float y, float z)
Vector3d
sub(Vector3d v)
double[]
toArray()
Vector3d
toDouble()
Vector3f
toFloat()
Vector3i
toInt()
Vector3l
toLong()
String
toString()
Vector2d
toVector2()
Vector2d
toVector2(boolean useZ)
Vector4d
toVector4()
Vector4d
toVector4(double w)
Vector4d
toVector4(float w)
VectorNd
toVectorN()
double
x()
double
y()
double
z()
-
-
-
Field Detail
-
ZERO
public static final Vector3d ZERO
-
UNIT_X
public static final Vector3d UNIT_X
-
UNIT_Y
public static final Vector3d UNIT_Y
-
UNIT_Z
public static final Vector3d UNIT_Z
-
ONE
public static final Vector3d ONE
-
RIGHT
public static final Vector3d RIGHT
-
UP
public static final Vector3d UP
-
FORWARD
public static final Vector3d FORWARD
-
-
Constructor Detail
-
Vector3d
public Vector3d(Vector2d v)
-
Vector3d
public Vector3d(Vector2d v, float z)
-
Vector3d
public Vector3d(Vector2d v, double z)
-
Vector3d
public Vector3d(Vector4d v)
-
Vector3d
public Vector3d(VectorNd v)
-
Vector3d
public Vector3d(float x, float y, float z)
-
Vector3d
public Vector3d(double x, double y, double z)
-
-
Method Detail
-
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
public Vector3d add(float x, float y, float z)
-
add
public Vector3d add(double x, double y, double z)
-
sub
public Vector3d sub(float x, float y, float z)
-
sub
public Vector3d sub(double x, double y, double z)
-
mul
public Vector3d mul(float a)
-
mul
public Vector3d mul(float x, float y, float z)
-
mul
public Vector3d mul(double x, double y, double z)
-
div
public Vector3d div(float a)
-
div
public Vector3d div(float x, float y, float z)
-
div
public Vector3d div(double x, double y, double z)
-
dot
public double dot(Vector3d v)
-
dot
public double dot(float x, float y, float z)
-
dot
public double dot(double x, double y, double z)
-
project
public Vector3d project(float x, float y, float z)
-
project
public Vector3d project(double x, double y, double z)
-
cross
public Vector3d cross(float x, float y, float z)
-
cross
public Vector3d cross(double x, double y, double z)
-
pow
public Vector3d pow(float pow)
-
min
public Vector3d min(float x, float y, float z)
-
min
public Vector3d min(double x, double y, double z)
-
max
public Vector3d max(float x, float y, float z)
-
max
public Vector3d max(double x, double y, double z)
-
distanceSquared
public double distanceSquared(Vector3d v)
-
distanceSquared
public double distanceSquared(float x, float y, float z)
-
distanceSquared
public double distanceSquared(double x, double y, double z)
-
distance
public double distance(Vector3d v)
-
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
-
minAxis
public int minAxis()
Returns the axis with the minimal value.
-
maxAxis
public int maxAxis()
Returns the axis with the maximum value.
-
toVector2
public Vector2d toVector2()
-
toVector2
public Vector2d toVector2(boolean useZ)
-
toVector4
public Vector4d toVector4()
-
toVector4
public Vector4d toVector4(float w)
-
toVector4
public Vector4d toVector4(double w)
-
toVectorN
public VectorNd toVectorN()
-
compareTo
public int compareTo(Vector3d v)
- Specified by:
compareTo
in interfaceComparable<Vector3d>
-
from
public static Vector3d from(double n)
-
from
public static Vector3d from(double x, double y, double z)
-
createRandomDirection
public static Vector3d createRandomDirection(Random random)
Gets the direction vector of a random pitch and yaw using the random specified.- Parameters:
random
- to use- Returns:
- the random direction vector
-
createDirectionDeg
public static Vector3d createDirectionDeg(float theta, float phi)
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
public static Vector3d createDirectionDeg(double theta, double phi)
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
public static Vector3d createDirectionRad(float theta, float phi)
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
public static Vector3d createDirectionRad(double theta, double phi)
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
-
-