Class MathHelpers

java.lang.Object
org.cyclops.evilcraft.core.helper.MathHelpers

public class MathHelpers extends Object
Contains helper methods that do some common mathematical calculations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static float
    normalizeAngle_180(float angle)
    Normalize an angle around 180 degrees so that this value doesn't become too large/small.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.