toxi.math
Class SinCosLUT

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

public final class SinCosLUT
extends java.lang.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 Summary
static float DEFAULT_PRECISION
          default precision
 
Constructor Summary
SinCosLUT()
           
SinCosLUT(float precision)
           
 
Method Summary
 float cos(float theta)
          Calculate cosine for the passed in angle in radians.
static SinCosLUT getDefaultInstance()
           
 int getPeriod()
           
 float getPrecision()
           
 float[] getSinLUT()
           
 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

DEFAULT_PRECISION

public static final float DEFAULT_PRECISION
default precision

See Also:
Constant Field Values
Constructor Detail

SinCosLUT

public SinCosLUT()

SinCosLUT

public SinCosLUT(float precision)
Method Detail

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