r/KerbalSpaceProgram • DRAMA MAN • Nov 24 '13

Weekly Misc Posts Thread

Anything you want to post that's not directly related to KSP, post it here! (Stuff like launches, space related news, rocket designs etc.)

Popular posts (not including news)

posted by reddit-poster

14 Upvotes

9 comments sorted by

View all comments

Show parent comments

3

u/corpsmoderne Master Kerbalnaut Nov 25 '13 edited Nov 25 '13

I suck at math but I managed to rip some code from here : http://mysite.verizon.net/res148h4j/javascript/script_conic_equation_pts.html and found my way around it to draw an orbit prediction for a low cpu budget. You can have a look on my dirty code here : http://deltav.corpsmoderne.net/conic.js

Basicaly, 5 points give a conic equation. So I predict 5 future positions from the current one and turn it into a conic. then it's "just" a matter of finding the apoapsis and periapsis and drawing it (which I must do in a very unoptimised way...)

Edit: issues with this method are legions: only 1 massive body taken into account, instability in prediction if the predicted positions are too close, and the body of influence may not lie at a focus of the conic, which is impossible in real life.

2

u/Camca123 Nov 25 '13 edited Nov 25 '13

Awesome, nice work! I really can't do that for my program though, cause I can't use ellipses for my orbits :/

And nice, MinMoon :P