]> OCCT Git - occt-copy.git/commitdiff
0030703: Modeling Algorithms - Intersector returns overlapping curves
authorifv <ifv@opencascade.com>
Thu, 5 Nov 2020 12:28:17 +0000 (15:28 +0300)
committerbugmaster <bugmaster@opencascade.com>
Sat, 28 Nov 2020 09:36:05 +0000 (12:36 +0300)
IntPatch/IntPatch_ImpPrmIntersection.cxx - calculation of step depending on resolution of surface

IntWalk_IWalking_6.gxx - calculation of point-line coincidence is improved

Correction of tests according to current results

lowalgos/intss/bug30703 - new test case added

src/IntPatch/IntPatch_ImpPrmIntersection.cxx
src/IntWalk/IntWalk_IWalking_6.gxx
tests/evolved/voluved/HMC001
tests/hlr/exact_hlr/C16
tests/hlr/exact_hlr/C18
tests/hlr/exact_hlr/C5
tests/lowalgos/intss/bug29972_4
tests/lowalgos/intss/bug30703 [new file with mode: 0644]

index 19c84ea841ba83896c93016a235f02aca9f6d4b9..e96e62a73cdb68f97476ed530bff1c9353d7fde1 100644 (file)
@@ -585,6 +585,37 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
     break;
   }
   //
+  Standard_Real aLocalPas = Pas;
+   GeomAbs_SurfaceType aSType = reversed ? Surf1->GetType() : Surf2->GetType();
+
+  if (aSType == GeomAbs_BezierSurface || aSType == GeomAbs_BSplineSurface)
+  {
+    Standard_Real aMinRes = Precision::Infinite();
+    GeomAbs_Shape aCont = GeomAbs_C0;
+    Standard_Integer aMaxDeg = 0;
+    const Standard_Real aLimRes = 1.e-10;
+
+    if (reversed)
+    {
+      aMinRes = Min(Surf1->UResolution(Precision::Confusion()),
+        Surf1->VResolution(Precision::Confusion()));
+      aCont = (GeomAbs_Shape)Min(Surf1->UContinuity(), Surf1->VContinuity());
+      aMaxDeg = Max(Surf1->UDegree(), Surf1->VDegree());
+    }
+    else
+    {
+      aMinRes = Min(Surf2->UResolution(Precision::Confusion()),
+        Surf2->VResolution(Precision::Confusion()));
+      aCont = (GeomAbs_Shape)Min(Surf2->UContinuity(), Surf2->VContinuity());
+      aMaxDeg = Max(Surf2->UDegree(), Surf2->VDegree());
+    }
+
+    if (aMinRes < aLimRes && aCont > GeomAbs_C0 && aMaxDeg > 3)
+    {
+      aLocalPas = Min(Pas, 0.0001);
+    }
+  }
+
   Func.SetImplicitSurface(Quad);
   Func.Set(IntSurf_QuadricTool::Tolerance(Quad));
   AFunc.SetQuadric(Quad);
