Now, the algorithm tries to estimate U- and V-ranges of future intersection curve(s) on the surface. This information is used in stop-criterium of the algorithm instead of full surface range used earlier. It allows reducing dependencies of intersection result on the surface ranges.
Tuning of test case bugs/modalg_6/bug27937_1
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <IntWalk_StatusDeflection.hxx>
+#include <Bnd_Range.hxx>
class StdFail_NotDone;
class Standard_OutOfRange;
class IntSurf_PathPoint;
IntWalk_VectorOfWalkingData wd1;
IntWalk_VectorOfWalkingData wd2;
IntWalk_VectorOfInteger nbMultiplicities;
+ Bnd_Range mySRangeU; // Estimated U-range for section curve
+ Bnd_Range mySRangeV; // Estimated V-range for section curve
Standard_Real Um;
Standard_Real UM;
Standard_Real Vm;
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <IntWalk_StatusDeflection.hxx>
+#include <Bnd_Range.hxx>
class StdFail_NotDone;
class Standard_OutOfRange;
class IntSurf_PathPoint;
IntWalk_VectorOfWalkingData wd1;
IntWalk_VectorOfWalkingData wd2;
IntWalk_VectorOfInteger nbMultiplicities;
+ Bnd_Range mySRangeU; // Estimated U-range for section curve
+ Bnd_Range mySRangeV; // Estimated V-range for section curve
Standard_Real Um;
Standard_Real UM;
Standard_Real Vm;
}
ThePointOfPathTool::Value2d(PathPnt, aWD1.ustart, aWD1.vstart);
+ mySRangeU.Add(aWD1.ustart);
+ mySRangeV.Add(aWD1.vstart);
+
wd1.push_back (aWD1);
Standard_Integer aNbMult = ThePointOfPathTool::Multiplicity(PathPnt);
nbMultiplicities.push_back(aNbMult);
aWD2.etat = 1;
const IntSurf_InteriorPoint& anIP = Pnts2.Value(I);
ThePointOfLoopTool::Value2d(anIP, aWD2.ustart, aWD2.vstart);
+ mySRangeU.Add(aWD2.ustart);
+ mySRangeV.Add(aWD2.vstart);
+
if (!IsTangentExtCheck(Func, aWD2.ustart, aWD2.vstart, aStepU, aStepV, Um, UM, Vm, VM))
aWD2.etat = 13;
Func.Set(Caro);
+ if (mySRangeU.Delta() > Max(tolerance(1), Precision::PConfusion()))
+ {
+ mySRangeU.Enlarge(mySRangeU.Delta());
+ mySRangeU.Common(Bnd_Range(Um, UM));
+ }
+ else
+ {
+ mySRangeU = Bnd_Range(Um, UM);
+ }
+
+ if (mySRangeV.Delta() > Max(tolerance(2), Precision::PConfusion()))
+ {
+ mySRangeV.Enlarge(mySRangeV.Delta());
+ mySRangeV.Common(Bnd_Range(Vm, VM));
+ }
+ else
+ {
+ mySRangeV = Bnd_Range(Vm, VM);
+ }
+
// calculation of all open lines
if (nbPnts1 != 0)
ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
//-- IntWalk_IWalking_2.gxx
+#include <Bnd_Range.hxx>
#include <TColStd_MapOfInteger.hxx>
#ifndef OCCT_DEBUG
Standard_Real UV2=UV(2);
- //-- Put everything in one box 0 1 x 0 1
- //-- actually it is necessary to carry out tests in 3D
-
- Standard_Real deltau=UM-Um;
- Standard_Real deltav=VM-Vm;
+ //Normalizing factor. If it is less than 1.0 then the range will be expanded.
+ //This is no good for computation. Therefore, it is limited.
+ const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um : Max(mySRangeU.Delta(), 1.0);
+ const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm : Max(mySRangeV.Delta(), 1.0);
Up/=deltau; UV1/=deltau;
Vp/=deltav; UV2/=deltav;
--- /dev/null
+puts "================"
+puts "OCC27937"
+puts "================"
+puts ""
+#######################################################################
+# 0027937: Intersector loops infinitely while proceeding two simple surfaces
+#######################################################################
+
+cpulimit 100
+
+# Attention!!!
+# The test on performance meter.
+# See issue #27937 for detail.
+set GoodNbCurv 4
+
+restore [locate_data_file bug27937_int1.draw] s1
+restore [locate_data_file bug27937_int2.draw] s2
+
+intersect result s1 s2
+
+set che [whatis result]
+set ind [string first "3d curve" $che]
+if {${ind} >= 0} {
+ #Only variable "result" exists
+ renamevar result result_1
+}
+
+set ic 1
+set AllowRepeate 1
+while { $AllowRepeate != 0 } {
+ set che [whatis result_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeate 0
+ } else {
+ display result_$ic
+
+ bounds result_$ic U1 U2
+
+ dump U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs result_$ic s1 U1 U2 10 3.0e-5
+ xdistcs result_$ic s2 U1 U2 10 1.0e-5
+
+ for { set ip [expr $ic-1] } { $ip > 0 } { incr ip -1 } {
+ mkedge e1 result_$ic
+ mkedge e2 result_$ip
+
+ set coe [checkoverlapedges e1 e2 5.0e-5]
+
+ puts "result_$ic <-> result_$ip: $coe"
+ if { [regexp "Edges is not overlaped" $coe] != 1 } {
+ puts "Error: result_$ic and result_$ip are overlaped"
+ }
+ }
+
+ incr ic
+ }
+}
+
+if {[expr {$ic - 1}] == $GoodNbCurv} {
+ puts "OK: Number of curves is good!"
+} else {
+ puts "Error: $GoodNbCurv is expected but [expr {$ic - 1}] is found!"
+}
+
+smallview
+don result*
+fit
+clear
+don s1 s2 result*
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "================"
+puts "OCC27937"
+puts "================"
+puts ""
+#######################################################################
+# 0027937: Intersector loops infinitely while proceeding two simple surfaces
+#######################################################################
+
+cpulimit 100
+
+# Attention!!!
+# The test on performance meter.
+# See issue #27937 for detail.
+set GoodNbCurv 4
+
+ellipse c1 0 0 0 0 0 1 6.03031367203927 3.11993062568844
+extsurf s1 c1 0 0 1
+cylinder s2 0 0 0 1 0 0 0.249128788767645
+
+intersect result s1 s2
+
+set che [whatis result]
+set ind [string first "3d curve" $che]
+if {${ind} >= 0} {
+ #Only variable "result" exists
+ renamevar result result_1
+}
+
+set ic 1
+set AllowRepeate 1
+while { $AllowRepeate != 0 } {
+ set che [whatis result_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeate 0
+ } else {
+ display result_$ic
+
+ bounds result_$ic U1 U2
+
+ dump U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs result_$ic s1 U1 U2 10 4.0e-5
+ xdistcs result_$ic s2 U1 U2 10 1.0e-5
+
+ for { set ip [expr $ic-1] } { $ip > 0 } { incr ip -1 } {
+ mkedge e1 result_$ic
+ mkedge e2 result_$ip
+
+ set coe [checkoverlapedges e1 e2 5.0e-5]
+
+ puts "result_$ic <-> result_$ip: $coe"
+ if { [regexp "Edges is not overlaped" $coe] != 1 } {
+ puts "Error: result_$ic and result_$ip are overlaped"
+ }
+ }
+
+ incr ic
+ }
+}
+
+if {[expr {$ic - 1}] == $GoodNbCurv} {
+ puts "OK: Number of curves is good!"
+} else {
+ puts "Error: $GoodNbCurv is expected but [expr {$ic - 1}] is found!"
+}
+
+smallview
+don result*
+fit
+clear
+don s1 s2 result*
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file