org.gwoptics.mathutils
Class TrigLookup

java.lang.Object
  extended by org.gwoptics.mathutils.TrigLookup

public final class TrigLookup
extends java.lang.Object

This class provides access to a much faster version of the cos and sin functions. It generates a table of sin values from 0 to 90 to an accuracy of 0.01 degrees. As the first 90 degrees is just mirrored in the 3 other sections. 90 to 180 is 0 to 90 reversed and 180 to 360 is 0 to 180 inverted. Having a small table is important for performance. If the table is too large it will unlikely be stored in the faster CPU cache and instead in RAM. Although this is still relatively fast. Cosine values are generated by the addition of 90 degrees to sin values. This class should be used when accuracy in cos and sin is not imperative.

Since:
0.3.4
Author:
Daniel Brown 28/6/09

Constructor Summary
TrigLookup()
           
 
Method Summary
static double cos(float value)
          Computes a fast cosine of an angle
static double sin(float a)
          Computes a fast sin of an angle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrigLookup

public TrigLookup()
Method Detail

cos

public static double cos(float value)
Computes a fast cosine of an angle

Parameters:
value -
Returns:

sin

public static double sin(float a)
Computes a fast sin of an angle

Parameters:
value -
Returns:


processing library gwoptics by Daniel Brown and Andreas Freise. (c) 2009 onwards