I had a version of this once that also took into account the time it takes to rotate a ship around.
- we’re going from A->B using max allowed acceleration (I also had g limits)
- keep accelerating towards destination, flip the thruster 180, start burning in the opposite direction to come to a stop at destination
- the tricky part was to incorporate the time it takes to do the 180 flip and fit it into the other formula; you need to slot it in between the acceleration and deceleration phases
There is chance I’ll be working on this again in a less half-arsed way this time round, soon-ish™.