Project curve onto surface

I want to project a curve c1 onto a surface patch. The surface patch(s1) is laying on a big parent surface(s2), which means the Geom_Surface of patch s1 is the big surface s2.
When I project the curve c1 on the patch s1 and get the projection curve c2. I find that the projection curve c2 is out of boundary of s1 and laying on the big surface s2.

How can I get the projection curve just on the s1, not on the s2 ???

Here is my codes:
-----------------
TopoDS_Face s1, s2...; // (s1 is subset of s2);

Handle(Geom_Curve) c1= ...;

Handle(Geom_Surface) mySurface = BRep_Tool::Surface(s1);

Handle(Geom_Curve) c2= GeomProjLib::Project(c1, mySurface);

TopoDS_Edge aEdgepj = BRepBuilderAPI_MakeEdge(c2, c2->FirstParameter(),c2->LastParameter());
// aEdgepj is out of boundary of c2 and laying on s2.
-----------------

Jun WANG's picture

sorry. The last sentence should be: // aEdgepj is out of boundary of s1 and laying on s2.