Please sign in to access this page

Keplerian Orbit Simulator

Keplerian Orbit Simulator Used AI

95 devlogs
221h 59m
•  Ship certified
Created by NOT_A_ROBOT

A Keplerian orbit simulator library. If you're a Kerbal Space Program player, you'll recognize this as the "On-Rails" physics mode that kicks in during time warp or when a vessel is out of physics range/unloaded.

Written in Rust.

Devlog is "incomplete"; this project started before Summer of Making.

AI used, but not primarily for code generation. AI was used for:
- API design discussion, such as function signatures
- Finding external sources for equations. Most of my equations have citations to external sites.
- Finding hard-to-catch bugs. All code that it generates is manually reviewed, and there are numerous unit tests for core functionality.
- Reviewing code. Sometimes I make mistakes that AI finds, and all its suggestions are manually reviewed.

Timeline

Ship 3

1 payout of shell 38.0 shells

NOT_A_ROBOT

about 1 month ago

NOT_A_ROBOT Covers 2 devlogs and 1h 35m

Right after posting that devlog I noticed my tests weren't really effective at detecting cache issues, so I made it more strict.
This will probably be my last devlog for this year's SoM. Thank you all for everything.

Update attachment
Earned sticker

Apparently today's the ACTUAL last day of SoM, not tomorrow. Which means I have to do at least 15m of coding to get the stickerlode sticker! Too bad my project's basically done.
And for that I decided to do the relatively minor change of refactoring the tests module by splitting it apart, and I also decided to add in a cache coherency test because why not.

Update attachment

Ship 2

1 payout of shell 1045.0 shells

NOT_A_ROBOT

about 2 months ago

NOT_A_ROBOT Covers 21 devlogs and 37h 23m

Added demo link to crate page!

Once again I'd like to express my gratitude towards Hack Club. This project wouldn't have been possible without y'all's motivation. This will probably be my last devlog for SoM.

Previously planned (scrapped):
- Fix touch input egui weirdness
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support

Update attachment
Earned sticker

Worked on some general code cleanup. The imports sure does look nicer now, doesn't it?

Previously planned (unlikely due to time constraints...):
- Fix touch input egui weirdness
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? (Probably not)

Update attachment
Earned sticker

I decided a more pressing issue is the orbits not actually being true to real life! Currently I'm using inclination values relative to the parent body's equator, but I don't simulate axial tilt in my simulation. In fact my simulation doesn't have rotations, only revolutions, and so it doesn't know what an equator is. I needed to find a way to get the data for this, but there are only so many sources online listing this kind of thing! If only there were an API I could programmatically call, hosted by NASA or something, that automatically gets orbital elements for me. Hmmm...
Oh wait. https://ssd.jpl.nasa.gov/horizons/app.html
Found it!
It took a while to make a script to hook into it though, mainly because it doesn't actually output JSON, more like raw text wrapped in JSON, so I had to manually parse the text that it outputted, which was kinda janky, but if it works it works, right?

Previously planned (unlikely due to time constraints...):
- Fix touch input egui weirdness
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? (Probably not)

I'd like to thank the Hack Club team for making this project possible. Without y'all's motivation I probably would have abandoned this project long ago, but now I am much more knowledgeable about orbital mechanics.

Update attachment

I wasn't quite sure how to fix egui's performance, so instead I just upped wasm-opt's optimization level.

However I also notice another mobile bug: touches and egui don't really seem to play well with three-d...?

Upcoming (tentative):
- Fix touch input egui weirdness
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? (Probably not)

Update attachment

I've been looking into mobile performance. It's... not looking great.
For some reason egui is kinda slow? I guess I'll try to see why.

WIP: Figure out why egui is slow
Upcoming (tentative):
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Documented keybinds in the welcome window! Along with some other general improvements to it.

