Generalize IVOrbit to allow for other movement definitions #25
Replies: 4 comments 3 replies
|
Note 2nd item under "Ongoing improvements" in our Roadmap. See IVRealPlanetOrbit, which is used by our Planeterium. It's a subclass of IVOrbit that adjust orbit elements (specifically, time of periapsis passage, t₀) to implement Table 2b adjustments from https://ssd.jpl.nasa.gov/planets/approx_pos.html. We don't exactly follow that page's instructions, which tells you to adjust mean anomaly (M) "on the fly". Instead, we use the provided adjustments to change the orbit elements (t₀ here) so that IVOrbit can just do what it does normally: i.e., calculate everything from the defining elements. I think this is more correct, and it means that we can use IVOrbit as is. This is also the intended pattern for a future IVManeuveringOrbit that adds impulse and thrust options (see IVOrbit class doc TODOs). I think you should follow this pattern by creating an IVOrbit subclass "EphemerisOrbit" (for example). What you need to do is "fix" IVOrbit elements at runtime, not the class logic or its existing plumbing with the rest of the simulation. IVOrbit is deeply entrenched in IVBody and visuals like IVPathVisual (e.g., the latter listens to its [Edit: This is in master, not current release:] I just added If and when you get this working and your project allows, I'd love to have this in the Core plugin as an optional IVEphemerisOrbit class. It's not too useful for games but it would be a major improvement for our Planetarium. Let me think about the stationary surface objects ... that's something different. |
|
@andreasfranke1 , I opened a separate proposal for surface items. Please check to see if that would meet your needs. |
|
IVBody has to have something from which it can ask: What is my position? What is my velocity? Also, other parts of the simulation are asking IVBody: What is your orbit apoapsis? What is your orbit eccentricity? IVBody must provide answers, even if they are nonanswer answers like 0.0 or NAN (though this would break the sim already in several places). All of these queries logically go to a component called "orbit". I believe there are only 3 design possibilities:
Duck-typing is not an option. We use it in GUI and some other areas, but not for physics. So that leaves 2 or 3. I know that some coders would say everything should be an interface. One advantage to using Godot's But you still have to answer questions: What is your eccentricity? What is your apoapsis? Our visual class IVPathVisual needs to know to determine vertex density (for the line graphic when zoomed in close) and AABB. You could get away with nonanswer 0.0 or NAN for some specific orbit properties, but you would have to identify these case-by-case. On ephemerides specifically, if you have state (position and velocity) then you can obtain orbit elements. It's just a coordinate conversion for any object moving in space assuming you have GM of a parent body. IVOrbit provides static methods to do these conversions. The reason we use elements as our "fundamental" coordinate system is that it doesn't need an update every frame. If you update elements, then you can generate state to very high precision for some amount of time before you need an element refresh. If you update state only and bypass elements, then you will need to update 60 frames per second. (But you'll still need some elements or element-related stats to service other parts of the sim.) |
I think you're underestimating IVOrbit. See plans for IVResonantOrbit and IVManeuveringOrbit in the doc comments. This is exactly what we're building toward. In any case, I think the near-term solution is to provide an alternative While you're here, check out some new graphics capabilities coming in v0.2: here and here. |
Uh oh!
There was an error while loading. Please reload this page.
In our project, we want to have two additional movement definitions, one for stationary objects on planet surfaces, for example, and another one for very precise trajectories (fed from ephemeris data). While it is possible to cover this by implementing a new Body class, it would be way cleaner for us if IVOrbit references in IVBody would be replaced by a more generic class, from which IVBody just requests the data, because we do not really alter IVBody in another manner (for now). Would that be feasible?
All reactions