Curve on Surface

I need write a function just like next link.
http://wiki.mcneel.com/labs/curveonsurfaccv5

The curve will tend to go in a straight or direct path instead of following the surface isocurves
the function look like this:
On_Curve* CreateCurveOnFace(On_simplarray<On_3dPoint>& in_points,On_surface* in_face);
or like this:
On_Curve* CreateCurveOnFace(On_simplarray<On_3dPoint>& in_points,On_brep*in_brep);

can anyone helo me? thanks