1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
oan
867736c3c5 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.
2022-11-28 20:56:03 +03:00
21 changed files with 55 additions and 97 deletions

View File

@@ -101,9 +101,21 @@ void BRepMesh_CurveTessellator::init()
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
myEdgeSqTol *= myEdgeSqTol;
const Standard_Integer aMinPntNb = Max(myMinPointsNb,
(myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287
Standard_Integer aMinPntThreshold = 2;
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,
myCurve.FirstParameter(), myCurve.LastParameter(),
aPreciseAngDef, aPreciseLinDef, aMinPntNb,

View File

@@ -37,7 +37,9 @@ Draft_FaceInfo::Draft_FaceInfo (const Handle(Geom_Surface)& S,\
const Standard_Boolean HasNewGeometry):
myNewGeom(HasNewGeometry)
{
myGeom = S;
Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
if (!T.IsNull()) myGeom = T->BasisSurface();
else myGeom = S;
}

View File

@@ -481,7 +481,7 @@ Standard_Boolean Draft_Modification::Propagate ()
Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
const Handle(Standard_Type)& typs = S->DynamicType();
if (/*typs == STANDARD_TYPE(Geom_CylindricalSurface) ||*/
if (typs == STANDARD_TYPE(Geom_CylindricalSurface) ||
typs == STANDARD_TYPE(Geom_ConicalSurface)) {
Standard_Real umin,umax,vmin,vmax;
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
@@ -1062,11 +1062,7 @@ void Draft_Modification::Perform ()
//Find the first curve to glue
TColGeom_SequenceOfCurve Candidates;
if (S1->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
{
for (i = 1; i <= i2s.NbLines(); i++)
{

View File

@@ -14,7 +14,7 @@ vdisplay result
vfit
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]
if { [llength $log] != 0 } {

View File

@@ -15,6 +15,6 @@ vfit
vsetdispmode 1
XGetOneShape result Q
checktrinfo result -tri 9025 -nod 6562
checktrinfo result -tri 9097 -nod 6634
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
checktrinfo result -tri 7661 -nod 5810
checktrinfo result -tri 7733 -nod 5882
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
triangles result
checktrinfo result -tri 18 -nod 20
checktrinfo result -tri 20 -nod 22
checkprops result -s 19.2399
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

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

View File

@@ -1,72 +0,0 @@
puts "================"
puts "0032857: Problem when finding the intersection between a new face made after a draft and the inner face of body"
puts "================"
puts ""
# Script reproducing the problematic draft case in FreeCAD issue #2497
#Category: Modeling
#Title: OCCT Tutorial pocketed ring
pload MODELING VISUALIZATION
# Set basic dimensions. Problems appear when inner_rad < pocket_center.
dset height 10
dset inner_rad 39
dset outer_rad 50
dset pocket_center 40
dset pocket_rad 20
dset pocket_depth 5
# Construct base profile (the "my_ring")
puts "Constructing my_ring..."
circle c_inner 0 0 0 0 0 1 inner_rad
circle c_outer 0 0 0 0 0 1 outer_rad
mkedge e_inner c_inner
mkedge e_outer c_outer
wire w_inner e_inner
wire w_outer e_outer
plane p0
mkface my_ring_inner_base p0 w_inner
mkface my_ring_outer_base p0 w_outer
prism my_ring_inner my_ring_inner_base 0 0 height
prism my_ring_outer my_ring_outer_base 0 0 height
bcut my_ring my_ring_outer my_ring_inner
# Make the pocket
puts "Constructing pocket..."
circle pocket_base pocket_center 0 0 0 0 1 pocket_rad
mkedge pocket_base pocket_base
wire pocket_base pocket_base
mkface pocket_base p0 pocket_base
prism my_pocket pocket_base 0 0 pocket_depth
# Make the cut
puts "Making the cut"
bcut slotted_ring my_ring my_pocket
explode slotted_ring F
# Make the draft
puts "Drafting the face"
# Found face by trial and error: slotted_ring_3
# Perform the draft
depouille slotted_ring_with_draft slotted_ring 0 0 -1 slotted_ring_3 44 0 1 0 0 0 1
#checking result
checkshape slotted_ring_with_draft
checknbshapes slotted_ring_with_draft -shape 48 -vertex 12 -edge 18 -face 7 -wire 8
checkprops slotted_ring_with_draft -s 11466.5 -v 28662.9
puts "Showing result..."
# Display result
checkview -display slotted_ring_with_draft -2d -path ${imagedir}/${test_image}.png

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
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
COMPUTE_HLR $viewname $algotype

View File

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

View File

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

View File

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