closed curve offset on surface

I want to offset the closed curve on the surface by the specified distance as shown in the figure.
One of my ideas is to use contour lines(using vtkContourFilter)to extract the offset curve, But one of the main questions is how do I compute a scalar for each point on the surface.
Or is there another way to implement curve offset?