MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031402Community[OCCT] OCCT:Modeling Datapublic2020-03-04 10:502020-11-27 15:15
Reportermartinsiggel 
Assigned Toaavtamon 
PrioritynormalSeveritymajor 
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version[OCCT] 7.4.0 
Target Version[OCCT] 7.6.0*Fixed in Version 
Summary0031402: Modeling Data - Geom_BSplineSurface::Segment() produces wrong result
DescriptionUsing 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.
Steps To Reproduce
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);
TagsNo tags attached.
Test case number
Attached Files? file icon surface.brep (4,352 bytes) 2020-03-04 10:50

- Relationships

-  Notes
(0090808)
martinsiggel (developer)
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.
(0096686)
git (administrator)
2020-11-12 11:04

Branch CR31402 has been created by aavtamon.

SHA-1: 7af830d5780e75790b08c4d572dba51fb210130e


Detailed log of new commits:

Author: aavtamon
Date: Thu Nov 12 09:38:50 2020 +0300

    0031402: Modeling Data - Geom_BSplineSurface::Segment produces wrong result
    
    - Added test case bug31402 in tests/bugs/moddata_3;
    - Added test data file bug31402.brep in data/occ;
    - Added new test command OCC31402 in QABugs_20.cxx;
    - Added tolerance as a default parameter in one of BSplCLib::LocateParameter declarations;
    - Changed calls of LocateParameter method in Geom_BSplineSurface::segment.
(0096723)
git (administrator)
2020-11-12 16:52

Branch CR31402 has been updated forcibly by aavtamon.

SHA-1: 962605742c961f79d4f260597de293228db633c5
(0096732)
git (administrator)
2020-11-12 22:24

Branch CR31402 has been updated forcibly by aavtamon.

SHA-1: 40ac7d258eda547429be6574767f79ea7dd7dd55
(0096743)
git (administrator)
2020-11-13 12:35

Branch CR31402 has been updated forcibly by aavtamon.

SHA-1: 2d45160898b8a015f1e4dd9cf9c98f448c0cd28a
(0096744)
git (administrator)
2020-11-13 12:42

Branch CR31402 has been updated forcibly by aavtamon.

SHA-1: 0b204a460ad1344783bedb6fe91f198a8fc85780
(0096746)
aavtamon (developer)
2020-11-13 14:48

Dear Mikhail,
could you please check it?
http://jenkins-test-12.nnov.opencascade.com/view/CR31402-master-aavtamon/view/ALL/ [^]
(0096753)
msv (developer)
2020-11-13 18:11

checkshape s
is extra command, as we don't need to check the shape in this test.

Do not put the test brep file in the source repository.
(0096754)
msv (developer)
2020-11-13 18:14

In the commit message, it is better not to list the files and methods that you have changed. It is rather more interesting to know the logical changes.
(0096755)
msv (developer)
2020-11-13 18:16

Dear Igor,
Could you review the logical part? May be it is needed also to see if the tolerance is to be added in other LocateParameter methods?
Or, may be consider another idea of fix?
(0096772)
aavtamon (developer)
2020-11-14 00:01

In this case method "Segment" changes the surface belonging to the shape, so it is worth to check the shape after reproduce steps implementation. The following lines show results of checkshape call:
 
checkshape s
 **** probleme de SameParameter au point :
         0.272727272727273 1.38777878078145e-016 1
   Erreur detectee :1.35236664162281 Tolerance :1e-007
 **** probleme de SameParameter au point :
         0.272727272727273 1.38777878078145e-016 1
   Erreur detectee :1.35236664162281 Tolerance :1e-007
On Shape faulty_1 :
BRepCheck_UnorientableShape
Shape faulty_2 on shape faulty_1 :
BRepCheck_InvalidCurveOnClosedSurface
BRepCheck_InvalidSameParameterFlag

Faulty shapes in variables faulty_1 to faulty_2
(0096791)
ifv (developer)
2020-11-16 13:05

In my opinion, using tolerance in LocateParameter(...) is not good idea.
Algorithm of this method must locate parameter with maximal possible precision and correspond with allowed distance between knots, see method CheckSurfaceData(...):
.....
  for (i = SUKnots.Lower(); i < SUKnots.Upper(); i++) {
    if (SUKnots(i+1) - SUKnots(i) <= Epsilon(Abs(SUKnots(i)))) {
      throw Standard_ConstructionError("Geom_BSplineSurface: UKnots interval
                                       values too close");
    }
  }
....
This method is rather popular and often used in Spline calculations, inappropriate value of tolerance can cause wrong definition of knot interval.
I think it would better to handle tolerance (EpsU, EpsV) at level of method Segment() or InsertU(V)Knots(...).

Some remarks:
If we change something in Geom_BSplineSurface, it is necessary to do the same for Geom_BSplineCurve and Geom2d_BSplineCurve, otherwise Segment(...) for surface will be work correctly, but for isoline of this surface it will work wrongly.

It is not necessary to make special QAcommand, there is Draw command "segsur", which can be used in tests:
Draw[45]> help segsur
segsur : segsur name Ufirst Ulast Vfirst Vlast [Utol [Vtol]]
(0097110)
git (administrator)
2020-11-27 15:15

Branch CR31402_1 has been created by aavtamon.

SHA-1: 4dd6ba131f5d2d8121180b6717344b397d854ea0


Detailed log of new commits:

Author: aavtamon
Date: Fri Nov 27 15:08:33 2020 +0300

    0031402: Modeling Data - Geom_BSplineSurface::Segment() produces wrong result
    
    In Geom_BSplineSurface, Geom_BSplineCurve and Geom2d_BSplineCurve changed Eps calculation from Max to Min in method Segment().

- Issue History
Date Modified Username Field Change
2020-03-04 10:50 martinsiggel New Issue
2020-03-04 10:50 martinsiggel Assigned To => msv
2020-03-04 10:50 martinsiggel File Added: surface.brep
2020-03-04 11:38 martinsiggel Note Added: 0090808
2020-09-15 12:27 msv Product Version 7.5.0 => 7.4.0
2020-09-15 12:27 msv Target Version 7.5.0 => 7.6.0*
2020-11-02 11:30 szy Assigned To msv => aavtamon
2020-11-02 11:30 szy Status new => assigned
2020-11-12 11:04 git Note Added: 0096686
2020-11-12 16:52 git Note Added: 0096723
2020-11-12 17:22 kgv Summary Geom_BSplineSurface::Segment produces wrong result => Modeling Data - Geom_BSplineSurface::Segment() produces wrong result
2020-11-12 17:23 kgv Description Updated View Revisions
2020-11-12 17:23 kgv Steps to Reproduce Updated View Revisions
2020-11-12 22:24 git Note Added: 0096732
2020-11-13 12:35 git Note Added: 0096743
2020-11-13 12:42 git Note Added: 0096744
2020-11-13 14:48 aavtamon Note Added: 0096746
2020-11-13 14:48 aavtamon Assigned To aavtamon => msv
2020-11-13 14:48 aavtamon Status assigned => resolved
2020-11-13 18:11 msv Note Added: 0096753
2020-11-13 18:14 msv Note Added: 0096754
2020-11-13 18:16 msv Note Added: 0096755
2020-11-13 18:16 msv Assigned To msv => ifv
2020-11-14 00:01 aavtamon Note Added: 0096772
2020-11-16 13:05 ifv Note Added: 0096791
2020-11-16 13:05 ifv Assigned To ifv => aavtamon
2020-11-16 13:05 ifv Status resolved => assigned
2020-11-16 13:21 ifv Relationship added related to 0030645
2020-11-27 15:15 git Note Added: 0097110


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker