GALAXY by Steve E. Riley Ver1.01: Fixed bug allocating memory for those machines with no FAST memory. --------------------------------------------------------------------------- This program was taken from an algorithm in December 1988 Astronomy magazine. They had a BASIC program listing from which I translated it to C and made some modifications to the display sequence, fixed a bug, etc. This program is placed in the public domain, but is not to be sold for a profit. This program represents the collision of two galaxys. The main galaxy initially starts a rest with respect to the screen and has stars, each of which represent a few million stars in a real galaxy. This is called an N body representation, since we don't have the computing power, memory, or time to represent each of 100 billion stars on the screen. The number of stars on the screen will determine how long it takes to compute each frame. 250 stars takes approx 10 seconds per frame. Use less when trying new start sequences, more when you have a good sequence you want to see a lot of detail on. The limit is 32700 stars, be careful however, about 54K of RAM is allocated for each 100 stars. I tried it with 22,000 stars and over 1MB of my RAM was used! The intruder galaxy is represented by its "core" and does not have any "stars" associatted with it (unless it captures some from the main galaxy). The program starts by asking several questions. The first two questions have to do with the number of stars to be displayed. The stars are initially displayed in rings around the main galaxy core. You pick the number of rings and the number of stars per ring. Next pick the mass of the intruder galaxy as a percentage of the main galaxy. 1 would be the same mass, .5 half the mass, 2 twice the mass, etc. Next choose the starting position of the intruder galaxy. This is done in terms of the screen resolution, you can go +- 160 in the X direction (left & right), and +- 70 in the Y and Z directions. The left side of the screen is a top view (X,Y), the right side a side view (X,Z). The next question is the intruder velocity in X,Y,Z, you probably don't want to pick anything over +- 5. I have tried many different scenerios, and have had some strange and interesting results. I have tried picking some wild numbers and have not had any problems with floating point overflows or divide by zeros or anything, but you are on your own. This program does use the Amiga IEEE floating point package. If you use WB1.3 and have a 68881 peripheral floating point chip, the program will run 3 to 6 times faster than with a normal Amiga. All calculations are done in double precision floating point.