| 195 | } |
| 196 | |
| 197 | void plotCurve(float (*func)(float)) |
| 198 | { |
| 199 | const int steps = 100; |
| 200 | glBegin(GL_LINE_STRIP); |
| 201 | |
| 202 | for (int i = 0; i < steps; i++) { |
| 203 | float x = i / (float)(steps - 1); |
| 204 | glVertex2f(x, func(x)); |
| 205 | } |
| 206 | |
| 207 | glEnd(); |
| 208 | } |
| 209 | |
| 210 | // display results using OpenGL (called by GLUT) |
| 211 | void display() |