1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Fix for regressions for case infinite box ( case 46)

Test cases
This commit is contained in:
gka
2014-10-30 19:03:55 +03:00
committed by nbv
parent 097a0cae0f
commit fe7caef6da
7 changed files with 638 additions and 354 deletions

View File

@@ -74,6 +74,7 @@ is
class CheckerSI;
class ArgumentAnalyzer;
class CheckResult;
class ShellSplitter;
--
-- pointers
--

View File

@@ -57,6 +57,8 @@
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
static
@@ -444,6 +446,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
}
//
// 2. Find outer growth shell that is most close to each hole shell
BOPCol_ListOfShape anUnUsedHoles;
aIt2.Initialize(aHoleWires);
for (; aIt2.More(); aIt2.Next()) {
const TopoDS_Shape& aHole = aIt2.Value();
@@ -481,8 +484,26 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
aMSH.Bind(aF, aLH);
}
}
else {
anUnUsedHoles.Append(aHole);
}
}// for (; aIt2.More(); aIt2.Next())
//
if (anUnUsedHoles.Extent()) {
// add the infinite face to new faces
Bnd_Box aBox;
BRepBndLib::Add(myFace, aBox);
if (aBox.IsOpenXmin() || aBox.IsOpenXmax() ||
aBox.IsOpenYmin() || aBox.IsOpenYmax() ||
aBox.IsOpenZmin() || aBox.IsOpenZmax()) {
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
//
aNewFaces.Append(aFace);
aMSH.Bind(aFace, anUnUsedHoles);
}
}
//
// 3. Add aHoles to Faces
aItMSH.Initialize(aMSH);
for (; aItMSH.More(); aItMSH.Next()) {

File diff suppressed because it is too large Load Diff

View File

@@ -65,8 +65,8 @@ GeomAbs_SurfaceType IntCurvesFace_Intersector::SurfaceType() const
//purpose :
//=======================================================================
IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
const Standard_Real aTol)
:
const Standard_Real aTol)
:
Tol(aTol),
done(Standard_False),
nbpnt(0),
@@ -95,7 +95,7 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
Standard_Boolean bFlag;
//
{
Standard_Real dU, dV, dA, dB, aR, aTresh;
Standard_Real dU, dV, dA, dB, aTresh;
bFlag=Standard_True;
//
aTresh=100.;
@@ -104,18 +104,12 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
dA=dU;
dB=dV;
if (dV>dU) {
dA=dV;
dB=dU;
dA=dV;
dB=dU;
}
//
aR=dA/dB;
if (dB<Precision::PConfusion()) {
bFlag=!bFlag;
}
else {
if (aR>aTresh) {
bFlag=!bFlag;
}
if (dB < Precision::PConfusion() || dA > dB * aTresh) {
bFlag=!bFlag;
}
}
//
@@ -125,7 +119,7 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
if(nbsu>40) nbsu = 40;
if(nbsv>40) nbsv = 40;
PtrOnPolyhedron = (IntCurveSurface_ThePolyhedronOfHInter *)
new IntCurveSurface_ThePolyhedronOfHInter(Hsurface,nbsu,nbsv,U0,V0,U1,V1);
new IntCurveSurface_ThePolyhedronOfHInter(Hsurface,nbsu,nbsv,U0,V0,U1,V1);
}
//
/*

View File

@@ -0,0 +1,124 @@
puts "================"
puts "OCC25416"
puts "================"
puts ""
#######################################################################
# Face/Face intersection algorithm gives different results for different order of the arguments
#######################################################################
# Check if list of xdistcs-command is valid
proc checkList {List Tolerance D_good Limit_Tol} {
set L1 [llength ${List}]
set L2 10
set L3 5
set N [expr (${L1} - ${L2})/${L3} + 1]
for {set i 1} {${i} <= ${N}} {incr i} {
set j1 [expr ${L2} + (${i}-1)*${L3}]
set j2 [expr ${j1} + 2]
set T [lindex ${List} ${j1}]
set D [lindex ${List} ${j2}]
#puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
puts "Error: T=${T} D=${D}"
}
if { ${Tolerance} > ${Limit_Tol} } {
if { [expr abs(${D} - ${D_good})] > ${Limit_Tol}
&& [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
puts "Attention (critical value of tolerance) : T=${T} D=${D}"
}
}
}
}
puts "##############################"
puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
puts "##############################"
puts ""
puts ""
# bopcurves command
restore [locate_data_file bug25416_f1.brep] f1
restore [locate_data_file bug25416_f2.brep] f2
#############################
set log [bopcurves f1 f2 -2d]
#############################
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set MaxTol 1.e-7
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set GoodNbCurv 1
if {${Toler} > ${MaxTol}} {
puts "Error: Tolerance is too big!"
}
if {${NbCurv} != ${GoodNbCurv}} {
puts "Error: Curve Number is bad!"
}
#-------------
mksurface s1 f1
mksurface s2 f2
erase s1 s2
for {set i 1} {$i <= ${NbCurv}} {incr i} {
set log [dump c_$i]
set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
if {${dumptrimres} == 0} {
regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
puts "Degree=${Degree}"
puts "Poles=${Poles}"
puts "KnotsPoles=${KnotsPoles}"
puts ""
set Knot 1
set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U1 Mult1
set Knot ${KnotsPoles}
set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U2 Mult2
}
puts "U1=${U1}"
puts "U2=${U2}"
if {[expr {$U2 - $U1}] < 1.0e-20} {
puts "Error: Wrong curve's range!"
}
dlog reset
dlog on
xdistcs c_$i s1 ${U1} ${U2} 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
dlog reset
dlog on
xdistcs c_$i s2 ${U1} ${U2} 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
}
smallview
fit
set only_screen_axo 1

View File

@@ -0,0 +1,20 @@
puts "==========="
puts "OCC25697"
puts "==========="
puts ""
##########################################################################################
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
##########################################################################################
restore [locate_data_file bug25697_shell_for_seam.brep] s1
restore [locate_data_file bug25697_prism.brep] p1
bsection result s1 p1 -n2d2
regexp {nb alone Vertices : +([-0-9.+eE]+)} [checksection result] full nb_alone_Vertices
if { ${nb_alone_Vertices} == 2 } {
puts "OK: Good result done by Boolean Operation algorithm"
} else {
puts "Error: Wrong result done by Boolean Operation algorithm"
}
set length 107.503

View File

@@ -0,0 +1,63 @@
puts "=========="
puts "OCC25697"
puts "=========="
puts ""
########################################################################################
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
########################################################################################
restore [locate_data_file bug25697_shell_for_seam.brep] b1
restore [locate_data_file bug25697_prism.brep] b2
explode b1 f
copy b1_1 b1
explode b2 f
copy b2_1 b2
#################################
set log [bopcurves b1 b2 -2d1]
#################################
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
set MaxTol 1.e-7
set GoodNbCurv 3
if { ${Toler} > ${MaxTol} } {
puts "Error: Tolerance is too big!"
}
if { ${NbCurv} != ${GoodNbCurv} } {
puts "Error: Curve Number is bad!"
}
#---------------
mksurface s1 b1
mksurface s2 b2
for {set i 1} {$i <= ${NbCurv}} {incr i} {
bounds c_$i u1 u2
dump u1 u2
dlog reset
dlog on
xdistcs c_$i s1 u1 u2 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
dlog reset
dlog on
xdistcs c_$i s2 u1 u2 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
}
smallview
fit
set only_screen_axo 1