Can anyone find the error?
I’ve been trying to make a function that draws a spiral based on the following parameter:
void spiral(int N, float radius, flat step);
The problem I’m having is that I want to be able to control the size of the spiral by mean of the radius. At this moment I can’t see why the figure gets bigger as I increment the N.
void spiral(int N, float radius, flat step){
float currRad = step;
float angle = 360.0 / N;
float currAngle = 0.0;
float prevX = currRad, prevY = 0;
float currX = 0, currY = 0;
glBegin(GL_LINES);
for(; currRad < rad; currRad += step){
currAngle += angle;
currX = prevX + currRadcos( PIcurrAngle / 180.0);
currY = prevY + currRadsin( PIcurrAngle / 180.0);
glVertex2f(prevX, prevY);
glVertex2f(currX, currY);
prevX = currX;
prevY = currY;
}
glEnd();
}
Ok what is the part of the math I’m missing here?