ENH: moved to 3D to allow negative curvature too.