Variational analysis of orbits in the restricted 3-body problem and the Hill problem, and its application to the orbital design of space probes and artificial satellites