- 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 Vector3fabs()Vector3fadd(double x, double y, double z)Vector3fadd(float x, float y, float z)Vector3fadd(Vector3f v)Vector3fceil()intcompareTo(Vector3f v)static Vector3fcreateDirectionDeg(double theta, double phi)Gets the direction vector of a certain theta and phi in degrees.static Vector3fcreateDirectionDeg(float theta, float phi)Gets the direction vector of a certain theta and phi in degrees.static Vector3fcreateDirectionRad(double theta, double phi)Gets the direction vector of a certain theta and phi in radians.static Vector3fcreateDirectionRad(float theta, float phi)Gets the direction vector of a certain theta and phi in radians.static Vector3fcreateRandomDirection(Random random)Gets the direction vector of a random pitch and yaw using the random specified.Vector3fcross(double x, double y, double z)Vector3fcross(float x, float y, float z)Vector3fcross(Vector3f v)floatdistance(double x, double y, double z)floatdistance(float x, float y, float z)floatdistance(Vector3f v)floatdistanceSquared(double x, double y, double z)floatdistanceSquared(float x, float y, float z)floatdistanceSquared(Vector3f v)Vector3fdiv(double a)Vector3fdiv(double x, double y, double z)Vector3fdiv(float a)Vector3fdiv(float x, float y, float z)Vector3fdiv(Vector3f v)floatdot(double x, double y, double z)floatdot(float x, float y, float z)floatdot(Vector3f v)booleanequals(Object other)Vector3ffloor()intfloorX()intfloorY()intfloorZ()static Vector3ffrom(float n)static Vector3ffrom(float x, float y, float z)inthashCode()floatlength()floatlengthSquared()Vector3fmax(double x, double y, double z)Vector3fmax(float x, float y, float z)Vector3fmax(Vector3f v)intmaxAxis()Returns the axis with the maximum value.Vector3fmin(double x, double y, double z)Vector3fmin(float x, float y, float z)Vector3fmin(Vector3f v)intminAxis()Returns the axis with the minimal value.Vector3fmul(double a)Vector3fmul(double x, double y, double z)Vector3fmul(float a)Vector3fmul(float x, float y, float z)Vector3fmul(Vector3f v)Vector3fnegate()Vector3fnormalize()Vector3fpow(double pow)Vector3fpow(float power)Vector3fproject(double x, double y, double z)Vector3fproject(float x, float y, float z)Vector3fproject(Vector3f v)Vector3fround()Vector3fsub(double x, double y, double z)Vector3fsub(float x, float y, float z)Vector3fsub(Vector3f v)float[]toArray()Vector3dtoDouble()Vector3ftoFloat()Vector3itoInt()Vector3ltoLong()StringtoString()Vector2ftoVector2()Vector2ftoVector2(boolean useZ)Vector4ftoVector4()Vector4ftoVector4(double w)Vector4ftoVector4(float w)VectorNftoVectorN()floatx()floaty()floatz()
-
-
-
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:
lengthSquaredin 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:
compareToin 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
-
-