
CHAOS - a program to explore the Hennon mapping
===============================================

*** WARNING *** *** WARNING *** *** WARNING ***

 - If you run this program from CLI, make sure the stack is set
   to at least 10,000. Otherwise you will meet the GURU. 
 - This program uses the Math library on your WB disk, so
   don't be surprised if you are asked for the WB disk when
   the program starts running.

*** WARNING *** *** WARNING *** *** WARNING ***

To see what kind of pictures you can get with this program
just start it up and choose START from the ACTIONs menu.
Then just wait for a while and see the picture develop.
To see other possibilities choose one of the things in the
PRE-SETS menu. Hi-res (640 X 400) gives prettiest pictures.

About the program:
-----------------

  This program allows you to explore the Hennon mapping.  The Hennon
mapping is a function that maps points on the plane to other points on
the plane. Normally you start with one point and apply the function to
it to obtain another point.  Then the function is applied to the
second point, to get the third, etc. All the points along the way are
plotted. The set of all points plotted this was is called an "orbit".
Picking a different starting point gives another orbit, and a whole
bunch of orbits makes an image. 

The formula I used is this:

     x = x * cos (a) - (y - x * x) * sin (a)
     y = x * sin (a) + (y - x * x) * cos (a)
  
The coefficient 'a' determines the shape of the picture. Since SIN
and COS are periodic functions values of 'a' that give distinct
pictures lie between 0 and 2 * PI (or between 0 and about 7).

CONTROL PANEL
-------------

  The control PANEL (can be chosen from the ACTION menu) allows
you to modify various parameters to see different pictures.
Here is a brief description of these parameters:

"A" coeff      - this is the coefficient 'a' in the above equation;
                 determines the shape of the picture.

"X inc" 
"Y inc"        - the starting point for the first orbit of every
                 picture is (0.01,0.01); each following orbit
		 will start with a point (0.01 + x_inc, 0.01 + y_inc);
		 these parameters dermine how closely the orbits are
		 to each other; by the way, the X and Y increments
		 need not be the same; when you change these use
		 small amounts (doubling, or halving the number
		 often gives good results).

Iter/Orbit     - number of iterations per orbit; for faster computation
                 pick a smaller number, for more details pick a larger
		 number.

Orbits         - how many orbits to draw; can be set to a large
		 number; you can always stop the computation;
		 more orbits means more interesting picture.

Colors         - each orbit is drawn in a different color; this
		 number specifes the maximum number of colors to
		 use; the highest value is 15.

Zoom Factor    - this number can be used to magnify or shrink the
                 entire picture; if you change the Zoom Factor you
  	         will have to re-compute the picture; setting this
	         number to 2.0 makes the picture twice as large;
	         note that Zoom Factor need not be an integer
	         (i.e. value 1.5 is OK).
	       

Other Menu items
----------------

ACTION menu

 START  - start computation
 PANEL  - see above section
 ABOUT  - information about the program
 SAVE IFF - save current picture to an IFF file 
 QUIT   - exit tED TO CREATE \017MISINFORMATION AND\033\
VAPORWARE MARKETROIDS.";

static char ibm[] = "\015BEWARE OF THE \017INGENIUS BRAIN\033\
MARKETROIDS (IBM'S)\015 THAT POSSESS THE\033\
ABILITY TO RE-TRAIN THE HACKERS INTO\033\
SINISTER \017MS-DOS PROGRAMMERS.";

static char struggle[] = "\012AS YOU STRUGGLE TO SAVE HACKERDOM,\033\
BE SURE TO AVOID \017BPTRS\012\033\
IN YOUR PATH.";

static char bs[] = "\006NO BULLSHIT, JUST EXCELLENCE.";

static char hype[] = "\006NO HYPE, JUST EXCELLENCE.";

/*  Other stuff  */
struct Screen		*scr;
struct Window		*win;
struct ViewPort		*vp;
struct BitMap		*sbm;
struct TextFont		*bigrobo, *smallrobo;
UWORD			*blankspr;
int			keyx;
char			*keytext;
char			marketroid1987[] = "MARKETROID: 1987";
void			*IntuitionBase, *GfxBase, *DiskfontBase;

main (ac, av)
char **av;
{
	struct RastPort		*rp;

	openstuff ();
	sbm = scr -> ViewPort.RasInfo -> BitMap;
	rp = &scr -> RastPort;
	setbounds (2, 318, 12, 198);
	coverpage ();

	SetFont (rp, bigrobo);
	keytext = hype;
	if (ac > 1)
		if (*av[1] == '-' && av[1][1] == 'o')
			keytext = bs;
	keyx = 160 - TextLength (rp, &keytext[1], strlen (keytext) - 1L) / 2;

	while (1) {
		/*  "Save the last real hackers"  */
		save_em (rp);
		if (chkabort())
			break;

		/*  "MARKETROID:"  */
		market (rp);
		if (chkabort())
			break;

		/*  The Main demo  */
		if (maindemo (rp))
			break;

		/*  Amiga.  No BS, just excellence.  */
		amy (rp);
		if (chkab