-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes_solar
executable file
·227 lines (185 loc) · 8.21 KB
/
notes_solar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
Software architecture
=======================
classless solar system data objects
- contain physical characteristics of solar system objects
class AnimatedSpaceObject
- any kind of objects that is in space
- has attributes:
- object3d: its three.js object3d added to the scene
- initAnimation(newDate) for initialization
- animate(msecTimestamp) for animation
class PlanetArtist:
- handles artistic aspect of planet itself (sphere, color, etc...)
idea:
- separate orbital positions components of:
- plane the orbiter is on relative to orbital system and...
- path orbiter is following on that plane (circular, ecliptic, other...)
-> allows for better separation of circular/elliptic and tilted/not tilted
-> how to do it?
- Orbit abstract class, with children CircularOrbit and EllipticOrbit: defines x,y position relative to center
- OrbitPlane class: basically an object3d, that may or may not be tilted (actually)
idea bis:
- get rid of Orbiter classes and rename PlanetArtist Planet:
- Orbit and Planet take an object3d in constructor + their required metadata
- Both modify only the object3d data relevant to their role (Orbit: x,z positions; Planet: sphere & appearance)
Todolist:
- DONE 1) create elliptic orbit with constant orbital speed, sun center-centered
- DONE 2) sun in 1 of the 2 focal point
- DONE 3) ellipse correctly oriented
- DONE 4) tilted elliptic orbits
- DONE 5) orbital speed is keplerian speed
- DONE 6) create KeplerOrbit object
- DONE 7) add meanAnomaly
- DONE 8) OrbitalSystem
- DONE 9) better separation of animation&position calculation
- position calculation (from given date or interval) in a set of functions?
- adding "listeners" (=?orbiters) called as part of animation?
- shared position Vector3D?
- not having intermediary object3ds? but only a global shared position vector?
- challenges with computeState() approach:
- Orbit/spaceObject do not only compute positions, but also rotations and scale
- why do we need a "plane" object3d for KeplerOrbits? -> because rotations are in object3d's local world: rotating them fucks their x/y positioning
- we want children object3ds to have proper rotations/orientation as well as positions (typically: CircularOrbit rotates instead of setting position)
-> DONE a) set a initDate and currentTimestamp property for Orbits
-> initTimestamp from data!!
-> DONE FOR ELLIPTIC b) currently: initAnimation() is never used -> sets currentTimestamp & updates positions according to it
-> DONE c) create Orbit's "mobile" object3d
-> computeState() computes the mobile new position, by default by making a kopy with an option to updates its properties' instead
-> animate() calls computeState() with mobile update
-> DONE d) computeState():
-> using a Date or an interval from currentTimestamp
-> doesn't update any state variable
-> DONE e) animate() and initAnimation() use computeState()
- DONE 10) .computeState() improvement:
- re-separate computeStateAtDate from computeState?
-> it is weird to mix dates & interval in same function
-> what does computeState() needs to compute Orbit?
- intervalTimestamp, posOnOrbit (=x&y), and THAT'S ALL!
-> makes sense to do only this computation in computeState()
-> returns posOnOrbit and vector3
- DONE a) new architecture:
- computeState() takes a posOnOrbit and interval timeStamp -> computes all from it
- animate calls computeState for new pos & then updates state
- 11) A single file per Orbit in Orbit.js: Orbit, CircularOrbit, EllipticOrbit, KeplerOrbit, Planes
- 12) Orbit getPoint(), getPoints(), getPointAt(), getPointsAt(), , getPointAtDate()
-
low priority:
gravitational:
-
general:
- X) set date/speed using variable UI modifiers
- X) light source: sun
- X) planet imaged texture
- X) open wikipedia widget on click
descriptive solar system
- X) CircularOrbit.computeState()
- X) OrbitArtist class:
- disappearing&static orbits
- DONE distance to ecliptic markers
- different shades depending on above/below on ecliptic
- Orbit.showPath() takes an OrbitArtist argument (default to the simplest static orbit)
- X) Fix Orbit and Artist weaknesses:
- fromOrbiterData() center Argument
Separation of position calculations & three.js object3ds to put in the scene
--------------------------------
discussion:
- separation is desirable for:
- compute positions without any three.js overhead
- separation not desirable for:
- on the three.js side, it doesn't make sense to separate:
the tiltedOrbitalPlane of a KeplerOrbit is essential to the proper positioning of a planetArtist (orientation of planet rotational tilt/etc...)
current:
- object3ds (both orbit&artist) are all clumsily gathered in the planet's data object literal
-> no proper separation!
- proposal:
-> the OrbitalSystem creates an object that gathers the object's data, artist & orbit
-> simply put everything in that object
Software architecture for Newtonian gravitation
--------------------------------
A gravitationally affected body needs properties:
- mass
- position
- speed
A gravitational system needs:
- a list of bodies
- ...what else?
Needs:
- good optimization:
- avoid duplication
- efficient code (call-stack)
- precision:
- resists to different animation step deltaT interval
- separation of visual&computational part
Proposition:
- NewtonianBody class
-> mass, position, speed, acceleration, force properties
-> only a data-repository for computations!
- GravitationalSystem
-> bodies property: list of NB
-> reimplements computeState(), computeStateAtDate()
-> computes positions/speeds/accelerations/forces only, no three.js!
- AnimatedNewtonianBody class extends ASOG
-> takes a NB property
-> unifies ANB.object3d.position = NB.position
-> reimplements initAnimation(), animate()
- AnimatedGravitationalSystem class extends ASOG
-> bodies property=children = list of ANB
-> creates a GS from the ANBs' NBs
-> reimplements initAnimation(), animate() -> calling GS.computeState() / GS.computeStateAtDate()
Computational/Precision optimization:
- add cache:
CachingGraviationalSystem
-> has a dict of dates -> NB
-> has a *caching step* arguments
-> caches at every *caching step*
-> computes in between *caching steps*
- precision next order derivations:
- compute instantaneous acceleration
-> add acceleration to speed, and speed to position using smaller deltaTs
DEBUGGING
- earth revolves around sun in a matter of days
-> probably handling time/forces computation wrong somewhere
Relevant space units
=======================
distance:
- AU, astronomical unit = avg earth-sun distance = 1.495978707×10^11 m
-> within solar system measurement
- parsecm = 3.08567758149137×10^16 m = 648000/pi AU
-> astronomy/astrophysics measurement unit
time:
- J2000 12h on 1 January 2000
orbit:
- periapsis: closest point in orbit to primary body (peri=close) (periphelion = periapsis when primary=sun)
- apoapsis: furthest point in orbit to primary body (ap=far) (aphelion = apoapsis when primary=sun)
- Argument of periapsis
(- semi-major-axis: half of segment going through peri- and a-phelion)
- mean anomaly: fraction of elliptical orbit elapsed since last periapsis at given time
-> useful to determine orbital starting point!
- orbital eccentricity: determines shape of ellipse
- inclination
position
mass
Useful links:
=======================
https://github.com/orbitalindex/awesome-space#astronomy-apis
best introduction to Keplerian orbits:
https://en.wikipedia.org/wiki/Orbital_elements
website dowing the same:
http://planetoweb.net/app/
stylish orbital simulator:
https://github.com/TheHappyKoala/Harmony-of-the-Spheres
Planetary satellites:
https://ssd.jpl.nasa.gov/?sat_elem#legend
JPL Horizon API (hard to use)
https://ssd.jpl.nasa.gov/horizons.cgi
nasa spice:
https://naif.jpl.nasa.gov/naif/
Astroquery, python package for querying astronomical datasets:
https://astroquery.readthedocs.io/en/latest/
other web service:
https://minorplanetcenter.net//web_service
for earth satellites:
http://celestrak.com/NORAD/elements/
Incredible planet visualiser, with terrain pictures and exagerable height maps:
http://planetmaker.wthr.us/#
http://podgorskiy.com/KeplerOrbits/KeplerOrbits.html