working on contour_surf
Plausible reconstruction of matlab version