[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

449.0. "Iterated Function Sequences" by ENGINE::ROTH () Thu Mar 06 1986 09:51

This note describes an interesting alternative way of constructing
fractal sets, such as the dragon curve, C curve, etc. which is closely
related to the fractal programs from Byte magazine from over a year ago.
I saw the technique in the -85 Siggraph proceedings, it may be published
elsewhere.

The idea is to statistically estimate the fractal in terms of an attractor set,
rather than procedurally via a recursive program.

Define a set of affine mappings in the plane.  For each step, select
one of the mappings at random and transform your current (x,y) point
via that map...  the resulting set of points will be on the fractal.
The fractal program from Byte chose one of a pair of quadratic roots
as a pair of nonlinear mappings; here we'll use simpler linear maps
and generalize by allowing any number of them.  Since the maps are
linear, the fractal is more evenly populated with points than the quadratic
fractals from Byte.

An affine map can be defined as individual scaling and rotation of the X-Y
axes about some fixed point.  The program fragment below shows the technique.
For simplicity, I define a set of fixed points on the unit circle,
and then ask for the X and Y axis rotations and scalings about each
one.  You could generalize further by placing the fixed points
arbitrarily, but this is convenient for starters.  Its possible to get
striking models of things like leaves and ferns with appropriate choice
of maps.

Choosing 2 points, with 45 degree angles, and .7071 scale factors gives
the dragon curve; +45 and -45 gives the C curve.  44/66 and -44/-66 degrees
gives an attractive variant of the C curve.  3 points with angles of 0 and
.5 scale factors gives the Sierpinski gasket, 60 degree angles gives a
snowflake.  A 5 sided gasket results from 5 points with 0 degree angles and
.4 scale factor...  A good strategy is to perturb the parameters from
a highly symmetric arrangement and see the effects.

Plotting points in a color based on which mapping was chosen gives a nice
effect.  You could automatically size the display by doing a few hundred
iterations and scaling based on that, there are many refinements.

I think basing the mappings on homographies instead of affine maps would
give very nice fractals in the hyperbolic plane, perhaps resembling Escher's
"Circle Limit" woodcuts, if I try it I'll post a note.

- Jim


main(ac,av)
int ac;
char *av[];
{

  int nfpts;

  float x0[NF],y0[NF];
  float ax[NF],ay[NF];
  float sx[NF],sy[NF];
  float a[NF],b[NF],c[NF],d[NF];
  float x,y,t;

  nfpts = ask("enter number of fixed points:");

  for (i=0; i<nfpts; i++) {
    t = twopi*(float)i/(float)nfpts;
    x0[i] = cos(t);
    y0[i] = sin(t);

    ax[i] = dtr*ask("enter fixed point X axis angle: ");
    ay[i] = dtr*ask("enter fixed point Y axis angle: ");

    sx[i] = ask("enter fixed point X axis scale factor: ");
    sy[i] = ask("enter fixed point Y axis scale factor: ");

    a[i] =  cos(ax[i])*sx[i];
    b[i] = -sin(ay[i])*sy[i];
    c[i] =  sin(ax[i])*sx[i];
    d[i] =  cos(ay[i])*sy[i];
    }

  setup_window();

  x = 0;
  y = 0;

  while (1) {
    uis$plot(&vd_id, &OVER_ATTR, &x, &y);		/* plot the point */
    i = nfpts*mth$random(&seed);			/* choose a map */
    t = x0[i] + a[i]*(x-x0[i]) + b[i]*(y-y0[i]);	/* send the point */
    y = y0[i] + c[i]*(x-x0[i]) + d[i]*(y-y0[i]);	/*  to its new spot */
    x = t;
    }

}
T.RTitleUserPersonal
Name
DateLines