Upcoming (tentative):
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Shortcut galore! I added shortcuts for editing the celestial bodies (e), changing the time speed (, and . to speed up and slow down, with optional Shift to use either 2x or 10x increments), and deleting the celestial bodies (using the Delete key)!
I haven't added that to the welcome page, however.

Done: Keybinds and shortcuts

Upcoming (tentative):
- Document keybinds in welcome window
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Added some keybinds and shortcuts: spacebar for pause/play, and [ and ] for switching focuses! I've got some more keybind ideas planned though.

WIP: Keybinds and shortcuts

Upcoming (tentative):
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Improved parent dropdown in editor window by styling disallowed settings differently and adding a hover tooltip.

Upcoming (tentative):
- Keybinds and shortcuts
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Added Voyager 1 and 2, Pioneer 10 and 11, and New Horizons

Shoutouts to this one NASA tool I found: https://ssd.jpl.nasa.gov/horizons/app.html

Upcoming (tentative):
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Hannah Hannah about 2 months ago

This is still so coooool, mind blowing space

I believe I'm finally done with real solar system!

Upcoming (tentative):
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Real Solar System progress:
- Finished up colors
- Added Phobos, Deimos, and 541132 Leleākūhonua
- TODO: Io, Europa, Ganymede, Callisto, Titan, Enceladus, Mimas, Iapetus, Titania, Oberon, Triton, Proteus, Nereid

WIP:
- Real Solar System
Upcoming:
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Real Solar System progress:
- Integrated solar system into simulation using a macro to define the simulation
- Added support for translucent colors in presets, for altering orbit line opacity
- Came up with colors for the Sun and Mercury

WIP:
- Real Solar System
Upcoming:
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Real Solar System progress:
- Manually rewritten presets into TOML form
- Created build.rs script to convert TOML preset into Rust files

RSS TODO:
- Come up with colors for the celestial bodies

WIP:
- Real Solar System
Upcoming:
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Huge scale support is done! You can now finally simulate the Solar system! Previously the rendering stopped working when trying to render things around the size of the Earth.
I've attached a screenshot of a simplified Sun-Earth system.

Done:
- Huge scales
Upcoming (tentative):
- Switch to using real solar system default instead of Root-Alpha-Beta
- Add feedback for parent dropdown in editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

I decided to work with the huge scales. Turns out, juggling yet another coordinate space is not the simplest of things. I'm currently debugging LoDs because the current method to get the radial size of objects don't really work anymore.
WIP:
- Huge scales
Upcoming (tentative):
- Add feedback for parent selector dropdown in celestial body editor window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Finished the config saving system, as well as the welcome window!
Upcoming (tentative):
- Fix bug with huge scales breaking rendering
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
NOT_A_ROBOT NOT_A_ROBOT about 2 months ago

Also it seems I’ve attached the wrong picture for this devlog. Whoops!

NOT_A_ROBOT NOT_A_ROBOT about 2 months ago

Actually I might instead go for improving the parent selector menu, because there’s not really any feedback for when you try to set the parent to its own descendant

Earned sticker

Got a bit distracted, added no_std support to the library. You know. In case you want to run it on a 80386, or something. Idk
WIP:
- Config saving system
Upcoming (tentative):
- Welcome window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

I also plan to save some configs to disk/localstorage, so I'm implementing the logic for that. I'm not done yet.

WIP:
- Config saving system
Upcoming (tentative):
- Welcome window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

I noticed from the team's ship testing video that they don't seem to quite get the celestial body list mechanic. I have made a help menu in that window to hopefully clear the confusion on it. I also added a welcome window to the upcoming feature list because that might actually be a useful feature!
Upcoming (tentative):
- Welcome window
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Added some more cursor change events! Also added some hover tooltips.
Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Ship 1

1 payout of shell 4420.0 shells

NOT_A_ROBOT

about 2 months ago

NOT_A_ROBOT Covers 72 devlogs and 183h
Earned sticker

