next up previous contents
Next: Accounting for the intersection Up: Representation of a sphere Previous: Random points   Contents

Fractals

Figure: The surface of a sphere can be represented by trying to fill it with a fractal curve. The effect is most successful when the structure of the fractal can be clearly perceived as varying from the center of the sphere towards the rim, when it has a clear orientation, and when it fills a substantial part of the surface.
\begin{figure}\begin{picture}(300,240)(-60,0)
\epsffile{fig17.eps}\end{picture}\end{figure}

A fractal curve results from defining a rule of substitution, whereunder a single line segment is replaced by a whole series of segments. Each segment is a scaled version of the original, altogether they must span the same arc. One famous example is the result of dividing the segment into thirds, intending to consider the middle segment as the base of an equilateral triangle, which is replaced by the remaining two edges.

Starting from an equilateral triangle as the basic figure and repeating the replacement infinitely often for each new line segment. The limiting figure is called a snowflake curve; it has infinite length (because every arc is replaced by one 4/3 as long) while both enclosing a finite area and remaining bounded within the original circumscribing circle.

Nevertheless the snowflake does not fill up an area, so a more elaborate rule of substitution would make a better figure to portray a spherical surface.

/* geofr - represent a sphere by a fractal curve        */

void geofr(r0,r,a0,l) double *r0, r, *a0; int l; {
int    g0, g1, g2, i, j, k, n;
double d, th, ph, y0, o[3][3], w[3], aa;
int    a[16]={0,1,0,5,3,4,0,1,1,0,4,3,5,0,1,0};
y0=r0[1];
if (l==0) return;
if (l==1) n=16*16*6;
if (l==2) n=16*6*6;
if (l==3) n=6*6*6;
if (l>3) return;
th=1.5707;
ph=0.0;
d=6.28318/((double)n);
spheu(o,a0);
sphrv(w,r,th,ph);
sphap(w,o,w,r0);
pltms(w[0],w[2],0);
for (i=0; i<16; i++) {
  g0=a[i];
  for (j=0; j<16; j++) {
    if (l>1) g1=a[j]; else g1=0;
    for (k=0; k<16; k++) {
      if (l>2) g2=a[k]; else g2=0;
      aa=((double)((g0+g1+g2)%6))*(6.28318/6.0);
      ph+=d*cos(aa); th+=0.866*d*sin(aa);
      sphrv(w,r,th,ph);
      sphap(w,o,w,r0);
      pltms(w[0],w[2],w[1]>=y0);
      }
    }
  }
}

/* geofs - represent a sphere by another fractal curve        */

void geofs(r0,r,a0,l) double *r0, r, *a0; int l; {
int    g0, g1, g2, i, j, k, n;
double d, th, ph, y0, o[3][3], w[3], aa;
int    a[10]={0,5,4,2,0,0,2,4,5,0};
y0=r0[1];
if (l==0) return;
if (l==1) n=10*10*4;
if (l==2) n=10*4*4;
if (l==3) n=4*4*4;
if (l>3) return;
th=1.5707;
ph=0.0;
d=6.28318/(((double)n)*1.732);
spheu(o,a0);
sphrv(w,r,th,ph);
sphap(w,o,w,r0);
pltms(w[0],w[2],0);
for (i=0; i<10; i++) {
  g0=a[i];
  for (j=0; j<10; j++) {
    if (l>1) g1=a[j]; else g1=0;
    for (k=0; k<10; k++) {
      if (l>2) g2=a[k]; else g2=0;
      aa=((double)((2*g0+2*g1+2*g2+l)%12))*(6.28318/12.0);
      ph+=d*cos(aa); th+=0.866*d*sin(aa);
      sphrv(w,r,th,ph);
      sphap(w,o,w,r0);
      pltms(w[0],w[2],w[1]>=y0);
      }
    }
  }
}


next up previous contents
Next: Accounting for the intersection Up: Representation of a sphere Previous: Random points   Contents
Pedro Hernandez 2004-05-13