Class MathHelpers
java.lang.Object
org.cyclops.evilcraft.core.helper.MathHelpers
Contains helper methods that do some common mathematical calculations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intfactorToBursts(double value, int timing) Convert a double to a natural number taking into account a circular time counter that is able to offset factor values if required.static floatnormalizeAngle_180(float angle) Normalize an angle around 180 degrees so that this value doesn't become too large/small.
-
Constructor Details
-
MathHelpers
public MathHelpers()
-
-
Method Details
-
normalizeAngle_180
public static float normalizeAngle_180(float angle) Normalize an angle around 180 degrees so that this value doesn't become too large/small.- Parameters:
angle- The angle to normalize.- Returns:
- The normalized angle.
-
factorToBursts
public static int factorToBursts(double value, int timing) Convert a double to a natural number taking into account a circular time counter that is able to offset factor values if required. It in fact converts a factor to bursts of natural numbers. For example: value = 0,5; timing = 0 to 1 value = 0,5; timing = 1 to 0 value = 0,5; timing = 2 to 1 ...- Parameters:
value- The input value.timing- The timing value, should increment each time this is called for good results.- Returns:
- The bursted value.
-