Apparently the links do not work because of egui and three-d shenanigans. I've since fixed that, and also have fixed the cursors not appearing! At least, on web. It should theoretically be possible to do the same for native but I haven't gotten around to it yet as it involves some low-level winit things that I don't feel like doing at the moment.

Now that the about window's links are fixed I think now is the time to ship!
Upcoming (tentative):
- SHIP THE PROJECT
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Made an about window in the app and improved the READMEs. I think it's time to ship!

Upcoming (tentative):
- SHIP THE PROJECT
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

I finished the CI to publish the demo to GitHub Pages.
The demo is LIVE! You can visit it here: https://not-a-normal-robot.github.io/keplerian-sim-demo/
Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

The celestial body editor is complete!

Up Next (tentative):
- Github Actions CI for serving the project

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Earned sticker

Working on the celestial body editor now! For now it only displays information and there's no way to edit the body yet.

WIP:
- Editing existing celestial bodies

Up Next (tentative):
- Github Actions CI for serving the project

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Okay NOW I think the info grid is done. I made it right-aligned, made the text hover hitbox bigger, and I even fixed some font rendering issues because the default font set from egui does not include U+2032 (PRIME), U+22C5 (DOT OPERATOR), and U+03D6 (GREEK PI SYMBOL).

Done:
- Orbital information display

Up Next (tentative):
- Making info numbers right-aligned
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

The info grid is done! Well, almost. I might want to make the numbers right-aligned, but I haven't figured out how to do that... yet. We'll see. For now, let the numbers flow through your mind, mmm feels nice doesn't it?

Done:
- Orbital information display

Up Next (tentative):
- Making info numbers right-aligned
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

After working a little more on my orbital info display apparently I have not implemented a getter for time based on mean anomaly, which is needed by one of the info points that I wanted to show.
Because of that I needed to edit the library to add that in, which means v0.6.1!
Next, I can (hopefully) focus on the info display in the demo.

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Finally finished up my library improvements! I've added all sorts of other stuff, including time at periapsis/apoapsis, focal parameter, specific orbital energy, specific angular momentum, and even the area sweep rate of the orbit.
Because of that I've decided to finally release v0.6.0 of the library! This means I can finally use that in my demo to display even more information about the orbit.

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

Library improvements part 2! Now I added speed and velocity getters for the apoapsis, periapsis, and asymptotes of the orbit. Again: this is related to the infobox in that I plan to display this in the info panel.

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment
Earned sticker

More [unreleased] library improvements! This time I added perifocus, apofocus, and PQW basis vector getters. I've yet to add getters for periapsis speed/velocity, apoapsis speed/velocity, and asymptote speed/velocity, though, but that seems like the logical next step. This is related to the infobox in that I plan to display this in the info panel.

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Progress on adding more info rows! I've since researched equations for 7 more variables that can be useful. I've also fully implemented it on the library, but I've yet to publish a new version yet. Stay tuned!

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

I've mainly been continuing to add more info rows.
Here's a short bullet point of things I've done:
- Refactored out all the code into its own file for better modularity
- Refactored out all the hover texts into separate files for better viewing
- Added a build.rs for checking the formatting of those files
- Finding formulas for new planned info rows and adding it to the library

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Turns out, there's a lot of data points that are used to make orbits! I implemented quite a few of them already, but it's clear I'll need to add at least 10 more rows for it to be anywhere near complete.

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

Nevermind! As mentioned by my devlog comment, I have found new ideas that I should do before continuing with the celestial body editor.
One of the mentioned goals: orbital information!

WIP:
- Orbital information display

Up Next (tentative):
- Editing existing celestial bodies

Upcoming (tentative):
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Sphere of Influence: entry and exit simulation
- Drag-and-drop in celestial body list
- Mobile support?? Maybe???

Update attachment

I think I got a little carried away and checked multiple boxes. Whoops!