@@ -686,7 +717,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
   NbPointDep=seqpdep.Length();
   //
   if (NbPointDep || NbPointIns) {
-    IntPatch_TheIWalking iwalk(TolTang, Fleche, Pas);
+    IntPatch_TheIWalking iwalk(TolTang, Fleche, aLocalPas);
     iwalk.Perform(seqpdep, seqpins, Func, reversed ? Surf1 : Surf2, reversed);
 
     if(!iwalk.IsDone()) {
index 259aa9f1943b59cd4ad58c8a717753c74c882a6d..d0ffac0962d552d545b73123084959f1953fc784 100644 (file)
@@ -182,6 +182,7 @@ Standard_Boolean IntWalk_IWalking::IsPointOnLine(const IntSurf_PntOn2S& thePOn2S
                                                  math_FunctionSetRoot& theSolver,
                                                  TheIWFunction& theFunc)
 {
+  const Standard_Real eps = Epsilon(1.);
   const gp_Pnt &aP3d = thePOn2S.Value();
 
   for (Standard_Integer aLIdx = 1; aLIdx <= lines.Length(); aLIdx++)
@@ -212,12 +213,10 @@ Standard_Boolean IntWalk_IWalking::IsPointOnLine(const IntSurf_PntOn2S& thePOn2S
       Standard_Real aSqD = RealLast();
       if (aDP < 0.0)
       {
-        //aSqD = aP1P.SquareModulus();
         continue;
       }
       else if (aDP > aSq12)
       {
-        //aSqD = (aP3d.XYZ() - aP2.XYZ()).SquareModulus();
         continue;
       }
       else
@@ -232,6 +231,11 @@ Standard_Boolean IntWalk_IWalking::IsPointOnLine(const IntSurf_PntOn2S& thePOn2S
         const Standard_Real aL1 = aDP / aSq12;
         const Standard_Real aL2 = 1.0 - aL1;
 
+        if (aL1 < eps || aL2 < eps)
+        {
+          return Standard_True;
+        }
+
         Standard_Real aU1, aV1, aU2, aV2;
         aL->Value(aPtIdx).ParametersOnSurface(reversed, aU1, aV1);
         aL->Value(aPtIdx + 1).ParametersOnSurface(reversed, aU2, aV2);
@@ -241,7 +245,7 @@ Standard_Boolean IntWalk_IWalking::IsPointOnLine(const IntSurf_PntOn2S& thePOn2S
       }
     }
 
-    if (aMinSqDist == RealLast())
+    if (aMinSqDist > Precision::Infinite())
       continue;
 
     math_Vector aVecPrms(1, 2);
@@ -257,7 +261,7 @@ Standard_Boolean IntWalk_IWalking::IsPointOnLine(const IntSurf_PntOn2S& thePOn2S
                  aPb(theFunc.PSurface()->Value(aVecPrms(1), aVecPrms(2)));
     const Standard_Real aSqD1 = aPb.SquareDistance(aP3d);
     const Standard_Real aSqD2 = aPa.SquareDistance(aPb);
-
     if (aSqD1 < 4.0*aSqD2)
     {
       return Standard_True;
index 15b87d72f0749f05e9f72b6139064a73154b0598..f505e62b459faf9becfb9f680b893b140b0671ac 100644 (file)
@@ -18,7 +18,7 @@ if {[regexp "Faulties" [bopargcheck result]]} {
 
 set tolres [checkmaxtol result]
 
-if { ${tolres} > 5.e-6} {
+if { ${tolres} > 1.e-5} {
    puts "Error: bad tolerance of result"
 }
 
index 646a182ae23594e43c3803b72bdd02fdfbe51b6c..cd5a8e3909ac70b3352a8af7d57f4a7b0e3957ce 100644 (file)
@@ -1,5 +1,5 @@
 set viewname "vright"
-set length 1794.57
+set length 1796.06
 
 testreadstep [locate_data_file bug27341_CCS_Adapter_CAD.stp] a
 COMPUTE_HLR $viewname $algotype
index 1c84701c7629ff57480520b31864910d2ed2d665..1b73d4c3a4a06b765acc0b41061eeb4ef8b361fe 100644 (file)
@@ -1,4 +1,5 @@
-puts "TODO OCC30286 Windows: Error : The length of result shape is 2409.86, expected 2418.08"
+puts "TODO OCC30286 Windows: Error : The length of result shape is 2416.66, expected 2418.08"
+puts "TODO OCC30286 Linux: Error : The length of result shape is 2414.48, expected 2418.08"
 
 set viewname "vright"
 set length 2418.08
index 298995c09e740504837a606b5c237ba09723a310..bc4a3aa8d0a264621e311d30c0d96057f7862eab 100644 (file)
@@ -1,5 +1,5 @@
 set viewname "vright"
-set length 1750.87
+set length 1750.92
 
 testreadstep [locate_data_file bug27341_ABS_Adapter_CAD.stp] a
 COMPUTE_HLR $viewname $algotype
index da92bd43a0e8353c5fdf3c46204b7cd705a3712a..4e54d80b5986fbd9d4abb464040cd373376967f0 100644 (file)
@@ -3,6 +3,8 @@ puts "OCC29972: Intersection curve has a weird gap in the middle of it"
 puts "========"
 puts ""
 
+puts "REQUIRED ALL: Error: The curve"
+
 set GoodNbCurves 1
 
 foreach a [directory res*] {unset $a}
@@ -17,9 +19,6 @@ if { [info exists res] } {
   renamevar res res_1
 }
 
-bclearobjects
-bcleartools
-
 set ic 1
 set AllowRepeat 1
 while { $AllowRepeat != 0 } {
@@ -48,7 +47,7 @@ while { $AllowRepeat != 0 } {
       set nv1 [ expr sqrt($nv1) ]
       set nv2 [ expr sqrt($nv2) ]
       
-      set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ] 
+      set dp [ dval dx1*dx2+dy1*dy2+dz1*dz2 ] 
       
       if {$dp < [ expr 0.25881904510252076234889883762405 * $nv1 * $nv2 ] } {
         puts "Error: The curve res_$ic is possible to have a bend at parameter $p. Please check carefully"
diff --git a/tests/lowalgos/intss/bug30703 b/tests/lowalgos/intss/bug30703
new file mode 100644 (file)
index 0000000..65aa7e5
--- /dev/null
@@ -0,0 +1,28 @@
+puts "============"
+puts "0030703: Modeling Algorithms - Intersector returns overlapping curves"
+puts "============"
+puts ""
+
+restore [locate_data_file bug30703s1] s1
+restore [locate_data_file bug30703s2] s2
+
+set info [intersect res s1 s2]
+# Number of solutions check. 
+# There should be only 2 solution.
+if {[llength $info] != 1} {
+  Error: Incorrect number of solutions.
+} 
+
+checklength res -l 22.9782037
+
+donly s2 res
+clpoles s2
+clknots s2
+clpoles res
+clknots res
+
+smallview
+
+fit
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png