MantisBT - Community
View Issue Details
0031402Community[OCCT] OCCT:Modeling Datapublic2020-03-04 10:502020-09-15 12:27
[OCCT] 7.4.0 
[OCCT] 7.6.0* 
0031402: Geom_BSplineSurface::Segment produces wrong result
Using Geom_BSplineSurface::Segment on the attached surface, with the parameters

surface->Segment(0., 1., 0.49999999999999988898, 0.66666666666666662966);

does not trim the surface correctly. surface->Bounds reports the following bounds after trimming:

(0.0, 1.0, 0.3333333333333333, 0.6666666666666666)

Expected bounds would be:
(0.0, 1.0, 0.5, 0.66666667)

I suppose a tolerance issue in the knot insertion algorithm.
BRep_Builder b;
TopoDS_Shape s;
BRepTools::Read(s, "surface.brep", b);

auto surface = Handle(Geom_BSplineSurface)::DownCast(BRep_Tool::Surface(TopoDS::Face(s)));

surface->Segment(0., 1., 0.49999999999999988898, 0.66666666666666662966);

double u1, u2, v1, v2;
surface->Bounds(u1, u2, v1, v2);
No tags attached.
? surface.brep (4,352) 2020-03-04 10:50
Issue History
2020-03-04 10:50martinsiggelNew Issue
2020-03-04 10:50martinsiggelAssigned To => msv
2020-03-04 10:50martinsiggelFile Added: surface.brep
2020-03-04 11:38martinsiggelNote Added: 0090808
2020-09-15 12:27msvProduct Version7.5.0 => 7.4.0
2020-09-15 12:27msvTarget Version7.5.0 => 7.6.0*

2020-03-04 11:38   
I tried to track the error down:
The v-knot insertion of 0.499999999... is almost at v=0.5, which is a knot of the surface. As this is within the knot insertion tolerance, the a knew knot is not inserted but the multiplicity of 0.5 is increased. The knot vector's size does not change. Fine so far.

The problem seems to lie in BSplCLib::LocateParameter. Here, the value of v is just outside the tolerance to the next knot (difference to the next knot is 1.1e-16, tolerance (eps) is 5.6e-17).

Conclusion: The tolerances of knot insertion and parameter location do not match and must be adapted.