isocurve outside bspline surface face

Hi,
I've some faces made by BSplineSurface.
On this faces I draw the iso curves at fixed values of U and V.
Usually my code works fine, but I found a faces in which iso curves fall outside the face edges. Someone can help me understand why ?
I put on http://www.benuzzi.net/forum01/images.html some images for a good case and a bad one.

My code is more or less the following

BRepAdaptor_Surface adaptor(TopoDS::Face(shape), true);
Handle(Geom_BSplineSurface) surface = adaptor.BSpline();
Standard_Real umin,vmin,umax,vmax;
surface->Bounds (umin,umax,vmin,vmax);
Standard_Real u,v;
Handle(Geom_Curve) isoCurve;
TopoDS_Edge isoEdge;
for ( u = umin; u {
isoCurve = surface->UIso(u);
isoEdge = BRepBuilderAPI_MakeEdge(isoCurve);
Handle(AIS_Shape) isoShape = new AIS_Shape(isoEdge)
TopoDS_Edge segment;
myAISContext->SetColor(isoShape, Quantity_NOC_CYAN1, Standard_False);
myAISContext->Display(isoShape);
}
for ( v = vmin; v {
isoCurve = surface->VIso(v);
isoEdge = BRepBuilderAPI_MakeEdge(isoCurve);
Handle(AIS_Shape) isoShape = new AIS_Shape(isoEdge)
TopoDS_Edge segment;
myAISContext->SetColor(isoShape, Quantity_NOC_CYAN1, Standard_False);
myAISContext->Display(isoShape);
}

Gerhard Hofmann's picture

Hello Marco,
it is the difference between Surface and Face. The Surface has a rectangular bound (if any), the Face is bounded by a wire (which always must reside inside the recatngular bounds of the surface).
best regards
Gerhard

Marco Matt's picture

Hi Gerhard,
I'm your reply doesn't convince me because I've tried with a lot of surfaces, but only the one I show in the web page give me a strange result. As you can see in the web page it seems not a matter of rectangular bounds of the surface.

Gerhard Hofmann's picture

Hi,
maybe you have more examples. As I can see on your pictures, the first one has a rectangular u/v bound, the second doesn't. I assumed the first pair of pictures is correct the second pair is incorrect. Do I interpret it right?
Gerhard

Marco Matt's picture

You are right.
In both cases the bound for the U/V are rectangular, but it cannot be different because the only way I know to find U/V bound is

Standard_Real umin,vmin,umax,vmax;
surface->Bounds (umin,umax,vmin,vmax);

In the first case (which is similar to a lot of other cases) the iso curves are inside the face.
In the second case (the only one I found for now) the iso curve are outside the face.

Gerhard Hofmann's picture

I newer used the BRepAlgoAPI_Common class for this purpose but maybe you could use it for a TopoDS_Face and a TopoDS_Edge. If you don't have an edge use BRepBuilderAPI_MakeEdge to make an edge.
Good luck and let me know whether it works.
Gerhard