Package cn.nukkit.math
Class Vector3
java.lang.Object
cn.nukkit.math.Vector3
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
NamedPosition
,Particle
,Vector3WithRuntimeId
- Author:
- MagicDroidX (Nukkit Project)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(double x) add
(double x, double y) add
(double x, double y, double z) ceil()
clone()
Calculates the cross product of this Vector and the given Vectordouble
distance
(double x, double y, double z) double
int
distanceManhattan
(Vector3 pos) double
distanceSquared
(double x, double y, double z) double
distanceSquared
(Vector3 pos) divide
(double number) double
Scalar Product of this Vector and the Vector supplied.down()
down
(int step) east()
east
(int step) boolean
floor()
double
getAxis
(BlockFace.Axis axis) int
int
int
int
int
int
double
getIntermediateWithXValue
(Vector3 v, double 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
(Vector3 v, double 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
(Vector3 v, double 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.double
getRight()
getSideVec
(BlockFace face) double
getSouth()
double
getUp()
double
getWest()
double
getX()
double
getY()
double
getZ()
int
hashCode()
double
length()
Calculates the Length of this Vectordouble
double
double
maxPlainDistance
(double x) double
maxPlainDistance
(double x, double z) double
maxPlainDistance
(Vector2 vector) double
multiply
(double number) north()
north
(int step) int
round()
setComponents
(double x, double y, double z) setComponents
(Vector3 pos) setComponentsAdding
(double x, double y, double z, double ax, double ay, double az) setComponentsAdding
(Vector3 pos, BlockFace face) setX
(double x) setY
(double y) setZ
(double z) south()
south
(int step) subtract()
Deprecated.subtract
(double x) subtract
(double x, double y) subtract
(double x, double y, double z) toString()
up()
up
(int step) west()
west
(int step)
-
Field Details
-
ZERO
-
x
public double x -
y
public double y -
z
public double z
-
-
Constructor Details
-
Vector3
public Vector3() -
Vector3
public Vector3(double x) -
Vector3
public Vector3(double x, double y) -
Vector3
public Vector3(double x, double y, double z)
-
-
Method Details
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
setX
-
setY
-
setZ
-
getFloorX
public int getFloorX() -
getFloorY
public int getFloorY() -
getFloorZ
public int getFloorZ() -
getChunkX
public int getChunkX() -
getChunkZ
public int getChunkZ() -
getChunkSectionY
-
getChunkVector
-
getRight
public double getRight() -
getUp
public double getUp() -
getForward
public double getForward() -
getSouth
public double getSouth() -
getWest
public double getWest() -
add
-
add
-
add
-
add
-
subtract
@Deprecated @DeprecationDetails(since="1.4.0.0-PN", reason="Makes no sense", replaceWith="clone()") public Vector3 subtract()Deprecated. -
subtract
-
subtract
-
subtract
-
subtract
-
multiply
-
divide
-
ceil
-
floor
-
round
-
abs
-
getSide
-
getSide
-
getSideVec
-
up
-
up
-
down
-
down
-
north
-
north
-
south
-
south
-
east
-
east
-
west
-
west
-
distanceManhattan
-
distance
-
distanceSquared
-
distance
-
distanceSquared
-
maxPlainDistance
public double maxPlainDistance() -
maxPlainDistance
public double maxPlainDistance(double x) -
maxPlainDistance
public double maxPlainDistance(double x, double z) -
maxPlainDistance
-
maxPlainDistance
-
length
public double length()Calculates the Length of this Vector- Returns:
- The Length of this Vector.
-
lengthSquared
public double 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
-
setComponentsAdding
@PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public Vector3 setComponentsAdding(double x, double y, double z, double ax, double ay, double az) -
setComponentsAdding
@PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public Vector3 setComponentsAdding(@NotNull Vector3 pos, @NotNull BlockFace face) -
setComponents
-
getAxis
-
toString
-
equals
-
hashCode
public int hashCode() -
rawHashCode
public int rawHashCode() -
clone
-
asVector3f
-
asBlockVector3
-