Feature preserving variational smoothing of terrain data