Package cn.nukkit.math
Class Vector3f
java.lang.Object
cn.nukkit.math.Vector3f
- All Implemented Interfaces:
Cloneable
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
float
float
float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(float x) add
(float x, float y) add
(float x, float y, float z) ceil()
clone()
Calculates the cross product of this Vector and the given Vectordouble
double
distanceSquared
(Vector3f pos) divide
(float number) float
Scalar Product of this Vector and the Vector supplied.boolean
floor()
float
getAxis
(BlockFace.Axis axis) int
int
int
float
getIntermediateWithXValue
(Vector3f v, float x) Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.getIntermediateWithYValue
(Vector3f v, float y) Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.getIntermediateWithZValue
(Vector3f v, float z) Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.static int
getOppositeSide
(int side) float
getRight()
getSide
(int side) getSide
(int side, int step) float
getSouth()
float
getUp()
float
getWest()
float
getX()
float
getY()
float
getZ()
double
length()
Calculates the Length of this Vectorfloat
float
float
maxPlainDistance
(float x) float
maxPlainDistance
(float x, float z) float
maxPlainDistance
(Vector2f vector) float
multiply
(float number) int
round()
setComponents
(float x, float y, float z) setX
(float x) setY
(float y) setZ
(float z) subtract()
subtract
(float x) subtract
(float x, float y) subtract
(float x, float y, float z) toString()
-
Field Details
-
SIDE_DOWN
public static final int SIDE_DOWN- See Also:
-
SIDE_UP
public static final int SIDE_UP- See Also:
-
SIDE_NORTH
public static final int SIDE_NORTH- See Also:
-
SIDE_SOUTH
public static final int SIDE_SOUTH- See Also:
-
SIDE_WEST
public static final int SIDE_WEST- See Also:
-
SIDE_EAST
public static final int SIDE_EAST- See Also:
-
x
public float x -
y
public float y -
z
public float z
-
-
Constructor Details
-
Vector3f
public Vector3f() -
Vector3f
public Vector3f(float x) -
Vector3f
public Vector3f(float x, float y) -
Vector3f
public Vector3f(float x, float y, float z)
-
-
Method Details
-
getX
public float getX() -
getY
public float getY() -
getZ
public float getZ() -
setX
-
setY
-
setZ
-
getFloorX
public int getFloorX() -
getFloorY
public int getFloorY() -
getFloorZ
public int getFloorZ() -
getRight
public float getRight() -
getUp
public float getUp() -
getForward
public float getForward() -
getSouth
public float getSouth() -
getWest
public float getWest() -
add
-
add
-
add
-
add
-
subtract
-
subtract
-
subtract
-
subtract
-
subtract
-
multiply
-
divide
-
ceil
-
floor
-
round
-
abs
-
getSide
-
getSide
-
getOppositeSide
public static int getOppositeSide(int side) -
distance
-
distanceSquared
-
maxPlainDistance
public float maxPlainDistance() -
maxPlainDistance
public float maxPlainDistance(float x) -
maxPlainDistance
public float maxPlainDistance(float x, float z) -
maxPlainDistance
-
maxPlainDistance
-
length
public double length()Calculates the Length of this Vector- Returns:
- The Length of this Vector.
-
lengthSquared
public float lengthSquared() -
normalize
-
dot
Scalar Product of this Vector and the Vector supplied.- Parameters:
v
- Vector to calculate the scalar product to.- Returns:
- Scalar Product
-
cross
Calculates the cross product of this Vector and the given Vector- Parameters:
v
- the vector to calculate the cross product with.- Returns:
- a Vector at right angle to this and other
-
getIntermediateWithXValue
Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.- Parameters:
v
- vectorx
- x value- Returns:
- intermediate vector
-
getIntermediateWithYValue
Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.- Parameters:
v
- vectory
- y value- Returns:
- intermediate vector
-
getIntermediateWithZValue
Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.- Parameters:
v
- vectorz
- z value- Returns:
- intermediate vector
-
setComponents
-
getAxis
-
toString
-
equals
-
rawHashCode
public int rawHashCode() -
clone
-
asVector3
-
asBlockVector3
-