0023643: Intersection algorithm produces B-Spline curve in case of coaxial cones
authorpkv <pkv@opencascade.com>
Fri, 21 Dec 2012 12:05:58 +0000 (16:05 +0400)
committerpkv <pkv@opencascade.com>
Fri, 21 Dec 2012 12:05:58 +0000 (16:05 +0400)
src/IntPatch/IntPatch_Intersection.cxx
tests/bugs/moddata/bug23643 [new file with mode: 0755]

index a38f125..369d9af 100755 (executable)
@@ -745,10 +745,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          if(ps<0.0) {
            ps=-ps;
          }
-         //modified by NIZNHY-PKV Thu Jul 01 12:14:29 2010f
-         //if(ps<0.1) {
          if(ps<0.015) {
-         //modified by NIZNHY-PKV Thu Jul 01 12:14:35 2010t  
            TreatAsBiParametric = Standard_True;
          }
        }
@@ -769,10 +766,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          if(ps<0.0) {
            ps=-ps;
          }
-         //modified by NIZNHY-PKV Thu Jul 01 12:15:04 2010f
-         //if(ps<0.1){
          if(ps<0.015){
-         //modified by NIZNHY-PKV Thu Jul 01 12:15:08 2010t  
            TreatAsBiParametric = Standard_True;
          }
        }
@@ -793,7 +787,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          }
        }
       }
-      else if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic
+      else if (a1 > 1.55 && a2 > 1.55) { //quasi-planes: if same domain, treat as canonic
        gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
        if (A1.IsParallel(A2,Precision::Angular()))         {
          gp_Pnt Apex1 = Con1.Apex(), Apex2 = Con2.Apex();
@@ -803,11 +797,18 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          }
        }
       }
-    }
-    //////////////////////////////////////////////
-  }
+      else if ((a1 > 1.55 && a2 < 1.55) || (a2 > 1.55 && a1 < 1.55) ) {
+       gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
+       if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion()))  {
+         TreatAsBiParametric = Standard_False;
+       }
+      }
+    }// if (typs1 == GeomAbs_Cone)    {
+  }// if(typs2 == GeomAbs_Cone)  {
   //
-  if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) TreatAsBiParametric= Standard_False;
+  if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) {
+    TreatAsBiParametric= Standard_False;
+  }
 
 //  Modified by skv - Mon Sep 26 14:58:30 2005 Begin
 //   if(TreatAsBiParametric) { typs1 = typs2 = GeomAbs_BezierSurface; }
@@ -1079,10 +1080,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          if(ps<0.0) {
            ps=-ps;
          }
-         //modified by NIZNHY-PKV Thu Jul 01 12:17:56 2010f
-         //if(ps<0.1) {
          if(ps<0.015) {
-         //modified by NIZNHY-PKV Thu Jul 01 12:18:09 2010t  
            TreatAsBiParametric = Standard_True;
          }
        }
@@ -1104,10 +1102,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
          if(ps<0.0){
            ps=-ps;
          }
-         //modified by NIZNHY-PKV Thu Jul 01 12:17:44 2010f
-         //if(ps<0.1){
          if(ps<0.015){
-         //modified by NIZNHY-PKV Thu Jul 01 12:17:48 2010t  
            TreatAsBiParametric = Standard_True;
          }
        }
@@ -1147,12 +1142,22 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)&  S1,
                  TreatAsBiParametric = Standard_False;
          }
        }
+    else if ((a1 > 1.55 && a2 < 1.55) || (a2 > 1.55 && a1 < 1.55) ) {
+      gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
+      if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion()))  {
+       TreatAsBiParametric = Standard_False;
+      }
+    }
   }
   //////////////////////////////////////////////
 
-  if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) TreatAsBiParametric= Standard_False;
-
-  if(TreatAsBiParametric) { typs1 = typs2 = GeomAbs_BezierSurface; }
+  if(D1->DomainIsInfinite() || D2->DomainIsInfinite()) {
+    TreatAsBiParametric= Standard_False;
+  }
+  if(TreatAsBiParametric) { 
+    typs1 = GeomAbs_BezierSurface; 
+    typs2 = GeomAbs_BezierSurface; 
+  }
 
   // Surface type definition
   Standard_Integer ts1 = 0;
diff --git a/tests/bugs/moddata/bug23643 b/tests/bugs/moddata/bug23643
new file mode 100755 (executable)
index 0000000..18d74e4
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========================"
+puts "OCC23643"
+puts "========================"
+puts ""
+#######################################################################
+# Intersection algorithm produces B-Spline curve in case of coaxial cones
+#######################################################################
+
+restore [locate_data_file bug23643_qf3.brep] b
+
+explode b
+copy b_1 f1
+copy b_2 f2
+
+mksurface s1 f1
+mksurface s2 f2
+
+trim s1t s1 0 2*pi -18 10
+trim s2t s2 0 2*pi -18 10
+
+intersect result s1t s2t
+
+set log [dump result]
+
+if {[regexp {Trimmed +curve} ${log}]} {
+  puts "Intersection algorithm work OK"
+} else {
+  puts "Error: Intersection algorithm work bad"
+}