This paper shows that the well-known curve optimization problems which lead to the straight line, the catenary curve, the brachistochrone and the circle, can all be handled using a unied formalism. Furthermore, from the general differential equation fulfilled by these geodesics, we can guess additional functions and the required metric. The parabola, for example, is a geodesic under a metric guessed in this way. Numerical solutions are found for the curves corresponding to geodesics in the various metrics using a ray-tracing approach based on Fermat's principle.