02/06/2003
15-462 Graphics I
32
Bisection of Sides
•Draw if no further subdivision requested
void subdivide(GLfloat v1[3], GLfloat v2[3],
                        GLfloat v3[3], int depth)
{ GLfloat v12[3], v23[3], v31[3]; int i;
  if (depth == 0) { drawTriangle(v1, v2, v3); }
  for (i = 0; i < 3; i++) {
    v12[i] = (v1[i]+v2[i])/2.0;
    v23[i] = (v2[i]+v3[i])/2.0;
    v31[i] = (v3[i]+v1[i])/2.0;
  }
...