Galaxy Collision Simulator for Visual Basic / Windows
by Terry Newton, December 2001

GALAXY.EXE requires the Microsoft Visual Basic 6 Runtime,
specifically the MSVBVM60.DLL file. If the program complains
about a DLL being missing, go to your favorite shareware/freeware
site and look for the VB6 runtime package. Simtel has it:
http://www.simtel.net/ 

'GALAXY' is based on QB code from "Galactic Slam Dance" by
Douglas E. Music, which was derived from a program presented
in the article "Galactic Collisions on Your Computer" by
Michael C. Schroeder and Neil F. Comins, published in the
December 1988 issue of Astronomy. The QB code was found in
the comments of GC3D.C from GC3D.ZIP, see links below.

This program simulates the effects of an intruder mass ripping
into a spiral galaxy. It is only an approximation, the stars do
not influence each other but rather orbit in the gravitational
fields of a central mass and the intruder. The Mass Ratio variable
determines the relative mass of the intruder. The Intruder X/Y/Z
coordinates specify the initial intruder position, Velocity X/Y/Z
components push it in the desired direction. I kept the same
split-screen display and coordinate system as original, X axis
increases left to right, Y and Z axis increase from bottom to top.
The number of stars is controlled by the Rings and Bands variables,
maximum 10,000 stars (rings times bands). The more stars the slower
it goes. The Scale variable controls overall magnification, increase
to magnify, decrease to see more. Scale can be changed while the
simulation is running, the other variables are read only when
the Start button is clicked to begin a new run.

I made several changes to the calculation code, mostly in the
part that calculates the movement of the galaxies. In the original
program the position of the main galaxy was fixed, this version
calculates the movements of both galaxies. Of course this means
usually the galaxy will drift out of view after the encounter,
to follow the action check the 'Center Galaxy' or 'Center Intruder'
boxes. Check the 'Pin Galaxy' box to make the main galaxy motionless
like in the original simulation. To calculate at full speed, uncheck
the 'Show Stars' box. If the 'Fewer Stars' box is checked only every
10th star is plotted, increasing speed while providing at least some
visual feedback. The checkboxes work when the simulation is running,
although checking the pin box after starting is equivalent to
thowing on galactic brakes.

Visual Basic source code is in the GALAXY.FRM file. SETPIX.BAS
contains a hook to a faster pixel plotting routine, GALAXY.FRX
contains the icon, and GALAXY.VBP is the project file.

This is free software. No warantee and all that other stuff like
if it fries your computer then tough. To my knowledge VB hasn't
fried very many computers and frying is unlikely to result from
this code since it contains no file IO at all... but hard drives
go bad and cause users to incorrectly blame whatever they were
running at the time, and unforseen bugs might lock up the program
taking Windows down with it... these things happen so if they do
please blame someone else besides me if you must assign blame.

This software was based on public domain QB code and remains
public domain.

Related Links:

ftp://seds.lpl.arizona.edu/pub/software/pc/gravity/
galaxy.bas    26-Jun-1992 17:00     6k
gc3d.zip      15-May-1995 17:45    42k

Galaxy.bas is a translation of the original GC3D into
another (human) language. Gc3d.zip contains a C version
of GC3D with a QB version in the comments, what I based
my VB version from.

http://www.atariarchives.org/cfn/05/11/0169.php

ROVAC ZMAGAZINE Issue #170 August 15, 1989
Contains "GALACTIC COLLISIONS ON YOUR COMPUTER"
An adaptation of GC3D for the Atari 8 bit, looks close
to the original. The article gives a lot of insight
into the original program, like the following tidbit:

 "The units of the equations used by this program are:
 one time step equals 1.2 million years, one screen pixel
 equals 500 parsecs (a parsec is a little more than 3
 light years), a mass fraction of 1.0 equals 20 billion
 solar masses. Everything is big!"

Note.. in my Galaxy version the pixel relationship is
true when Scale=TwipsPerPixel, or 15. At the default scale
of 10 each pixel would be 750 parsecs (~2300 light years).

http://www.noveltheory.com/Galaxy/Default.htm

An on-line version written in html/VBScript, works
only with IE 4. Equations are viewable in page source.

---------------------------------
Terry Newton
wtnewton@nc5.infi.net
http://www.nc5.infi.net/~wtnewton