Finished:
- Design icons for the expand/collapse of the bottom bar
- Design icon for the options button
- Ability to modify the gravitational constant (+ mode)

Up Next:
- Editing existing celestial bodies

Upcoming:
- Keybinds and shortcuts
- Finish hover tooltips
- Github Actions CI for serving the project
- Mobile support?? Maybe???

NOT_A_ROBOT NOT_A_ROBOT 2 months ago
Not sure why my comment’s list didn’t render out. Let me try this
NOT_A_ROBOT NOT_A_ROBOT 2 months ago
I just thought of a couple more additional features that could be neat

What I realized is that to have the ability to modify the gravitational constant, I'd need to change the bottom bar a bit. Specifically, I had to add a settings button so that there's actually a place for me to place that setting.

Another thing that the options menu will have is a dropdown on what changing the gravitational constant actually means to the planets—more info is available in https://docs.rs/keplerian_sim/latest/keplerian_sim/enum.MuSetterMode.html on what the various modes would be. (MuSetterMode::KeepKnownStateVectors will not be available nor possible with the current code structure, as the simulation does not cache velocities, and MuSetterMode::KeepStateVectorsAtTime would behave identically anyway)

While I'm at it I also decided to improve the bottom bar, adding buttons for hiding and opening windows, and making it collapsible. Oh and also I made the windows closable now.

Up Next:
- Design icons for the expand/collapse of the bottom bar
- Design icon for the options button

Upcoming:
- Ability to modify the gravitational constant (+ mode)
- Editing existing celestial bodies
- Github Actions CI for building the project
- Mobile support?? Maybe???

Parent body dropdown implemented! Not much to say about it. I did have to refactor out some of my code to make it more reusable, though.

Up Next:
- Ability to modify the gravitational constant
- Editing existing celestial bodies

Upcoming:
- Github Actions CI for building the project
- Mobile support?? Maybe???

NOT_A_ROBOT NOT_A_ROBOT 3 months ago
P.S. Yes, the “Groot” celestial body name and purple color was just made up on the spot and has no significant meaning

Orbit line added! I think it looks a lot better than the previous autoscaling sprites approach.

I also had this problem where the lines get imprecise when the orbit is hyperbolic and you time warp very far into the future. This isn't that much of a problem anymore since I now hide the trajectory when the eccentric anomaly is ridiculously high.

I don't think there's not much else for me to say about this.

Up next:
- Choosing a parent body (add new body window)

Upcoming:
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Github Actions CI for building the project

Orbit line fading implemented! This is a pretty good exercise for fragment shaders and graphics pipelines.
Not shown: This also works for hyperbolic trajectories as well!
Fact: The orbit positions for this new orbit line viewer are computed fully on the GPU. Which is a good thing because doing 512 sine and cosine per frame per orbit on the CPU could be bad for performance. All the CPU does now is pass in orbital data, do some basic arithmetic, and allocate/deallocate from VRAM.

Up Next:
- Integrating this component from the test project to the overall project

Upcoming:
- Choosing a parent body (add new body window)
- Editing existing celestial bodies
- Ability to modify the gravitational constant

Progress update on the connected line rendering implementation:
It works! Or at least the geometry does. I now want to add a gradient material just like Kerbal Space Program (orbit line fading like in the 'upcoming' section of the previous devlog)

Underway:
- Implement orbit line fading

Upcoming:
- Integrating this component from the test project to the overall project
- Choosing a parent body (add new body window)
- Editing existing celestial bodies
- Ability to modify the gravitational constant

Update attachment

Progress update on the connected line rendering implementation: I'm getting cryptic errors. It might be something to do with the three_d crate. But I'm not sure. I'm thinking that instead of creating an entirely new line renderer I'll need to gradually morph my autoscaling sprite implementation into the new line renderer to see at what point weird stuff starts taking place.

Underway:
- Improving orbit lines to actually connect

Upcoming:
- Choosing a parent body (add new body window)
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Implement orbit line fading?

Update attachment

I'm almost done with the body addition UI! Just one more part I might want to implement: changing the parent body of an uncommitted object.

But not now, I think I might want to change something that's been bothering me: I don't like how the orbit dotted lines look, they look too noisy. Therefore I'm planning to replace it with the same kind of not-dotted lines Kerbal Space Program has.

There's just a problem with that: I'll need to find out how to render lines in 3D that has a constant screenspace thickness. This is not something trivial to me. In fact, it's pretty difficult, and I found an entire post online about it: https://mattdesl.svbtle.com/drawing-lines-is-hard
Perhaps I might learn a thing or two from that. Onto a separate small intermediary test project we go!

Underway:
- Improving orbit lines to actually connect

Upcoming:
- Choosing a parent body (add new body window)
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Implement orbit line fading?

Adding bodies now work! It's by no means the most pretty UI, so the next thing on the list is to work on that. I also plan to have a unit selector for the mass and radius, kinda like the time unit selector.

Underway:
- Improving body addition UI

Upcoming:
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Implement orbit line fading?

More backend changes for implementing and rendering ghost bodies!
Featuring: Deeply nested iterators and generic types! This isn't code spaghetti—oh no—we've long since passed that. This is layers upon layers of code lasagna. All because I wasn't feeling like allocating to the heap and just using a Vec<&dyn Object>. The performance gain? Immeasurable. Why did I do this? shrug I felt like it, I guess.

Anyways...
Underway:
- Creating new celestial bodies

Upcoming:
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Implement orbit line fading?

Update attachment

Changes:
- Cleaned up some code
- Fixed zoom bug
- Duplicating now auto-enables the rename prompt for the newly-made body
- Backend changes underway for implementing and rendering ghost bodies for uncommitted bodies (for previewing trajectory before adding the body)

Underway:
- Creating new celestial bodies

Upcoming:
- Editing existing celestial bodies
- Ability to modify the gravitational constant
- Implement orbit line fading?

Update attachment

Implemented celestial body renaming
Next up:
- Creating new celestial bodies
- Editing existing celestial bodies
- Ability to modify the gravitational constant

Implemented celestial body reordering, duplication, and deletion
Next up:
- Renaming the celestial bodies in the list
- Creating new celestial bodies
- Editing existing celestial bodies

Celestial body list and focus switching is now implemented! Next, I'll need to add the ability to create and delete celestial bodies, not to mention the ability to edit them.

Added zoom smoothing

We have confirmation that this project works in mobile!

Improved loading screen

Improved UI:
- Grouped time controls into popup when the window is too small
- Use min instead of m for minutes
- Format time using scientific notation

Improved time controls:
- Increased slider touch target to 48dp
- Added draggable (not demonstrated) textbox for time value
- Added time speed unit selectors + automatic picking
- Improved FPS display

I added time controls to the simulation! You can now view the time since epoch, change how it's displayed, and change the current time speed!

I added pausing and removed the unused debug menu

I switched the camera to make the Z axis point up

Update attachment

Fixing the transparency issue was a two-step process for me. First, I turned on blend so that transparency pixels would mix properly. Second, I sorted the points by the distance from the camera, so that the furthest points would be drawn first and the closer points can get layered on top of it properly.

Update attachment

I made the little square dots in the trajectory path into circular dots! Unfortunately, there seem to be a few issues with transparency. I guess that's what I'll work on next.

Update attachment

It indeed was not too hard to attach it to the actual orbit.
Next up: I need to make the dots actually dots by using a circle texture.

At last, orbit trajectory lines are now implemented! Or, I guess, a prototype of one. Currently it skips the main orbital mechanics code and just follows a circle, but it shouldn't be too hard to attach it to the actual orbit.

Update attachment

The autoscaling sprites worked, but there seems to be a depth buffer issue, sadly. I'll have to investigate why this happens.

Update attachment

