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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()add(double x, double y, double z) add(float x, float y, float z) ceil()intstatic 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.cross(double x, double y, double z) cross(float x, float y, float z) floatdistance(double x, double y, double z) floatdistance(float x, float y, float z) floatfloatdistanceSquared(double x, double y, double z) floatdistanceSquared(float x, float y, float z) floatdiv(double a) div(double x, double y, double z) div(float a) div(float x, float y, float z) floatdot(double x, double y, double z) floatdot(float x, float y, float z) floatbooleanfloor()intfloorX()intfloorY()intfloorZ()static Vector3ffrom(float n) static Vector3ffrom(float x, float y, float z) inthashCode()floatlength()floatmax(double x, double y, double z) max(float x, float y, float z) intmaxAxis()Returns the axis with the maximum value.min(double x, double y, double z) min(float x, float y, float z) intminAxis()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) floatx()floaty()floatz()
-
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:
lengthSquaredin 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:
compareToin 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
-