The Hamilton -Jacobi theory for solving two-point boundary value problems: Theory and numerics with application to spacecraft formation flight, optimal control and the study of phase space structure.