- Home /
Draw an ellipse given orbital elements
I am making a program which simulates the motion of a satellite around a massive body. I have a list of orbital elements as well as the satellites position and velocity vectors and would like to be able to draw out the circle/ellipse/parabola/hyperbola which represents the satellites orbit in 3 dimensions.
I have the following elements defined:
semi-major axis
eccentricity
semi-latus rectum
apoapsis
periapsis
inclination
longitude of ascending node
argument of periapsis
velocity vector
position vector
You have them defined; in what form? As arrays of sequential points, for instance? That's what you'll ultimately need to draw lines.
What exactly do you need help with? Just drawing the lines? Or with collecting /calculating these data?
Regarding drawing lines, http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/
I recommend the second of the three discussed methods, which involves realtime calculation of billboarded line segments and using Draw$$anonymous$$eshNow to limit overhead. All my lines are drawn using a similar method. It gives control over width, and you can use vertex colors (with a vertex color shader) to colorize the line segments individually.
None of those elements are saved, but rather recalculated at each step depending on the satellites position and velocity vectors. Some values represent angles (arg of periapsis, longitude of ascending node, inclination) and others are just scalar representing distances.
All of these together describe an ellipse (orbit) in 3D space. I do not want to draw the ellipse as the ship travels, but rather draw the projected orbit it will be traveling on based off of these values.
I'm not familiar enough with this branch of physics to suggest anything super useful about how you'll project your ellipse figure.
Established methods exist for achieving such predictions. Search "runge-kutta" and "rk4" within the context of predicting orbits, and take an in-depth look at $$anonymous$$epler's laws.
IIRC, only some of these data will be necessary, perhaps only the velocities and masses of the bodies. I seem to remember that orbit prediction is pretty darn simple, really, though what I learned was not in an academic or scientific context and thus total accuracy was not essential.
If you have enough knowns, you can always find your unknowns. You're after a collection of predicted future positions which you can use to draw the curve. The answer will involve a recursive algorithm whose iterations and timesteps deter$$anonymous$$e prediction fidelity.
Answer by Megaboy · Mar 21, 2016 at 12:57 PM
@BajaSlap if you still or anyone interested in this topic, I can help you with orbit vizualization, it's super easy. Just notify me : shinemylight@yandex.ru
Last seen: Apr 22, 2015 at 05:14 A$$anonymous$$
Did you even look at his activity before necroing an old thread?
Your answer
![](https://koobas.hobune.stream/wayback/20220613193717im_/https://answers.unity.com/themes/thub/images/avi.jpg)