View Issue Details

IDProjectCategoryView StatusLast Update
0024035Open CASCADEOCCT:Modeling Algorithmspublic2013-12-19 13:56
Reporterika Assigned Toika  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.6.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0024035: Intersector is not symmetrical
DescriptionIntersector can return different results after finding intersection of two edges in one order and in another. In example two faces, which are different only in order of edges (shift in numbering). The first and the sixth edges are intersected(face1), but in face2 the third (sixth in face1) and the fourth (first in face1) are not.
Steps To Reproducerestore face1
restore face2
checkshape face1

//On Shape faulty_1 :
//BRepCheck_SelfIntersectingWire
//On Shape faulty_2 :
//BRepCheck_UnorientableShape
//Shape faulty_1 on shape faulty_2 :
//BRepCheck_SelfIntersectingWire
//
//Faulty shapes in variables faulty_1 to faulty_2
checkshape face2

//On Shape faulty_1 :
//BRepCheck_BadOrientationOfSubshape
//
//Faulty shapes in variables faulty_1 to faulty_1
TagsNo tags attached.
Test case numberbugs modalg_5 bug24035

Attached Files

  • face1 (24,698 bytes)
  • face2 (24,698 bytes)
  • 24035.PNG (28,796 bytes)
  • 24035_zoom.PNG (20,633 bytes)

Activities

ika

2013-06-18 12:29

manager  

face1 (24,698 bytes)

ika

2013-06-18 12:30

manager  

face2 (24,698 bytes)

ika

2013-06-18 12:54

manager   ~0024786

Last edited: 2013-06-18 13:32

Asymmetrical check in
Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
    const TheCurve& C1,
    const IntRes2d_Domain& D1,
    const TheCurve& C2,
    const IntRes2d_Domain& D2,
    const Standard_Real TolConf,
    const Standard_Real Tol,
    const Standard_Integer NbIter,
    const Standard_Real DeltaU,
    const Standard_Real DeltaV,
    const IntCurve_ThePolygon2d& thePoly1,
    const IntCurve_ThePolygon2d& thePoly2,
    Standard_Boolean isFullPolygon )
was changed to symmetrical.

Some tests in de are failed because there are small differences with old behavior in number of vertices and edges and in tolerance. I think it is not regression.

Branch CR24035 is ready to be reviewed.

Dear IFV,
Please review.

ifv

2013-06-19 17:12

developer   ~0024805

Dear ika,
in my opinion, first part of fix:

    gp_Pnt2d P1sup,P2sup;
    TheCurveTool::D0(C1,PolyUInf,P1);
    TheCurveTool::D0(C2,PolyVInf,P2);
    TheCurveTool::D0(C1,PolyUSup,P1sup);
    TheCurveTool::D0(C2,PolyVSup,P2sup);
    Standard_Real infinf = P1.SquareDistance(P2);
    Standard_Real infsup = P1.SquareDistance(P2sup);
    Standard_Real supinf = P2.SquareDistance(P1sup);
    Standard_Real supsup = P1sup.SquareDistance(P2sup);
    if (infsup < infinf && infsup <= supinf && infsup <= supsup) {
      Standard_Real qwerty=PolyVInf; PolyVInf=PolyVSup; PolyVSup=qwerty;
      }
    if (supinf < infinf && supinf < infsup && supinf <= supsup){
      Standard_Real qwerty=PolyUInf; PolyUInf=PolyUSup; PolyUSup=qwerty;
      }
    if (supsup < infinf && supsup < infsup && supsup < supinf) {
      Standard_Real qwerty=PolyUInf; PolyUInf=PolyUSup; PolyUSup=qwerty;
      qwerty=PolyVInf; PolyVInf=PolyVSup; PolyVSup=qwerty;
      }

is useless, because bug is wrong conditions:
if(SegIndex1onP1 >= thePoly1.NbSegments()) { SegIndex1onP1--; ParamOnLine = 1.0; }
...
if(SegIndex1onP2 >= thePoly2.NbSegments()) { SegIndex1onP2--; ParamOnLine = 1.0; }
which cause wrong calculation of approx parameter on curve for last polygon segment and wrong calculations of distmemesence and distdiffsence.
The correct conditions are:
SegIndex1onP1 > thePoly1.NbSegments()
SegIndex1onP2 > thePoly2.NbSegments()

The second part of fix - replacing PolyUinf by PolyUSup ... is quite correct.
By the way, do not use "Indent braces" for C/C++ Formatting setting in order to avoid indentation of closing bracket for "if" or "for":
if (supinf < infinf && supinf < infsup && supinf <= supsup){
  Standard_Real qwerty=PolyUInf; PolyUInf=PolyUSup; PolyUSup=qwerty;
  }
According OCC programming rules closing bracket must be in the same position as "if":
  if (...) {
    ...
  }

ika

2013-06-20 16:57

manager   ~0024819

Dear IFV,
thank you for your remarks. Branch was updated, according to them.

Branch CR24035 is ready to be reviewed.

Please review.

ifv

2013-06-20 18:03

developer   ~0024820

Ok

apn

2013-06-21 11:54

administrator   ~0024832

Dear BugMaster,

Branch CR24035 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: c4e63a1c6dafcbc1f0402fc9fe9e8ca640a8969e

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (7 on master)

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