Autoscaling sprites are working! Or at least, in the basic dev test it does. Time to integrate it into the demo!

I'm having trouble implementing a good way to display the orbital trajectory lines, so I started a minimal Rust project to hopefully develop it with less distractions.

Update attachment

I've made a banner image for this project!
I used Visual Studio Code to make it since many other drawing tools (e.g. GIMP) didn't have Hackatime support.

Update attachment

After refactoring the scene code, we finally got a basic demo of orbits working!!

Refactoring, refactoring, refactoring! Oh boy!
I'm refactoring my demo code to make it more modular, but it seems I'm struggling with Rust's strict type checking system. This is going to be a pain.

Update attachment

Got basic GUI and interactivity working! Also added an FPS counter.

Update attachment

Now that I've finished the harness for the web version and errors will almost certainly get displayed, I decided on a good stack for the visualization:
- Trunk for running the web server with auto refresh
- three-d for rendering in 3D
- egui for rendering the GUI

After following the guide I managed to render a basic sphere! How exciting.

Update attachment

I finished the panic handler and the heartbeat/watchdog mechanism so that if the WASM thing suddenly stops, JavaScript can notify the user about it.

Update attachment

I've been working more on the web demo's panic handler and found a compiler bug. I'll work on a minimum reproducible example for the rust team to handle.

Update attachment

I added a level of redundancy for the panic handler: in case if it somehow fails to create the dialog element, it falls back into just using alert()s.

Update attachment

Starting work on the demo!
Panics in WASM don't really tell the user what happened and only logs some cryptic messages in the console, so first and foremost I'm writing a custom panic handler which should be nearly infallible.

Update attachment

I'm done with the mu setter, and PR #24 has been merged!
Now I think I want to do some miscellaneous improvements to the codebase.

Update attachment

Things are looking up for the mu setter! I've made a draft PR: #24

Progress for mu setter:

- [X] Implement all mu setter modes

- [X] Write tests for mu setters

- [ ] Write documentation examples for mu setters

- [ ] Resolve TODOs

- [ ] Remove usage warnings and #[doc(hidden)]s

Update attachment

I take that back, I missed some untested edge cases! Whoops.
It thankfully didn't take too long to fix up. Hopefully next devlog will be about the mu setter? We'll see.

Update attachment

The experimental-sv2kep branch has been merged!
Next up: Implementing the extra modes for the mu setter.
Then I can start working on making the demo and ship the project!

Update attachment

The persistence and determination paid off. I have fixed the flaws, and now the test passes!
I am very ecstatic right now. I might be able to merge the PR soon!

Update attachment

I've been quiet these past seven days, but trust me, I've been chipping away at the problem for a while. First I found more equations for those edge cases (shoutouts to Space StackExchange!), then when that didn't fully work, I added more debug info to see what's going on. Sadly, I don't seem to have fully fixed this problem. I'm not all out of hope, however. There's definitely a way to fix it that I haven't found yet; there always is, and I'm not going to give up yet.

Update attachment

Upon further testing, it seems that I've overlooked some testcases... Some of the values returned NaNs, caused by the longitude of ascending node and argument of periapsis being undefined in circular and equatorial orbits. I have yet to find a solution on how to mitigate this problem. I think I might be able to use the longitude of periapsis instead of the argument of periapsis, but I have yet to find the proper equation to derive the longitude of periapsis.

But hey, at least I found the problem before the PR got merged!

Update attachment

Tests created and all tests pass! Now that functionality is tested and working, next up is just documentation fixes and then I think it should be good to merge.

https://github.com/Not-A-Normal-Robot/keplerian-sim/pull/21 checklist:

[X] Basic functionality
[X] Hyperbolic support
[X] Unit tests
[ ] Docstring examples
[ ] Review docstrings and remove TODOs
Update attachment

Second iteration: I switched to another source for the equations: https://orbital-mechanics.space/classical-orbital-elements/orbital-elements-and-the-state-vector.html

