I am writing a little 2d space program and I need to calculate a velocity vector for my program. I already have my elliptical orbits working well but once the eccentricity of the orbit goes over 1 the velocity calculations fall apart.
I used this thread as a reference and it worked perfectly for what I need. The top answer gave the the direction for the velocity. The vis-viva equation gave me the magnitude.
Does this equation work for hyperbolic orbits as well? It doesn't seem to be working for me. The x or y components seemed to be flipped depending on the the rotation of the orbit. I have also been unable to verify that it is producing the correct value anyways. I suspect that it is simply not the correct equation as the semi major axis is now negative in a hyperbolic orbit and the semi minor axis represents something else entirely.