Package toxi.math

Class SinCosLUT

java.lang.Object
toxi.math.SinCosLUT

public final class SinCosLUT extends Object
Lookup table for fast sine & cosine computations. Tables with varying precisions can be created to which input angles will be rounded to. The sin/cos methods can be used with both positive and negative input angles as with the normal Math.sin()/Math.cos() versions.
  • Field Details

    • DEFAULT_PRECISION

      public static final float DEFAULT_PRECISION
      default precision
      See Also:
  • Constructor Details

    • SinCosLUT

      public SinCosLUT()
    • SinCosLUT

      public SinCosLUT(float precision)
  • Method Details

    • getDefaultInstance

      public static final SinCosLUT getDefaultInstance()
    • cos

      public final float cos(float theta)
      Calculate cosine for the passed in angle in radians.
      Parameters:
      theta -
      Returns:
      cosine value for theta
    • getPeriod

      public int getPeriod()
    • getPrecision

      public float getPrecision()
    • getSinLUT

      public float[] getSinLUT()
    • sin

      public final float sin(float theta)
      Calculates sine for the passed angle in radians.
      Parameters:
      theta -
      Returns:
      sine value for theta