This has better hyperbolic orbit support. Another thing checked in the checklist for this PR!

https://github.com/Not-A-Normal-Robot/keplerian-sim/pull/21

  • [X] Basic functionality
  • [X] Hyperbolic support
  • [ ] Unit tests
  • [ ] Docstring examples
  • [ ] Review docstrings and remove TODOs
Update attachment

I've completed my first iteration on the state vector to orbit struct converter!
I've based my equations mostly from: https://downloads.rene-schwarz.com/download/M002-Cartesian_State_Vectors_to_Keplerian_Orbit_Elements.pdf
New PR: #21
New branch: experimental-sv2kep State Vectors to Keplerian (orbital elements)

Checklist:
- [X] Basic functionality
- [ ] Hyperbolic support
- [ ] Unit tests
- [ ] Docstring examples
- [ ] Review docstrings and remove TODOs

Update attachment

experimental-state-vector-getter has been merged! The next step should be to add an orbit constructor that takes in state vectors and a mu (gravitational parameter) value. And then after that we can borrow some code from that for the other mu setter modes. And after that is probably when I'll make the web/WASM demo and ship it. Or at least, that's my goal.

Update attachment

I've added the unit tests for the new state vectors getters! Now that I've confirmed the functionality of this and the new unchecked functions, hopefully I can migrate the existing functions to use the unchecked functions so that I can resolve this minor doctest failure and make the results exact.

Update attachment

State vector getter progress: I made most of the doctests pass, and the ones that didn't was very close to passing (only failed due to FP imprecision).
However, this isn't enough testing. I haven't made comprehensive unit tests for the new state vector getters. After that's done I might want to migrate some of the code to use the unchecked versions internally... but this might introduce trouble in citing sources for equations.

Either way, new draft PR! #20

Update attachment

I decided not to go for the mu setter first, but to make a more efficient state vector getter!

You see, if you call the position and velocity getter function separately, it ends up doing quite a few duplicate operations. Because of this, I'm creating more unchecked functions that take in multiple variables to allow redundant operations to be manually removed. And I'm using those unchecked functions in the state vector getter, so that API consumers can get the position and velocity more efficiently.

No commit just yet — I still haven't tested everything and written documentation.

Update attachment

I realized I didn't fully resolve merge conflicts from the first devlog correctly and some of the documentation was mismatched. Whoops!

Incorrect documentation is worse than no documentation so I have fixed it.

Next, I think I'll try adding the other setter modes for the gravitational parameter (mu), as well as conversion from state vectors to orbits.

Update attachment

Small improvements:
1. I added command line argument parsing to the dump-orbits example binary.
2. I removed some unnecessarily-cached values in the Orbit struct. Although this led to a 7% performance regression in the worst case, that is only in the benchmarking environment where there is nothing else happening. In practical usage scenarios, though, the reduced struct size should increase the chance of cache hits and therefore reduce the amount of time the CPU needs to wait for RAM. And besides, it saves on a little memory.

Update attachment

More CI work!
I added more checks to CI to ensure less problems with the code:
1. Check if cargo doc returns any errors
2. Check if code is formatted properly (cargo fmt)
3. Audit for security vulnerabilities (cargo audit)
4. Check for license mismatches etc. (cargo deny)

Update attachment

Previous update: I accidentally said experimental-tasks. The actual branch name was experimental-velocity-getter. I mixed it up with another project of mine, whoops!

Anyways, I've finished merging the experimental-velocity-getter branch to main. I also edited the CI to run Clippy as well so that I don't forget that. All tests pass and it seems like a go to release the next version to !

Update attachment

I'm currently trying to merge the experimental-tasks branch to main. I've dealt with the merge conflicts on the core part of the library and I was able to confirm that all tests pass. There's still quite a few benchmarks and example binaries I still have to resolve before the merge is complete.

Update attachment