Regressions:
heal split_closed_faces G5
http://occt-tests/CR24035-master-occt/Debian60-64/heal/split_closed_faces/G5.html
http://occt-tests/CR24035-master-occt/Windows-32-VC9/heal/split_closed_faces/G5.html

Improvements:
No improvements

Testing cases:
bugs modalg_5 bug24035 - OK
Testing cases in group "de" were modified and pushed to branch

Testing on Linux:
Total MEMORY difference: 365445988 / 365501656
Total CPU difference: 52878.43000000025 / 40220.25000000088

Testing on Windows:
Total MEMORY difference: 421927448 / 421527800
Total CPU difference: 34733.40625 / 37208.5625

There are not differences in images found by testdiff.

ika

2013-06-26 12:11

manager   ~0024877

Dear APN,

The test fails because of corrections in intersector's behavior, which lead to changes in checkshape. Shape from this test is not valid because it has self-intersected wire (see the attachment), but it couldn't be found before fix. So I ask you to add TODO in test script.

ika

2013-06-26 12:11

manager  

24035.PNG (28,796 bytes)

ika

2013-06-26 12:12

manager  

24035_zoom.PNG (20,633 bytes)

apn

2013-06-26 12:31

administrator   ~0024879

TODO was added to test case heal split_closed_faces G5. So there are no regressions in CR24035 now.

apn

2013-07-10 14:37

administrator   ~0025014

Testing cases in group de were modified using new reference data (generated by script). They will be pushed to master in Friday.

Related Changesets

occt: master 404d419d

2013-06-27 06:08:14

ika

Details Diff
0024035: Intersector is not symmetrical
asymmetrical check in Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect was changed to symmetrical.
fix wrong calculation of approx parameter on curve for last polygon segment
Added test case bugs/modalg_5/bug24035
Modified TODO in "de" test cases because there are small differences with old behaviour
Modified test case heal/split_closed_faces/G5 because of corrections in intersector's behavior, which lead to changes in checkshape
Affected Issues
0024035
mod - src/IntCurve/IntCurve_IntPolyPolyGen.gxx Diff File
add - tests/bugs/modalg_5/bug24035 Diff File
mod - tests/de/iges_1/J9 Diff File
mod - tests/de/iges_1/K3 Diff File
mod - tests/de/iges_1/L8 Diff File
mod - tests/de/iges_1/P5 Diff File
mod - tests/de/iges_1/R8 Diff File
mod - tests/de/iges_2/A1 Diff File
mod - tests/de/iges_2/B8 Diff File
mod - tests/de/iges_2/C5 Diff File
mod - tests/de/iges_2/G5 Diff File
mod - tests/de/iges_3/A2 Diff File
mod - tests/de/step_1/D7 Diff File
mod - tests/de/step_2/A6 Diff File
mod - tests/de/step_3/C6 Diff File
mod - tests/de/step_3/D9 Diff File
mod - tests/de/step_3/E6 Diff File
mod - tests/heal/split_closed_faces/G5 Diff File

Issue History

Date Modified Username Field Change
2013-06-18 12:29 ika New Issue
2013-06-18 12:29 ika Assigned To => ika
2013-06-18 12:29 ika File Added: face1
2013-06-18 12:30 ika File Added: face2
2013-06-18 12:54 ika Note Added: 0024786
2013-06-18 12:54 ika Assigned To ika => ifv
2013-06-18 12:54 ika Status new => resolved
2013-06-18 13:32 ika Note Edited: 0024786
2013-06-19 17:12 ifv Note Added: 0024805
2013-06-19 17:12 ifv Status resolved => feedback
2013-06-20 14:22 ifv Assigned To ifv => ika
2013-06-20 16:57 ika Note Added: 0024819
2013-06-20 16:57 ika Assigned To ika => ifv
2013-06-20 16:57 ika Status feedback => resolved
2013-06-20 18:03 ifv Note Added: 0024820
2013-06-20 18:03 ifv Status resolved => reviewed
2013-06-21 11:19 apn Test case number => bugs modalg_5 bug24035
2013-06-21 11:39 mkv Assigned To ifv => apn
2013-06-21 11:54 apn Note Added: 0024832
2013-06-21 11:54 apn Assigned To apn => ika
2013-06-21 11:54 apn Status reviewed => assigned
2013-06-26 12:11 ika Note Added: 0024877
2013-06-26 12:11 ika File Added: 24035.PNG
2013-06-26 12:12 ika File Added: 24035_zoom.PNG
2013-06-26 12:12 ika Assigned To ika => apn
2013-06-26 12:12 ika Status assigned => feedback
2013-06-26 12:31 apn Note Added: 0024879
2013-06-26 12:32 apn Assigned To apn => bugmaster
2013-06-26 12:32 apn Status feedback => tested
2013-06-28 10:24 ika Changeset attached => occt master 404d419d
2013-06-28 10:24 ika Assigned To bugmaster => ika
2013-06-28 10:24 ika Status tested => verified
2013-06-28 10:24 ika Resolution open => fixed
2013-07-10 14:37 apn Note Added: 0025014
2013-12-19 13:53 bugmaster Status verified => closed
2013-12-19 13:56 bugmaster Fixed in Version => 6.7.0