next up previous contents
Next: Dipole moment Up: Families of spheres Previous: Families of spheres   Contents

Drawing the family

Figure: The visibility of surface patches in an entire family of spheres is gotten by comparing all the pairs.
\begin{figure}\begin{picture}(250,250)(-40,0)
\epsffile{fig5.eps}\end{picture}\end{figure}

/* eomsf - intersection of a family of spheres */

void eomsf(s,n) double s[][7]; int n; {
int    i, j, k, m, mi;
double b1, b2, g, th, dh, ri;
double emi, p[3], o[3][3];
g=57.0;
for (i=0; i<n; i++) {
  ri=s[i][3];
  emi=2000.0*ri;
  mi=(int)emi;
  dh=3.14159/emi;
  th=0.0;
  spheu(o,&s[i][4]);
  for (k=0; k<mi; k++) {
    th+=dh;
    sphrv(p,ri,th,g*th);
    sphap(p,o,p,&s[i][0]);
    if  (p[1]>s[i][1]) continue;
    m=1;
    for (j=0; j<n; j++) {
      if (i==j) continue;
      sphdj(&b1,&b2,p,s,j);
      if (b1<0.0)        {m=0; break;}
      if (p[1]<=s[j][1]) continue;
      if (b2<=0.0)       {m=0; break;}
      }  /* end for j */
    pltms(p[0],p[2],m);
    }  /* end for k */
  }    /* end for i */
}



Pedro Hernandez 2004-05-13