1. 19

Hey, fellow crustaceans! I’ve been learning about orbital mechanics on the side, and just wanted to share this visualizer + calculator that I’ve been building to help with determining orbital elements of a satellite! It’s written in vanilla javascript, with Mathjax, and webGL for equations and visualizations respectively. code here: https://github.com/mrpossoms/two-body


  2. 4

    Thank you for this. If you are looking for an extension of this work, adding orbital maneuvers could be an interesting challenge. It should involve calculating the current velocity vector, the new velocity vector, and its effects on the orbit. As a second extension, you could also finish up by a burn calculator (given the current orbit and the target orbit, how would the burn look like?).

    Completely unrelated, Kerbal space program is a good way to learn/practice about orbital mechanics.

    1. 3

      Thank you! And great ideas there, I’ve been going through a book called “Fundamentals of Astrodynamics” and I’m still fairly early on in my reading of it. I would not be surprised at all if it covers those topics, and you can rest assured that I’ll be tacking those features on too :)

    2. 2

      pretty fun!

      High enough eccentricity and I can create a finite (curved) universe :).

      1. 1

        Glad you liked it! :)

      2. 1

        Related: does anybody know if there’s a programming/mathematical model of the solar system? I’d like to do a rocket simulator, but it won’t really shine unless there are multiple planetary bodies in it.

        1. 2

          This maybe?

          Consider that allowing for n-body physics will introduce some chores into the game (e.g., station keeping) that might not be fun to deal with after awhile and some unexpected behavior that might be hard for new players to get (e.g., weird trajectories).

          I would rather have a good simulation of the atmosphere than n-body gravity. That would give you more bang for your bucks (realistic drag, planes, helicopters, etc).

          1. 1

            That’s a good point, but even just the earth-moon system would be enough to do some interesting orbital stuff, like lunar insertion orbit.

            1. 2

              I’m no astrophysicist but I think that if you just want to model a system with just the earth and the moon you don’t need a very complex system. You could just model the gravity well for each body and “jump” between spheres of influence when appropriate. That’s how kerbal space program models gravity.

              Things get complicated when you want to calculate the effects of earth, the moon, and the sun on the spacecraft. That will require an n-body physics engine.

        2. 0

          I didn’t get any graphics :-(

          1. 1

            Well shoot, what browser are you using?

            1. 1

              Firefox, mid-50s version (old windows box)

              1. 1

                Hmm, interesting. That’s old, but it should support WebGL. If you feel so inclined to take a look at the console and see what went wrong, I’d be grateful!