Program: 109202
Project: 109202
Buggy source:
/** 
 * Draw a sphere with radius r centered at coordinate 0, 0, 0. <P> Implementation notes: <P> cache all the points of the sphere in a static array top and bottom are just a bunch of triangles that land in the center point <P> sphere is a series of concentric circles who radii vary along the shape, based on, er.. cos or something <PRE> [toxi 031031] new sphere code. removed all multiplies with radius, as scale() will take care of that anyway [toxi 031223] updated sphere code (removed modulos) and introduced sphereAt(x,y,z,r) to avoid additional translate()'s on the user/sketch side [davbol 080801] now using separate sphereDetailU/V </PRE>
 */
public void sphere(float r){
  if ((sphereDetailU < 3) || (sphereDetailV < 2)) {
    sphereDetail(30);
  }
  edge(false);
  beginShape(TRIANGLE_STRIP);
  for (int i=0; i < sphereDetailU; i++) {
    normal(0,-1,0);
    vertex(0,-r,0);
    normal(sphereX[i],sphereY[i],sphereZ[i]);
    vertex(r * sphereX[i],r * sphereY[i],r * sphereZ[i]);
  }
  vertex(0,-r,0);
  normal(sphereX[0],sphereY[0],sphereZ[0]);
  vertex(r * sphereX[0],r * sphereY[0],r * sphereZ[0]);
  endShape();
  int v1, v11, v2;
  int voff=0;
  for (int i=2; i < sphereDetailV; i++) {
    v1=v11=voff;
    voff+=sphereDetailU;
    v2=voff;
    beginShape(TRIANGLE_STRIP);
    for (int j=0; j < sphereDetailU; j++) {
      normal(sphereX[v1],sphereY[v1],sphereZ[v1]);
      vertex(r * sphereX[v1],r * sphereY[v1],r * sphereZ[v1++]);
      normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
      vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2++]);
    }
    v1=v11;
    v2=voff;
    normal(sphereX[v1],sphereY[v1],sphereZ[v1]);
    vertex(r * sphereX[v1],r * sphereY[v1],r * sphereZ[v1]);
    normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
    vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2]);
    endShape();
  }
  beginShape(TRIANGLE_STRIP);
  for (int i=0; i < sphereDetailU; i++) {
    v2=voff + i;
    normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
    vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2]);
    normal(0,1,0);
    vertex(0,r,0);
  }
  normal(sphereX[voff],sphereY[voff],sphereZ[voff]);
  vertex(r * sphereX[voff],r * sphereY[voff],r * sphereZ[voff]);
  normal(0,1,0);
  vertex(0,r,0);
  endShape();
  edge(true);
}

Fixed version (ground truth):
/** 
 * Draw a sphere with radius r centered at coordinate 0, 0, 0. <P> Implementation notes: <P> cache all the points of the sphere in a static array top and bottom are just a bunch of triangles that land in the center point <P> sphere is a series of concentric circles who radii vary along the shape, based on, er.. cos or something <PRE> [toxi 031031] new sphere code. removed all multiplies with radius, as scale() will take care of that anyway [toxi 031223] updated sphere code (removed modulos) and introduced sphereAt(x,y,z,r) to avoid additional translate()'s on the user/sketch side [davbol 080801] now using separate sphereDetailU/V </PRE>
 */
public void sphere(float r){
  if ((sphereDetailU < 3) || (sphereDetailV < 2)) {
    sphereDetail(30);
  }
  edge(false);
  beginShape(TRIANGLE_STRIP);
  for (int i=0; i < sphereDetailU; i++) {
    normal(0,-1,0);
    vertex(0,-r,0);
    normal(sphereX[i],sphereY[i],sphereZ[i]);
    vertex(r * sphereX[i],r * sphereY[i],r * sphereZ[i]);
  }
  normal(0,-r,0);
  vertex(0,-r,0);
  normal(sphereX[0],sphereY[0],sphereZ[0]);
  vertex(r * sphereX[0],r * sphereY[0],r * sphereZ[0]);
  endShape();
  int v1, v11, v2;
  int voff=0;
  for (int i=2; i < sphereDetailV; i++) {
    v1=v11=voff;
    voff+=sphereDetailU;
    v2=voff;
    beginShape(TRIANGLE_STRIP);
    for (int j=0; j < sphereDetailU; j++) {
      normal(sphereX[v1],sphereY[v1],sphereZ[v1]);
      vertex(r * sphereX[v1],r * sphereY[v1],r * sphereZ[v1++]);
      normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
      vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2++]);
    }
    v1=v11;
    v2=voff;
    normal(sphereX[v1],sphereY[v1],sphereZ[v1]);
    vertex(r * sphereX[v1],r * sphereY[v1],r * sphereZ[v1]);
    normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
    vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2]);
    endShape();
  }
  beginShape(TRIANGLE_STRIP);
  for (int i=0; i < sphereDetailU; i++) {
    v2=voff + i;
    normal(sphereX[v2],sphereY[v2],sphereZ[v2]);
    vertex(r * sphereX[v2],r * sphereY[v2],r * sphereZ[v2]);
    normal(0,1,0);
    vertex(0,r,0);
  }
  normal(sphereX[voff],sphereY[voff],sphereZ[voff]);
  vertex(r * sphereX[voff],r * sphereY[voff],r * sphereZ[voff]);
  normal(0,1,0);
  vertex(0,r,0);
  endShape();
  edge(true);
}