Code :void drawCircle(float cx, float cy, float r, float num_segments){ glBegin(GL_LINE_LOOP); for(int i = 0; i < num_segments; i++){ float theta = 2.0f * PI * i / num_segments; float x = r * cosf(theta); float y = r * sinf(theta); glVertex2f(x + cx, y + cy); } glEnd(); }

This is newbie question but how does above code work? why is this function able to draw a circle?

Where can I learn computer graphical maths such as above? any recommended website/videos?