Package org.cloudburstmc.server.math
Class NukkitMath
java.lang.Object
org.cloudburstmc.server.math.NukkitMath
author: MagicDroidX
Nukkit Project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intceilDouble(double n)static intceilFloat(float n)static doubleclamp(double value, double min, double max)static intclamp(int value, int min, int max)static intfloorDouble(double n)static intfloorFloat(float n)static doublegetDirection(double diffX, double diffZ)static com.nukkitx.math.vector.Vector3fgetIntermediateWithXValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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.static com.nukkitx.math.vector.Vector3fgetIntermediateWithYValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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.static com.nukkitx.math.vector.Vector3fgetIntermediateWithZValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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 doubleround(double d)static doubleround(double d, int precision)
-
Constructor Details
-
NukkitMath
public NukkitMath()
-
-
Method Details
-
floorDouble
public static int floorDouble(double n) -
ceilDouble
public static int ceilDouble(double n) -
floorFloat
public static int floorFloat(float n) -
ceilFloat
public static int ceilFloat(float n) -
round
public static double round(double d) -
round
public static double round(double d, int precision) -
clamp
public static double clamp(double value, double min, double max) -
clamp
public static int clamp(int value, int min, int max) -
getDirection
public static double getDirection(double diffX, double diffZ) -
getIntermediateWithXValue
public static com.nukkitx.math.vector.Vector3f getIntermediateWithXValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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.- Parameters:
v2- vectorx- x value- Returns:
- intermediate vector
-
getIntermediateWithYValue
public static com.nukkitx.math.vector.Vector3f getIntermediateWithYValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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.- Parameters:
v2- vectory- y value- Returns:
- intermediate vector
-
getIntermediateWithZValue
public static com.nukkitx.math.vector.Vector3f getIntermediateWithZValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, 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.- Parameters:
v2- vectorz- z value- Returns:
- intermediate vector
-