1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0031865: Mesh - triangulation fails with large deflection values due to unhandled Standard_OutOfRange, BRepMesh_PairOfIndex::Append()

Define minimum number of points for specific types of curves like it was done for circular edges.
This commit is contained in:
oan 2022-11-21 20:04:09 +03:00 committed by smoskvin
parent 1e96cf65fa
commit 9b7f1aea28
18 changed files with 50 additions and 18 deletions

View File

@ -101,9 +101,21 @@ void BRepMesh_CurveTessellator::init()
myEdgeSqTol = BRep_Tool::Tolerance (myEdge); myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
myEdgeSqTol *= myEdgeSqTol; myEdgeSqTol *= myEdgeSqTol;
const Standard_Integer aMinPntNb = Max(myMinPointsNb, Standard_Integer aMinPntThreshold = 2;
(myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287 switch (myCurve.GetType())
{
case GeomAbs_Circle:
case GeomAbs_Ellipse:
case GeomAbs_Parabola:
case GeomAbs_Hyperbola:
aMinPntThreshold = 4;
break;
default:
break;
}
const Standard_Integer aMinPntNb = Max (myMinPointsNb, aMinPntThreshold); //OCC287
myDiscretTool.Initialize (myCurve, myDiscretTool.Initialize (myCurve,
myCurve.FirstParameter(), myCurve.LastParameter(), myCurve.FirstParameter(), myCurve.LastParameter(),
aPreciseAngDef, aPreciseLinDef, aMinPntNb, aPreciseAngDef, aPreciseLinDef, aMinPntNb,

View File

@ -14,7 +14,7 @@ vdisplay result
vfit vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 3828 -nod 4771 -defl 3.0544822246414993 -tol_abs_defl 1e-6 checktrinfo result -tri 3834 -nod 4777 -defl 3.0544822246414993 -tol_abs_defl 1e-6
set log [tricheck result] set log [tricheck result]
if { [llength $log] != 0 } { if { [llength $log] != 0 } {

View File

@ -15,6 +15,6 @@ vfit
vsetdispmode 1 vsetdispmode 1
XGetOneShape result Q XGetOneShape result Q
checktrinfo result -tri 9025 -nod 6562 checktrinfo result -tri 9097 -nod 6634
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -14,6 +14,6 @@ XGetOneShape result Q
incmesh result 0.00039624 -a 20 -min 0.0001 -parallel incmesh result 0.00039624 -a 20 -min 0.0001 -parallel
checktrinfo result -tri 7661 -nod 5810 checktrinfo result -tri 7733 -nod 5882
checkview -display result -3d -path ${imagedir}/${test_image}.png checkview -display result -3d -path ${imagedir}/${test_image}.png

20
tests/bugs/mesh/bug31865 Normal file
View File

@ -0,0 +1,20 @@
puts "========"
puts "0031865: Mesh - triangulation fails with large deflection values due to unhandled Standard_OutOfRange, BRepMesh_PairOfIndex::Append()"
puts "========"
puts ""
restore [locate_data_file bug31865.brep] result
tclean result
incmesh result 0.2
vinit
vdefaults -autoTriang 0
checkview -display result -3d -path ${imagedir}/${test_image}.png
set log [tricheck result]
if { [llength $log] != 0 } {
puts "Error : Invalid mesh"
} else {
puts "Mesh is OK"
}

View File

@ -15,6 +15,6 @@ vclear
isos result 0 isos result 0
triangles result triangles result
checktrinfo result -tri 18 -nod 20 checktrinfo result -tri 20 -nod 22
checkprops result -s 19.2399 checkprops result -s 19.2399
checkview -display result -3d -path ${imagedir}/${test_image}.png checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@ -15,6 +15,6 @@ vclear
isos result 0 isos result 0
triangles result triangles result
checktrinfo result -tri 91 -nod 93 checktrinfo result -tri 103 -nod 105
checkprops result -s 150.283 checkprops result -s 150.283
checkview -display result -3d -path ${imagedir}/${test_image}.png checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@ -9,7 +9,7 @@ writestl m $imagedir/${casename}
readstl res $imagedir/${casename} readstl res $imagedir/${casename}
file delete $imagedir/${casename} file delete $imagedir/${casename}
checktrinfo res -tri 34 -nod 19 checktrinfo res -tri 36 -nod 20
# Visual check # Visual check
checkview -display res -2d -path ${imagedir}/${test_image}.png checkview -display res -2d -path ${imagedir}/${test_image}.png

View File

@ -4,7 +4,7 @@ puts "====================================="
puts "" puts ""
set viewname "vbottom" set viewname "vbottom"
set length 8.40196 set length 8.40188
restore [locate_data_file bug27341_hlrsave.brep] a restore [locate_data_file bug27341_hlrsave.brep] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 9547.12 set length 9546.37
testreadstep [locate_data_file bug27341_Assembly_ABS_1_CAD.stp] a testreadstep [locate_data_file bug27341_Assembly_ABS_1_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 5101.26 set length 5101.97
testreadstep [locate_data_file bug27341_Assembly_GMS_Kurz_CAD.stp] a testreadstep [locate_data_file bug27341_Assembly_GMS_Kurz_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 1704.86 set length 1705.48
testreadstep [locate_data_file bug27341_Drehkopf_HSK_Gewinde_R_CAD.stp] a testreadstep [locate_data_file bug27341_Drehkopf_HSK_Gewinde_R_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 826.794 set length 829.419
testreadstep [locate_data_file bug27341_KMM_Adapter_CAD.stp] a testreadstep [locate_data_file bug27341_KMM_Adapter_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 217.803 set length 239.091
testreadstep [locate_data_file bug27341_MZX_01_1_CAD.stp] a testreadstep [locate_data_file bug27341_MZX_01_1_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 3057.35 set length 3057.09
testreadstep [locate_data_file bug27341_570-DWLNL-40-08-L_131LANG_16VERSATZ_DIN.stp] a testreadstep [locate_data_file bug27341_570-DWLNL-40-08-L_131LANG_16VERSATZ_DIN.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 2832.09 set length 2832.15
testreadstep [locate_data_file bug27341_ABS_Grundhalter_CAD.stp] a testreadstep [locate_data_file bug27341_ABS_Grundhalter_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 1154.09 set length 1154.43
testreadstep [locate_data_file bug27341_AWN_Adapter_CAD.stp] a testreadstep [locate_data_file bug27341_AWN_Adapter_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -4,7 +4,7 @@ puts "========================================================================"
puts "" puts ""
set viewname "vtop" set viewname "vtop"
set length 13.0106 set length 13.0091
restore [locate_data_file bug27979_parsed.brep] a restore [locate_data_file bug27979_parsed.brep] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype