- java.lang.Object
-
- org.spongepowered.math.vector.Vector3f
-
- All Implemented Interfaces:
Serializable
,Comparable<Vector3f>
,Vectorf
@Immutable public final class Vector3f extends Object implements Vectorf, Comparable<Vector3f>, Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3f
abs()
Vector3f
add(double x, double y, double z)
Vector3f
add(float x, float y, float z)
Vector3f
add(Vector3f v)
Vector3f
ceil()
int
compareTo(Vector3f v)
static Vector3f
createDirectionDeg(double theta, double phi)
Gets the direction vector of a certain theta and phi in degrees.static Vector3f
createDirectionDeg(float theta, float phi)
Gets the direction vector of a certain theta and phi in degrees.static Vector3f
createDirectionRad(double theta, double phi)
Gets the direction vector of a certain theta and phi in radians.static Vector3f
createDirectionRad(float theta, float phi)
Gets the direction vector of a certain theta and phi in radians.static Vector3f
createRandomDirection(Random random)
Gets the direction vector of a random pitch and yaw using the random specified.Vector3f
cross(double x, double y, double z)
Vector3f
cross(float x, float y, float z)
Vector3f
cross(Vector3f v)
float
distance(double x, double y, double z)
float
distance(float x, float y, float z)
float
distance(Vector3f v)
float
distanceSquared(double x, double y, double z)
float
distanceSquared(float x, float y, float z)
float
distanceSquared(Vector3f v)
Vector3f
div(double a)
Vector3f
div(double x, double y, double z)
Vector3f
div(float a)
Vector3f
div(float x, float y, float z)
Vector3f
div(Vector3f v)
float
dot(double x, double y, double z)
float
dot(float x, float y, float z)
float
dot(Vector3f v)
boolean
equals(Object other)
Vector3f
floor()
int
floorX()
int
floorY()
int
floorZ()
static Vector3f
from(float n)
static Vector3f
from(float x, float y, float z)
int
hashCode()
float
length()
float
lengthSquared()
Vector3f
max(double x, double y, double z)
Vector3f
max(float x, float y, float z)
Vector3f
max(Vector3f v)
int
maxAxis()
Returns the axis with the maximum value.Vector3f
min(double x, double y, double z)
Vector3f
min(float x, float y, float z)
Vector3f
min(Vector3f v)
int
minAxis()
Returns the axis with the minimal value.Vector3f
mul(double a)
Vector3f
mul(double x, double y, double z)
Vector3f
mul(float a)
Vector3f
mul(float x, float y, float z)
Vector3f
mul(Vector3f v)
Vector3f
negate()
Vector3f
normalize()
Vector3f
pow(double pow)
Vector3f
pow(float power)
Vector3f
project(double x, double y, double z)
Vector3f
project(float x, float y, float z)
Vector3f
project(Vector3f v)
Vector3f
round()
Vector3f
sub(double x, double y, double z)
Vector3f
sub(float x, float y, float z)
Vector3f
sub(Vector3f v)
float[]
toArray()
Vector3d
toDouble()
Vector3f
toFloat()
Vector3i
toInt()
Vector3l
toLong()
String
toString()
Vector2f
toVector2()
Vector2f
toVector2(boolean useZ)
Vector4f
toVector4()
Vector4f
toVector4(double w)
Vector4f
toVector4(float w)
VectorNf
toVectorN()
float
x()
float
y()
float
z()
-
-
-
Field Detail
-
ZERO
public static final Vector3f ZERO
-
UNIT_X
public static final Vector3f UNIT_X
-
UNIT_Y
public static final Vector3f UNIT_Y
-
UNIT_Z
public static final Vector3f UNIT_Z
-
ONE
public static final Vector3f ONE
-
RIGHT
public static final Vector3f RIGHT
-
UP
public static final Vector3f UP
-
FORWARD
public static final Vector3f FORWARD
-
-
Constructor Detail
-
Vector3f
public Vector3f(Vector2f v)
-
Vector3f
public Vector3f(Vector2f v, double z)
-
Vector3f
public Vector3f(Vector2f v, float z)
-
Vector3f
public Vector3f(Vector4f v)
-
Vector3f
public Vector3f(VectorNf v)
-
Vector3f
public Vector3f(double x, double y, double z)
-
Vector3f
public Vector3f(float x, float y, float z)
-
-
Method Detail
-
x
public float x()
-
y
public float y()
-
z
public float z()
-
floorX
public int floorX()
-
floorY
public int floorY()
-
floorZ
public int floorZ()
-
add
public Vector3f add(double x, double y, double z)
-
add
public Vector3f add(float x, float y, float z)
-
sub
public Vector3f sub(double x, double y, double z)
-
sub
public Vector3f sub(float x, float y, float z)
-
mul
public Vector3f mul(double a)
-
mul
public Vector3f mul(double x, double y, double z)
-
mul
public Vector3f mul(float x, float y, float z)
-
div
public Vector3f div(double a)
-
div
public Vector3f div(double x, double y, double z)
-
div
public Vector3f div(float x, float y, float z)
-
dot
public float dot(Vector3f v)
-
dot
public float dot(double x, double y, double z)
-
dot
public float dot(float x, float y, float z)
-
project
public Vector3f project(double x, double y, double z)
-
project
public Vector3f project(float x, float y, float z)
-
cross
public Vector3f cross(double x, double y, double z)
-
cross
public Vector3f cross(float x, float y, float z)
-
pow
public Vector3f pow(double pow)
-
min
public Vector3f min(double x, double y, double z)
-
min
public Vector3f min(float x, float y, float z)
-
max
public Vector3f max(double x, double y, double z)
-
max
public Vector3f max(float x, float y, float z)
-
distanceSquared
public float distanceSquared(Vector3f v)
-
distanceSquared
public float distanceSquared(double x, double y, double z)
-
distanceSquared
public float distanceSquared(float x, float y, float z)
-
distance
public float distance(Vector3f v)
-
distance
public float distance(double x, double y, double z)
-
distance
public float distance(float x, float y, float z)
-
lengthSquared
public float lengthSquared()
- Specified by:
lengthSquared
in interfaceVectorf
-
minAxis
public int minAxis()
Returns the axis with the minimal value.
-
maxAxis
public int maxAxis()
Returns the axis with the maximum value.
-
toVector2
public Vector2f toVector2()
-
toVector2
public Vector2f toVector2(boolean useZ)
-
toVector4
public Vector4f toVector4()
-
toVector4
public Vector4f toVector4(double w)
-
toVector4
public Vector4f toVector4(float w)
-
toVectorN
public VectorNf toVectorN()
-
compareTo
public int compareTo(Vector3f v)
- Specified by:
compareTo
in interfaceComparable<Vector3f>
-
from
public static Vector3f from(float n)
-
from
public static Vector3f from(float x, float y, float z)
-
createRandomDirection
public static Vector3f 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 Vector3f 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
-
createDirectionDeg
public static Vector3f 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
-
createDirectionRad
public static Vector3f 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
-
createDirectionRad
public static Vector3f 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
-
-