0023733: PCurve for edge on face creation failure
authorskv <skv@opencascade.com>
Fri, 15 Feb 2013 12:55:25 +0000 (16:55 +0400)
committerskv <skv@opencascade.com>
Fri, 15 Feb 2013 12:55:25 +0000 (16:55 +0400)
Adding test case for this fix

src/Extrema/Extrema_ExtPElC.cxx
src/Extrema/Extrema_ExtPRevS.cxx
tests/bugs/moddata/bug23733 [new file with mode: 0755]

index a3e9c64..685c7c0 100755 (executable)
@@ -228,8 +228,9 @@ Method:
     Us = Sol.Value(NoSol);
     Cu = ElCLib::Value(Us,C);
     mySqDist[myNbExt] = Cu.SquareDistance(P);
     Us = Sol.Value(NoSol);
     Cu = ElCLib::Value(Us,C);
     mySqDist[myNbExt] = Cu.SquareDistance(P);
-    myIsMin[myNbExt] = (NoSol == 1);
     myPoint[myNbExt] = Extrema_POnCurv(Us,Cu);
     myPoint[myNbExt] = Extrema_POnCurv(Us,Cu);
+    Cu = ElCLib::Value(Us + 0.1, C);
+    myIsMin[myNbExt] = mySqDist[myNbExt] < Cu.SquareDistance(P);
     myNbExt++;
   }
   myDone = Standard_True;
     myNbExt++;
   }
   myDone = Standard_True;
index ac49e56..f2beb94 100755 (executable)
@@ -363,7 +363,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
          newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
 
          if (newV > myvsup) {
          newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
 
          if (newV > myvsup) {
-           newV = myvsup;
+            newV -= 2. * M_PI;
+
+            if (newV + mytolv < myvinf) {
+              newV = myvsup;
+            } else if (newV < myvinf) {
+              newV = myvinf;
+            }
          }
        }
        V = newV;
          }
        }
        V = newV;
@@ -382,8 +388,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
           (anACurve->GetType() == GeomAbs_Ellipse)) {
          newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
          
           (anACurve->GetType() == GeomAbs_Ellipse)) {
          newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
          
-         if(newV < myvinf)
-           newV = myvinf;
+          if(newV < myvinf) {
+            newV += 2. * M_PI;
+            if (newV - mytolv > myvsup) {
+              newV = myvinf;
+            } else if (newV > myvsup) {
+              newV = myvsup;
+            }
+          }
        }
        V = newV;
 
        }
        V = newV;
 
@@ -422,7 +435,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
          newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
 
          if (newV > myvsup) {
          newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI);
 
          if (newV > myvsup) {
-           newV = myvsup;
+            newV -= 2. * M_PI;
+
+            if (newV + mytolv < myvinf) {
+              newV = myvsup;
+            } else if (newV < myvinf) {
+              newV = myvinf;
+            }
          }
        }
        V = newV;
          }
        }
        V = newV;
@@ -438,8 +457,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
           (anACurve->GetType() == GeomAbs_Ellipse)) {
          newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
          
           (anACurve->GetType() == GeomAbs_Ellipse)) {
          newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup);
          
-         if(newV < myvinf)
-           newV = myvinf;
+          if(newV < myvinf) {
+            newV += 2. * M_PI;
+            if (newV - mytolv > myvsup) {
+              newV = myvinf;
+            } else if (newV > myvsup) {
+              newV = myvsup;
+            }
+          }
        }
        V = newV;
 
        }
        V = newV;
 
diff --git a/tests/bugs/moddata/bug23733 b/tests/bugs/moddata/bug23733
new file mode 100755 (executable)
index 0000000..e80fd46
--- /dev/null
@@ -0,0 +1,40 @@
+puts "================"
+puts "CR23733"
+puts "================"
+puts ""
+###############################################
+## PCurve for edge on face creation failure
+###############################################
+
+pload DCAF TOPTEST
+
+Open [locate_data_file bug_glue_edges_GEOM.sgd] D
+
+GetShape D 0:1:9686:1:1:2 s1
+GetShape D 0:1:9449:1:1:2 s2
+explode s1 e
+explode s2 f
+
+#should create pcurve
+bhaspc s1_100 s2_2 do
+#should report OK
+set info1 [bhaspc s1_100 s2_2]
+if { [regexp {No} ${info1}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}
+
+#should create pcurve
+bhaspc s1_40 s2_54 do
+#should report OK
+set info2 [bhaspc s1_40 s2_54]
+if { [regexp {No} ${info2}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}
+
+#should create pcurve
+bhaspc s1_22 s2_123 do
+#should report OK
+set info3 [bhaspc s1_22 s2_123]
+if { [regexp {No} ${info3}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}