home *** CD-ROM | disk | FTP | other *** search
- /* Galaxie.rexx
- *
- * Autor: Thies Wellpott
- * Version: 1.0 (2.7.1994)
- *
- * Erstellt eine kreisförmige Galaxie
- *
- * benötigt rexxmathlib.library
- */
-
- G = 6.67259e-11 /* Gravitationskonstante */
- PI = 3.1415927
-
- Call Addlib("rexxmathlib.library",0,-30,0)
-
- IF ~Show("P", "GRAVISIMU.1") THEN
- DO
- Say "GraviSimu ist nicht gestartet!"
- Exit
- END /* IF */
-
- Address "GRAVISIMU.1"
- Options Results
-
- 'GetNumObjects'
- IF Result > 0 THEN
- Say "Achtung! Die vorhandenen Objekte können stören!"
-
-
- Options Prompt ">> "
-
- Say "Galaxiename"
- Parse Pull a_name
- Say "Galaxiemasse (Kommazahl Leerzeichen Masseneinheitsabkürzung)"
- Parse Pull a_m a_m_einh
- 'GetUnitKG' a_m_einh
- IF RC ~= 0 THEN
- DO
- Say "Ungültige Masseneinheit!"
- Exit
- END
- a_m_kg = a_m * Result
-
- Say "Koordinaten des Zentrums x/y (Kommazahl Leerzeichen Kommazahl"
- Say "Leerzeichen Streckeneinheitsabkürzung)"
- Parse Pull a_mx a_my a_mxy_einh
- 'GetUnitM' a_mxy_einh
- IF RC ~= 0 THEN
- DO
- Say "Ungültige Masseneinheit!"
- Exit
- END
- a_mx_m = a_mx * Result
- a_my_m = a_my * Result
-
- Say "Geschwindigkeit des Zentrums vx/vy (Kommazahl Leerzeichen Kommazahl"
- Say "Leerzeichen Geschwindigkeitseinheitsabkürzung)"
- Parse Pull a_vx a_vy a_v_einh
- 'GetUnitMS' a_v_einh
- IF RC ~= 0 THEN
- DO
- Say "Ungültige Masseneinheit!"
- Exit
- END
- a_vx_ms = a_vx * Result
- a_vy_ms = a_vy * Result
-
- Say "maximaler Radius der Galaxie (Kommazahl Leerzeichen"
- Say "Streckeneinheitsabkürzung)"
- Parse Pull a_r a_r_einh
- a_r = 100*9.46e15 /* Radius */
- 'GetUnitM' a_r_einh
- IF RC ~= 0 THEN
- DO
- Say "Ungültige Streckeneinheit!"
- Exit
- END
- a_r_m = a_r * Result
-
- Say "Anzahl dargestellter Sterne der Galaxie (10 bis 1000)"
- Parse Pull a_anz
-
-
- 'NewObject "'a_name'"' a_m a_m_einh a_mx a_my a_mxy_einh a_vx a_vy a_v_einh '1 1 1 1'
- IF RC ~= 0 THEN
- DO
- Say "Konnte Galaxiekern nicht hinzufügen!"
- Exit
- END /* IF */
-
- 'ObjectList QUIET'
- Say "Füge Sterne hinzu..."
- DO i=1 TO a_anz
- w = Randu() * 2*PI
- r = 0
- DO FOR Random(1,4) /* Dichte in der Mitte größer */
- r = r + Randu() * a_r_m/4
- END /* FOR */
-
- x = a_mx_m + r * Cos(w)
- y = a_my_m + r * Sin(w)
- v = Sqrt(G * a_m_kg / r)
- vx = a_vx_ms + v * Cos(PI/2 + w)
- vy = a_vy_ms + v * Sin(PI/2 + w)
-
- 'NewObject "'a_name || i'" 1 mS' x y 'm' vx vy 'm/s 1 0 0 0'
- END /* i */
- 'ObjectList NOQUIET'
-
- 'SetScale' a_r_m * 2 / 300 'm'
- max_v = Sqrt(G * a_m_kg / (a_r_m/20) )
- min_T = 2*PI * a_r_m/20 / max_v
- 'SetTime' min_T/100 's'
- 'SetParameter T=1 N=1'
- 'SetOptions BP=0 M=0'
-
- Exit
-
-