- Home /
Parametric Equation for Elliptical Orbit in Space
Currently I am able to properly simulate a galaxy using the density wave theory in two dimensions however I am a bit confused how to simulated an orbit in 3D space with the orbit slightly tilted (to not have a completely flat galaxy as I have now).
Equations currently being used for two dimensions :: x = a*cos(t)*cos(theta) - b*sin(t)*sin(theta)
y = a*cos(t)*sin(theta) + b*sin(t)*cos(theta)
where t is angle += velocity / radius (from the arc length formula) every frame. where theta is theta(from previous ellipse) + theta increment to create spirals
I'm pretty sure the equations you are using are boiled-down versions of the 3D equivalent. You'll probably need to look up some academic papers online to find the math notation for the full 3D dynamics and convert it to code.
I've done a few projects using 3D orbital mechanics from kepler arguments and even that gets ridiculously complicated.