mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-26 20:06:28 -08:00
Merge branch 'main' of github.com:SlimeVR/SlimeVR-Server into merge-gui-and-server
This commit is contained in:
commit
d0b117ab36
25 files changed
+1312
-337
No files matched your search
@@ -70,9 +70,59 @@ final public class FastMath {
|
||||
public static final float DEG_TO_RAD = PI / 180.0f;
|
||||
/** A value to multiply a radian value by, to convert it to degrees. */
|
||||
public static final float RAD_TO_DEG = 180.0f / PI;
|
||||
/** A precreated random object for random numbers. */
|
||||
/** A premade random object for random numbers. */
|
||||
public static final Random rand = new Random(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
* Returns true if the number is within the specified {@code tolerance}
|
||||
* value.
|
||||
*
|
||||
* @param value The number to check.
|
||||
* @param tolerance The tolerance to zero (must be positive).
|
||||
* @return True if the number is within the specified {@code tolerance}
|
||||
* value.
|
||||
*/
|
||||
public static boolean isApproxZero(float value, float tolerance) {
|
||||
return value < tolerance && value > tolerance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the number is within the {@link #ZERO_TOLERANCE} value.
|
||||
*
|
||||
* @param value The number to check.
|
||||
* @return True if the number is within the {@link #ZERO_TOLERANCE} value.
|
||||
*/
|
||||
public static boolean isApproxZero(float value) {
|
||||
return isApproxZero(value, ZERO_TOLERANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two numbers are equal within the specified
|
||||
* {@code tolerance} value.
|
||||
*
|
||||
* @param valueOne The first number to check.
|
||||
* @param valueTwo The second number to check.
|
||||
* @param tolerance The tolerance to zero (must be positive).
|
||||
* @return True if the numbers are approximately equal within the specified
|
||||
* {@code tolerance} value.
|
||||
*/
|
||||
public static boolean isApproxEqual(float valueOne, float valueTwo, float tolerance) {
|
||||
return isApproxZero(valueTwo - valueOne, tolerance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two numbers are equal within the
|
||||
* {@link #ZERO_TOLERANCE} value.
|
||||
*
|
||||
* @param valueOne The first number to check.
|
||||
* @param valueTwo The second number to check.
|
||||
* @return True if the numbers are approximately equal within the
|
||||
* {@link #ZERO_TOLERANCE} value.
|
||||
*/
|
||||
public static boolean isApproxEqual(float valueOne, float valueTwo) {
|
||||
return isApproxEqual(valueOne, valueTwo, ZERO_TOLERANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the number is a power of 2 (2,4,8,16...)
|
||||
*
|
||||
@@ -99,7 +149,7 @@ final public class FastMath {
|
||||
*
|
||||
* @param scale scale value to use. if 1, use endValue, if 0, use
|
||||
* startValue.
|
||||
* @param startValue Begining value. 0% of f
|
||||
* @param startValue Beginning value. 0% of f
|
||||
* @param endValue ending value. 100% of f
|
||||
* @return The interpolated value between startValue and endValue.
|
||||
*/
|
||||
@@ -122,7 +172,7 @@ final public class FastMath {
|
||||
*
|
||||
* @param scale scale value to use. if 1, use endValue, if 0, use
|
||||
* startValue.
|
||||
* @param startValue Begining value. 0% of f
|
||||
* @param startValue Beginning value. 0% of f
|
||||
* @param endValue ending value. 100% of f
|
||||
* @param store a vector3f to store the result
|
||||
* @return The interpolated value between startValue and endValue.
|
||||
@@ -148,7 +198,7 @@ final public class FastMath {
|
||||
*
|
||||
* @param scale scale value to use. if 1, use endValue, if 0, use
|
||||
* startValue.
|
||||
* @param startValue Begining value. 0% of f
|
||||
* @param startValue Beginning value. 0% of f
|
||||
* @param endValue ending value. 100% of f
|
||||
* @return The interpolated value between startValue and endValue.
|
||||
*/
|
||||
@@ -392,7 +442,7 @@ final public class FastMath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the lenght on a catmull rom spline between control point 1 and 2
|
||||
* Compute the length on a catmull rom spline between control point 1 and 2
|
||||
*
|
||||
* @param p0 control point 0
|
||||
* @param p1 control point 1
|
||||
@@ -437,7 +487,7 @@ final public class FastMath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the lenght on a bezier spline between control point 1 and 2
|
||||
* Compute the length on a bezier spline between control point 1 and 2
|
||||
*
|
||||
* @param p0 control point 0
|
||||
* @param p1 control point 1
|
||||
@@ -657,7 +707,7 @@ final public class FastMath {
|
||||
/**
|
||||
* Returns the value squared. fValue ^ 2
|
||||
*
|
||||
* @param fValue The vaule to square.
|
||||
* @param fValue The value to square.
|
||||
* @return The square of the given value.
|
||||
*/
|
||||
public static float sqr(float fValue) {
|
||||
|
||||
@@ -279,7 +279,7 @@ public final class Quaternion implements Cloneable, java.io.Serializable {
|
||||
|
||||
/**
|
||||
* <code>toAngles</code> returns this quaternion converted to Euler rotation
|
||||
* angles (yaw,roll,pitch).<br/>
|
||||
* angles (pitch, yaw, roll).<br/>
|
||||
* Note that the result is not always 100% accurate due to the implications
|
||||
* of euler angles.
|
||||
*
|
||||
@@ -288,7 +288,7 @@ public final class Quaternion implements Cloneable, java.io.Serializable {
|
||||
*
|
||||
* @param angles the float[] in which the angles should be stored, or null
|
||||
* if you want a new float[] to be created
|
||||
* @return the float[] in which the angles are stored.
|
||||
* @return the float[] in which the angles are stored (pitch, yaw, roll).
|
||||
*/
|
||||
public float[] toAngles(float[] angles) {
|
||||
if (angles == null) {
|
||||
|
||||
Reference in new issue
Block a user