Curvature sensing with a Shack-Hartmann sensor