Message-ID: <35A62FBB.AF821E92@cue.satnet.net> Date: Fri, 10 Jul 1998 10:14:05 -0500 From: "Ronald Patiņo G" MIME-Version: 1.0 To: "djgpp AT delorie DOT com" Subject: About ray casting and look up tables Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Hi I'm learning how to make a ray casting engine, i'm using djgpp, and a friend of mine sent me some source code, but i have a problem with look up tables. I usually calculate them in this way #include float tan_table[320]; float rad; for(ang=0;ang<320;ang++) { rad= ang *(pi/180); tan_table[ang]=tan(rad); } but i was cheking out my friend's code and found #include #define ANG_360 1920 #define ANG_0 0 #define PI 3.1415927 #define TWOPI ( 2 * PI) #define TWOPIDIV360 ( TWOPI / ANG_360) float *tan_table; tan_table = (float *) malloc( sizeof(float) * ANG_360); for(angulo=ANG_0;angulo<=ANG_360;angulo++) { ang_rad = ang * TWOPIDIV360 ; tan_table[ang] = (float)tan(ang_rad); } i have no problem with malloc and c stuff I don't understand why he uses this formula ang_rad = ang * TWOPIDIV360 ; insted of the one i'm using and why he says that 1920 is equivalent to 360 any help will be apreciated than you.