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 › whats this equation dng?
Page Index Toggle Pages: 1
whats this equation dng??? (Read 615 times)
whats this equation dng???
May 5th, 2010, 1:40pm
 
i am spinning a teapot
void
motion(int x, int y)
{
spin = (spin + (x - begin)) % 360;
 begin = x;
 glutPostRedisplay();
}
Re: whats this equation dng???
Reply #1 - May 5th, 2010, 8:23pm
 
Your function is updating the value of a (I assume) variable called "spin"  (which, I hope, is defined elsewhere), and is adding to "spin" the difference of "x" (which is a parameter to the function) minus a (I assume) variable called "begin" (also, hopefully, defined elsewhere), then making sure this new value of "spin" is between 0 and 360 (which leads me to believe that "spin" is actually used in a rotation somewhere). It then updates the value of "begin" to "x", and calls a second function call "glutPostRedisplay()" (which sounds a lot like that function that redraws the screen in C code that does 3D graphics, but isn't used at all in Processing).

You do know that this is a forum for questions about programs written in the Processing language, right? If you need help with a C programming assignment, this is the wrong place to be asking!
Page Index Toggle Pages: 1