1// Persistence Of Vision Ray Tracer Scene Description File
2// -------------------------------------------------------
3// File: @(#)planets.pov
4// Description: Planet movement simulation
5// Features demonstrated: mechsim
6// Creation Date: $ 14 Apr 2003, 16:55:14 $
7// Last modified: $ 29 Apr 2005, 12:33:49 $
8// Author: Christoph Hormann
9//
10// @@ This scene simulates the movement of the inner
11// @@ planets of the solar system in real scale using
12// @@ the interaction feature of the mechsim patch.
13// @@ Starting conditions are simplified (all orbits in
14// @@ the same plane).  Timescale is 1 day per frame.
15// @@ The scaling of the planets in the scene is
16// @@ exaggerated to make them visible.
17//
18// -w640 -h480 +a0.3 -j +kff365
19
20#version unofficial megapov 1.2;
21
22#declare show_Orbits=true;
23
24
25#include "mechsim.inc"
26
27// Gravitation constant: 6.672e-11 m^3*kg^-1*s^-2
28#declare G=6.672e-11;
29
30// Newton's law of gravitation
31#declare fn_Gravity=
32	function(x, y, z, dist, m1, m2) {
33		(G*m1*m2)/(dist*dist)
34	}
35
36#declare Mio_km=1.0e9;
37
38global_settings {
39	assumed_gamma 1.0
40
41	mechsim {
42		method 1
43
44		interaction {
45			function(x, y, z, dist, m1, m2) { fn_Gravity(x, y, z, dist, m1, m2) }
46		}
47
48
49		#if (file_exists("planets.dat") & (frame_number>1))
50			step_count 2000
51
52			// 1 day per step
53			time_step (24*3600)/2000
54
55			topology {
56				load_file "planets.dat"
57				save_file "planets.dat"
58			}
59		#else
60			step_count 0
61
62			topology {
63
64				// Sun
65				mass { <0,0,0>, <0,0,0>, 696.0e6 mass 1.99e30 }
66				// Mercury
67				mass { <57.9*Mio_km,0,0>, <0,47.9*1000,0>, (4879/2)*1000 mass 0.330e24 }
68				// Venus
69				mass { <108.2*Mio_km,0,0>, <0,35.0*1000,0>, (12104/2)*1000 mass 4.87e24 }
70				// Earth
71				mass { <149.6*Mio_km,0,0>, <0,29.8*1000,0>, (6371.0)*1000 mass 5.97e24 }
72
73				// Moon
74				mass { <(0.3844+149.6)*Mio_km,0,0>, <0,(29.8+1.023)*1000,0>, (1737.4)*1000 mass 0.07349e24 }
75
76				// Mars
77				mass { <227.9*Mio_km,0,0>, <0,24.1*1000,0>, (6794/2)*1000 mass 0.642e24 }
78
79				save_file "planets.dat"
80			}
81		#end
82	}
83}
84
85// ----------------------------------------
86
87camera {
88	location  <-1.0, 0.0, 10.0>*200
89	up z
90	sky z
91	look_at   <0.0, 0.0, 0.0>
92	angle 20
93}
94
95// ----------------------------------------
96
97// Sun
98glow {
99	type 0
100	location mechsim:mass(0):position/Mio_km
101	size mechsim:mass(0):radius*1.5/Mio_km
102	radius mechsim:mass(0):radius*350/Mio_km
103	fade_power 2
104	color	rgb <2.0, 1.5, 1.0>
105}
106/*
107sphere {
108	mechsim:mass(0):position/Mio_km,
109	mechsim:mass(0):radius*30/Mio_km
110	texture {
111		pigment { color rgb <1,1,0> }
112		finish { ambient 1 diffuse 0 }
113	}
114}
115*/
116
117// Mercury
118sphere {
119	mechsim:mass(1):position/Mio_km,
120	mechsim:mass(1):radius*800/Mio_km
121	texture {
122		pigment { color rgb <1,0,0> }
123		finish { ambient 1 diffuse 0 }
124	}
125}
126
127// Venus
128sphere {
129	mechsim:mass(2):position/Mio_km,
130	mechsim:mass(2):radius*800/Mio_km
131	texture {
132		pigment { color rgb <0,0,1> }
133		finish { ambient 1 diffuse 0 }
134	}
135}
136
137// Earth
138sphere {
139	mechsim:mass(3):position/Mio_km,
140	mechsim:mass(3):radius*800/Mio_km
141	texture {
142		pigment { color rgb <0,1,0.8> }
143		finish { ambient 1 diffuse 0 }
144	}
145}
146
147// Moon
148cylinder {
149	//mechsim:mass(4):position/Mio_km,
150	//mechsim:mass(4):radius*800/Mio_km
151	mechsim:mass(3):position/Mio_km,
152	mechsim:mass(3):position/Mio_km+
153	30*(mechsim:mass(4):position/Mio_km-mechsim:mass(3):position/Mio_km),
154	mechsim:mass(3):radius*200/Mio_km
155	texture {
156		pigment { color rgb <0.5,0.5,0.5> }
157		finish { ambient 1 diffuse 0 }
158	}
159}
160
161// Mars
162sphere {
163	mechsim:mass(5):position/Mio_km,
164	mechsim:mass(5):radius*800/Mio_km
165	texture {
166		pigment { color rgb <1,0.5,0> }
167		finish { ambient 1 diffuse 0 }
168	}
169}
170
171#if (show_Orbits)
172	union {
173		torus { 57.9, 1.0 }
174		torus { 108.2, 1.0 }
175		torus { 149.6, 1.0 }
176		torus { 227.9, 1.0 }
177		rotate 90*x
178		texture {
179			pigment {  color rgb <0,0,0.5> }
180			finish { ambient 1 diffuse 0 }
181		}
182	}
183#end
184