I've constructed an orbit graph

6

SP4CEBAR 2023-10-25 18:56 (Edited)

I'm working on some orbit simulators again, and I went to Desmos to graph my problem.
All you need to construct a graph of an orbit is an apoapsis (longest distance to one of the ellipse's focal points), a periapsis (shortest distance to one of the ellipse's focal points) value, and some geometrical ratios within ellipses

Here's a demo:
https://www.desmos.com/calculator/ogb8qeg5wh

on this elliptical function, I've implemented the rotation matrix on the general conic section formula that I found a while back, I forgot how I found it but it works nonetheless, maybe I found it on the internet, or I somehow found out how to calculate it.

I've written some notes a while ago where I found how I could construct hyperboles from an apoapsis and an asymptote


McPepic 2023-10-26 01:37

When describing orbits, I like to think of them in terms of the semi-major axis and the eccentricity. How difficult would it be to get these variables to work with the algorithm?


nathanielbabiak 2023-10-26 01:39

Very cool! I'd be happy to help if you need any asistance with the orbital mechanics if this turns into a game of sorts.


SP4CEBAR 2023-10-26 05:14 (Edited)

Thanks! I think an eccentricity and semi-major axis could be determined from the apoapsis and periapsis points (and the gravitational body on one of the ellipse's focal points). This ellipse is fully defined, so all the information should be there.

The only part that isn't defined by this ellipse is the orbital velocity, I will need to make a discrete implementation of it if I want to add a time-warping feature.

I've resumed an old project of mine where I've already made planets and a method to plot the graph of a conic section (orbit path). It uses a recursive motion physics simulator, which isn't that accurate for orbits, but it'll do for now. I've added apoapsis (minimum velocity) and periapsis (maximum velocity) detection which works but it takes an orbital period to figure out. Next, I'll implement the graph from the demo.


SP4CEBAR 2024-06-02 20:04 (Edited)

graphing a rotated ellipse is probably way easier in polar form than feeding the parametric form into a 2D rotation matrix

Edit: I remember what I used to do... I didn't just use the parametric representation of an ellipse... I squeezed the entire conic section formula through a 2D rotation matrix... this'll be a nice amount of mathematical complexity I can remove


SP4CEBAR 2024-06-02 23:39 (Edited)

Here's a demo:
https://www.desmos.com/calculator/j0giwlzro2


McPepic 2024-06-03 01:05

Really cool! Isn’t the satellite supposed to speed up as it reaches its periapsis?


SP4CEBAR 2024-06-03 10:57 (Edited)

Thank you! Yes, you are right about the speed. The correct orbital speed is displayed as a dot at x=0 that moves up and down. Currently, the angular speed as seen from the graph's center is constant. This is because it isn't easy to change the speed of a polar graph as the speed depends on the angle which is also modified by the speed. So I've been experimenting with differentiation and integration to try and get a function with a constant speed, or even a custom speed.


SP4CEBAR 2024-06-03 17:43

At this point, I think I would be better off studying Kepler's laws of planetary motion and orbital mechanics.


nathanielbabiak 2024-06-04 00:06 (Edited)

Agreed, but you'll want to use a good source for your studies. Try this one.


SP4CEBAR 2024-06-04 15:54

Thank you! That will surely help!


SP4CEBAR 2024-06-04 16:09 (Edited)

This example should be all I need to fix the satellite's velocity.


SP4CEBAR 2024-06-04 16:23 (Edited)

The only issue is that the high-accuracy method can't be solved algebraically: it needs an algorithm to solve it iteratively.

a quote from the example mentioned above:

2.53755 = E - 0.1 × sin E
By iteration, E = 2.58996 radians

I could use the low-accuracy method as a guess though.


SP4CEBAR 2024-06-04 18:43 (Edited)

I think I got it!

Here's a demo:
https://www.desmos.com/calculator/l7we1lxp4j


nathanielbabiak 2024-06-05 03:44

That looks great!


Log in to reply.