This has been driving me nuts for ages. I have a routine to draw a torus(or n degrees of it) but i cant work out how to generate normals for it.
Please can someone give me some help..
oh - and please dont say - 'just trace a ray' because i'm not all that sure what it means
here is the code for my routine (which i'm sure could be a bit more efficient...any advice welcome)
void CGLtoralSweep:raw(float R, float r, int numr, int numR, float Sweep, GLenum mode)
/* dA1 = change in ang1
* dA2 = change in ang2
float dA1 = 360/(numR*(360/Sweep));
float dA2 = 360/numr;
Sweep = Sweep/dA1;
ang1 = (j*dA1) * (PI/180);
ang2 = (i*dA2) * (PI/180);
float z = (R + r*cos(ang2))* cos(ang1);
float y = (R + r*cos(ang2))* sin(ang1);
float x = r*sin(ang2);
ang1 = ang1 + (dA1 * (PI/180));