1. A method for computing a setpoint trajectory of an aircraft, the trajectory defining at least successive values of lateral position, altitude, and speed of the aircraft, the trajectory comprising at least two subsets, the method comprising at least: a step of formulating at least one optimization problem for the trajectory for at least one optimization criterion, the formulating step comprising at least: a sub-step of formulating at least one constraint related to a transition of legs on at least one first subset of the trajectory; a sub-step of formulating at least one constraint related to a transition of vertical flight phases on at least one second subset of the trajectory; a step of solving the optimization problem for the trajectory.