We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Look Up Table
Page Index Toggle Pages: 1
Look Up Table (Read 378 times)
Look Up Table
Sep 24th, 2006, 3:40am
 
I'm having a problem getting this lookup table to work.

//Create A Look Up Table
void setup(){
}
void draw(){
 float t = cosine(0);
 println(t);
}
float[] costable = new float[360];
for( int i = 0; i<360; i++) {
 float ang = (360-i)/180;
 ang *= PI;
 costable[i] = cos(ang);
 }
float cosine(int theta) {
 return costable[theta];

float sine(float theta) {
 return costable[theta + 90]
}
Re: Look Up Table
Reply #1 - Sep 24th, 2006, 4:18am
 
this is at least part of the problem:
http://processing.org/faq/bugs.html#integers
Page Index Toggle Pages: 1