toxi.math
Class SinCosLUT

java.lang.Object
  extended by toxi.math.SinCosLUT

public class SinCosLUT
extends java.lang.Object

Lookup table for fast sine & cosine computations. The table currently has a fixed precision of 0.25 degrees to which input angles will be rounded to. All methods are static and can be used with both positive and negative input angles.


Field Summary
static float[] cosLUT
          LUT for cosine values
static float SC_INV_PREC
          calculate reciprocal for conversions
static int SC_PERIOD
          compute required table length
static float SC_PRECISION
          set table precision to 0.25 degrees
static float[] sinLUT
          LUT for sine values
 
Constructor Summary
SinCosLUT()
           
 
Method Summary
static float cos(float theta)
          Calculate cosine for the passed in angle in radians.
static float sin(float theta)
          Calculates sine for the passed angle in radians.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SC_PRECISION

public static final float SC_PRECISION
set table precision to 0.25 degrees

See Also:
Constant Field Values

SC_INV_PREC

public static final float SC_INV_PREC
calculate reciprocal for conversions

See Also:
Constant Field Values

SC_PERIOD

public static final int SC_PERIOD
compute required table length

See Also:
Constant Field Values

sinLUT

public static final float[] sinLUT
LUT for sine values


cosLUT

public static final float[] cosLUT
LUT for cosine values

Constructor Detail

SinCosLUT

public SinCosLUT()
Method Detail

sin

public static final float sin(float theta)
Calculates sine for the passed angle in radians.

Parameters:
theta -
Returns:
sine value for theta

cos

public static final float cos(float theta)
Calculate cosine for the passed in angle in radians.

Parameters:
theta -
Returns:
cosine value for theta