0025908: BSpline (U2 < U1) in HLRBRep_HLRToShape
authormsv <msv@opencascade.com>
Thu, 30 Apr 2015 11:22:56 +0000 (14:22 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 30 Apr 2015 11:26:06 +0000 (14:26 +0300)
Test case for issue CR25908

src/HLRBRep/HLRBRep_Hider.cxx
tests/bugs/modalg_6/bug25908 [new file with mode: 0755]

index 1295749..263b737 100644 (file)
@@ -430,15 +430,19 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
          EB.Builds(aBuildIN);                         // build hidden parts
                                                       // ******************
          while (EB.MoreEdges()) {
-           while (EB.MoreVertices()) {
+            p1 = 0.; p2 = 0.;
+            Standard_Integer aMaskP1P2 = 0;
+            while (EB.MoreVertices()) {
              switch (EB.Orientation()) {
              case TopAbs_FORWARD  : 
                p1   =  EB.Current().Parameter(); 
                tol1 =  EB.Current().Tolerance();
+                aMaskP1P2 |= 1;
                break;
              case TopAbs_REVERSED :
                p2   =  EB.Current().Parameter(); 
                tol2 =  EB.Current().Tolerance();
+                aMaskP1P2 |= 2;
                break;
              case TopAbs_INTERNAL :
              case TopAbs_EXTERNAL :
@@ -447,7 +451,7 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
              EB.NextVertex();
            }
 
-           if(Abs(p1 - p2) <= 1.e-7) {
+           if(aMaskP1P2 != 3 || p2 - p1 <= 1.e-7) {
              EB.NextEdge();
              continue;
            }
@@ -479,15 +483,19 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
          EB.Builds(TopAbs_ON);             // build parts under the boundary
                                            // ******************************
          while (EB.MoreEdges()) {
+            p1 = 0.; p2 = 0.;
+            Standard_Integer aMaskP1P2 = 0;
            while (EB.MoreVertices()) {
              switch (EB.Orientation()) {
              case TopAbs_FORWARD  :
                p1   = EB.Current().Parameter(); 
                tol1 = EB.Current().Tolerance();
+                aMaskP1P2 |= 1;
                break;
              case TopAbs_REVERSED :
                p2   = EB.Current().Parameter(); 
                tol2 = EB.Current().Tolerance();
+                aMaskP1P2 |= 2;
                break;
              case TopAbs_INTERNAL :
              case TopAbs_EXTERNAL :
@@ -495,7 +503,12 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
              }
              EB.NextVertex();
            }
-           
+
+            if(aMaskP1P2 != 3 || p2 - p1 <= 1.e-7) {
+             EB.NextEdge();
+             continue;
+           }
+
            TopAbs_State aTestState = TopAbs_IN;
            if(IsSuspicion) {
              //Standard_Integer aNbp = 1;
@@ -558,15 +571,19 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
          EB.Builds (TopAbs_IN);                   // build parts on the Face
                                                    // ***********************
          while (EB.MoreEdges()) {
+            p1 = 0.; p2 = 0.;
+            Standard_Integer aMaskP1P2 = 0;
            while (EB.MoreVertices()) {
              switch (EB.Orientation()) {
              case TopAbs_FORWARD  : 
                p1   = EB.Current().Parameter(); 
                tol1 = EB.Current().Tolerance();
+                aMaskP1P2 |= 1;
                break;
              case TopAbs_REVERSED :
                p2   = EB.Current().Parameter(); 
                tol2 = EB.Current().Tolerance();
+                aMaskP1P2 |= 2;
                break;
              case TopAbs_INTERNAL :
              case TopAbs_EXTERNAL :   
@@ -574,6 +591,12 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
              }
              EB.NextVertex();
            }
+
+            if(aMaskP1P2 != 3 || p2 - p1 <= 1.e-7) {
+             EB.NextEdge();
+             continue;
+           }
+
            ES.Hide(p1,tol1,p2,tol2,
                    Standard_True,    // on     the Face
                    Standard_False);  // inside the Face
@@ -583,15 +606,19 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
          EB.Builds(TopAbs_ON);      // build hidden parts under the boundary
                                      // *************************************
          while (EB.MoreEdges()) {
+            p1 = 0.; p2 = 0.;
+            Standard_Integer aMaskP1P2 = 0;
            while (EB.MoreVertices()) {
              switch (EB.Orientation()) {
              case TopAbs_FORWARD  :
                p1   = EB.Current().Parameter(); 
                tol1 = EB.Current().Tolerance();
+                aMaskP1P2 |= 1;
                break;
              case TopAbs_REVERSED :
                p2   = EB.Current().Parameter(); 
                tol2 = EB.Current().Tolerance();
+                aMaskP1P2 |= 2;
                break;
              case TopAbs_INTERNAL :
              case TopAbs_EXTERNAL :
@@ -599,7 +626,13 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
              }
              EB.NextVertex();
            }
-           ES.Hide(p1,tol1,p2,tol2,
+
+           if(aMaskP1P2 != 3 || p2 - p1 <= 1.e-7) {
+             EB.NextEdge();
+             continue;
+           }
+
+            ES.Hide(p1,tol1,p2,tol2,
                    Standard_True,    // on the Face
                    Standard_True);   // on the boundary
            EB.NextEdge();
diff --git a/tests/bugs/modalg_6/bug25908 b/tests/bugs/modalg_6/bug25908
new file mode 100755 (executable)
index 0000000..e3e368c
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25908"
+puts "============"
+puts ""
+###############################
+## BSpline (U2 < U1) in HLRBRep_HLRToShape
+###############################
+
+restore [locate_data_file bug25908_hlr-bspline-clone2-tcl-h1.brep] h1
+
+hprj h1_proj 0 0 0 0 1 0 0 0 1
+houtl h1_outl h1
+hfill h1_outl h1_proj 0
+hload h1_outl
+hsetprj h1_proj
+hupdate
+hhide
+hres2d
+compound vl v1l vnl vol vil result
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX    : 169
+ EDGE      : 85
+ WIRE      : 0
+ FACE      : 0
+ SHELL     : 0
+ SOLID     : 0
+ COMPSOLID : 0
+ COMPOUND  : 1
+ SHAPE     : 255
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t -m "HLRToShape"
+
+set 2dviewer 1