# #2 [WIP] Universe Creation: Orbits [May 21, 2020]

I can create stars!

I have spent last few days thinking what I should do next. I have two choices terrestrial planets or orbits... adding planets at this point would feel weird. Yes, I can generate data, I can even display planet in some random place next to the sun but what's the point? Without orbit I can't calculate orbital period, orbital velocity etc.

So yeah, this time I'm creating orbits. I hate orbits... so many weird names for simple things.

# What defines an orbit?

Thankfully wise man called Kepler will help us with answering this question.

According to Keplerian celestial mechanics we will need to know 6 elements of an orbit to fully describe it.

1. Size aka semi-major axis (a)
Orbits have two distinctive points, apoapsis (the greatest distance between objects) and periapsis (closest point between objects). For our purposes size of an orbit or semi major axis is defined as an average between apoapsis and periapsis. In school we are teached Ok but how we calucalate it if we don't have our points?
Truth is we will cheat a little bit. It is often sad that Earth orbits Sun at 1AU, when we say that we are referring to semi-major axis, so we will just define semi major axis ourselves and go from there.
2. Shape aka eccentricity (e)
Shape of an orbit is called eccentricity. It defines how much orbit deviates from perfect circle. Eccentricity of an orbit can have value between 0 (perfect circle) and 1 (parabola). Kepler says that orbits are ellipse so the orbital eccentricity must be greater than 0 and smaller than 1.
3. Pitch aka inclination (i)
Inclination of an orbit is basically rotation around x axis, values range from 0 to 180 degrees. 4. Yaw aka longitude of the ascending node (Ω)
Longitude of the ascending node (sigh i told you we will have many weird names here...) is rotation around y axis, simple as that. With this value we can go crazy since it can have value from 0 to 360 degrees.
5. Roll aka Argument of periapsis (ω)
And we have another weird name (sigh). Again really weird name for something so simple... this is a rotation around z axis. Values can range from 0-360 degrees.
6. Plot aka True anomaly (θ)
True anomaly... I don't even... anyway this value describes angle between periapsis and the object. We won't use it in our generator but it maybe be useful in other cases.

# Unity

I want to add possibility for the user to define custom, stable orbits but we have to start somewhere. Let's start with generated orbits.

To find our orbits we need to know two few things.

1. Outer limit of the system - already implemented in the star generator.
O = 40 * m

2. Inner limit of the system - will have to add that to star generator
I = 0.1 * m
This equation will give only rough idea where system orbits can start. At some point generator will have to take into an account Roche Limit.

3. Starting point for our orbit generator
Since I'm focusing on systems with habitable planets I will set distance of reference orbit somewhere in the habitable zone of the star. Alternative method would be to define star, main planet, finding orbit for biggest gas giant and go from there.

4. Typical and minimum distance between orbits
Orbits tend to be logarithmically spaced, so we have to ensure that our generator takes that into an account. Usually ratio between orbits is between 1.4 and 2.
Also distance between orbits has to be larger than 0.15AU. This way we ensure that our orbits are stable and won't decay over time.

## Unity time!

For the sake of completeness frost line calculation was added to star generation.

FL = 4.85 * sqrt(L) pink: inner border; white-blue: frost line; blue: outer border;