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:
-
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 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.cross
(double x, double y, double z) cross
(float x, float y, float z) float
distance
(double x, double y, double z) float
distance
(float x, float y, float z) float
float
distanceSquared
(double x, double y, double z) float
distanceSquared
(float x, float y, float z) float
div
(double a) div
(double x, double y, double z) div
(float a) div
(float x, float y, float z) float
dot
(double x, double y, double z) float
dot
(float x, float y, float z) float
boolean
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
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 pow) pow
(float power) 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) float[]
toArray()
toDouble()
toFloat()
toInt()
toLong()
toString()
toVector2
(boolean useZ) toVector4
(double w) toVector4
(float w) withX
(double x) withX
(float x) withY
(double y) withY
(float y) withZ
(double z) withZ
(float z) float
x()
float
y()
float
z()
-
Field Details
-
ZERO
-
UNIT_X
-
UNIT_Y
-
UNIT_Z
-
ONE
-
RIGHT
-
UP
-
FORWARD
-
-
Constructor Details
-
Vector3f
-
Vector3f
-
Vector3f
-
Vector3f
-
Vector3f
-
Vector3f
public Vector3f(double x, double y, double z) -
Vector3f
public Vector3f(float x, float y, float z)
-
-
Method Details
-
x
public float x() -
withX
-
withX
-
y
public float y() -
withY
-
withY
-
z
public float z() -
withZ
-
withZ
-
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 float dot(double x, double y, double z) -
dot
public float dot(float x, float y, float z) -
project
-
project
-
project
-
cross
-
cross
-
cross
-
pow
-
pow
-
ceil
-
floor
-
round
-
abs
-
negate
-
min
-
min
-
min
-
max
-
max
-
max
-
distanceSquared
-
distanceSquared
public float distanceSquared(double x, double y, double z) -
distanceSquared
public float distanceSquared(float x, float y, float z) -
distance
-
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
-
length
public float 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 float[] toArray() -
toInt
-
toLong
-
toFloat
-
toDouble
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Vector3f>
-
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
-