mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0027930: XMT file conversion loops infinitely
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
This commit is contained in:
parent
d1d68ce714
commit
d07a6c39cf
@ -37,6 +37,7 @@
|
||||
#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;
|
||||
@ -166,6 +167,8 @@ private:
|
||||
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;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#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;
|
||||
@ -166,6 +167,8 @@ private:
|
||||
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;
|
||||
|
@ -183,6 +183,9 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
}
|
||||
|
||||
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);
|
||||
@ -200,6 +203,9 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
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;
|
||||
|
||||
@ -211,6 +217,26 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
|
||||
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);
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
//-- IntWalk_IWalking_2.gxx
|
||||
|
||||
#include <Bnd_Range.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
@ -389,11 +390,10 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
|
||||
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;
|
||||
|
76
tests/bugs/modalg_6/bug27937_1
Normal file
76
tests/bugs/modalg_6/bug27937_1
Normal file
@ -0,0 +1,76 @@
|
||||
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
|
77
tests/bugs/modalg_6/bug27937_2
Normal file
77
tests/bugs/modalg_6/bug27937_2
Normal file
@ -0,0 +1,77 @@
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user