The book Numerical Recipes in C, which I believe can be downloaded for free, has some good formulas for calculating the roots of a cubic equation in section 5.6 Quadratic and Cubic Equations.
Oh really? I don't think I have gone through that book more than a glance, I will definitely be getting it and check on those formulas. Thanks! Would definitely have made this cleaner, but it also gave me a push to finally make a standard solver even for bisection method haha
@@TheGreatestFez yes, exactly, set dif to targetAP - SiAP. set frac to dif/targetAP. if frac < 1{ if frac > -1{ set theta to arcsin(frac). } } Lock heading to (90,theta). explanation; targetAP = target final orbit height, SiAP = ship:apoapsis, dif = how far the ship has left to go (vertical), frac = converts dif to a decimal, the if statements protect against invalid inputs for arcsin, arcsin converts the decimal into degress
The book Numerical Recipes in C, which I believe can be downloaded for free, has some good formulas for calculating the roots of a cubic equation in section 5.6 Quadratic and Cubic Equations.
Oh really? I don't think I have gone through that book more than a glance, I will definitely be getting it and check on those formulas.
Thanks! Would definitely have made this cleaner, but it also gave me a push to finally make a standard solver even for bisection method haha
Thanks for updating!
i do the angle calc via the apoapsis. works well
What do you mean? Pitch the ship over as a function of the apoapsis?
@@TheGreatestFez yes, exactly,
set dif to targetAP - SiAP.
set frac to dif/targetAP.
if frac < 1{
if frac > -1{
set theta to arcsin(frac).
}
}
Lock heading to (90,theta).
explanation; targetAP = target final orbit height, SiAP = ship:apoapsis, dif = how far the ship has left to go (vertical), frac = converts dif to a decimal, the if statements protect against invalid inputs for arcsin, arcsin converts the decimal into degress
and if u do target AP as a function of the diameter of the body you're launch from, it will work on any planet
@@biomecaman3514 Top notch, that is a very elegant solution
@@TheGreatestFez :-)
How many frames do you average the jerk over?