MantisBT - Community
View Issue Details
0023105Community[OCCT] OCCT:Meshpublic2012-04-12 18:262014-05-15 16:15
WindowsVC++ 201032 bit
[OCCT] 6.5.2 
[OCCT] 6.7.0[OCCT] 6.7.0 
bugs mesh bug23105
0023105: Exception during Meshing / Missing triangles
when I import the attached step file and try to mesh it, I receive an exception in one of the faces.

The exception occurs in the methode
BRepMesh_DataStructureOfDelaun::AddElement(const BRepMesh_Triangle& theElement)
in the line

The exception is caught in BRepMesh_FastDiscretFace::Add, but as a result of the exception, the triangulation is not created.

If I use a try-catch-block to handle the exceptiondirectly in BRepMesh_DataStructureOfDelaun::AddElement, some triangles are missing in the triangulation
Here is some sample-Code to reproduce this error:

Handle(TDocStd_Document) hDoc;
XCAFApp_Application::GetApplication()->NewDocument("MDTV_XCAF", hDoc);
STEPCAFControl_Reader reader;

for (TDF_ChildIterator it(XCAFDoc_DocumentTool::ShapesLabel(hDoc->Main())); it.More() && !progress.canceled(); it.Next())
if (XCAFDoc_ShapeTool::IsSimpleShape(it.Value()))
TopoDS_Shape shapeCurrent;
XCAFDoc_ShapeTool::GetShape(it.Value(), shapeCurrent);

TopExp_Explorer expFace;
expFace.Init(shapeCurrent, TopAbs_FACE);
int nMin(371), nMax(371); //The exception occurs in face 371
for (Standard_Integer numFace = 0; expFace.More(); expFace.Next(), ++numFace)
if (numFace < nMin || numFace > nMax)
TopoDS_Face myFace = TopoDS::Face(expFace.Current());
Handle(Poly_Triangulation) myT = BRep_Tool::Triangulation(myFace, myLocation);
if (myT.IsNull())
BRepMesh_IncrementalMesh Mesh(myFace, 0.7, Standard_False, 0.75);
myT = BRep_Tool::Triangulation(myFace, myLocation);

// Draw reproducer from the post - [^]
Draw[25]> pload ALL
Draw[26]> smallview
Draw[27]> stepread 3359.500_Klima_high.stp s *
# ...
#Transfer entity n0 34 OK -> DRAW Shape: s_1
#Now, 1 Shapes produced
Draw[28]> explo s_1 F
Draw[29]> don s_1_372 ## <== the expected face
Draw[30]> checkshape s_1_372
# This shape seems to be valid
Draw[31]> fit
Draw[32]> incmesh s_1_372 0.1
#Meshing statuses: NoError
Draw[33]> trinfo s_1_372

#This shape contains 0 triangles.
# 0 nodes.
#Maximal deflection 0

The exception (OutOfRange) is catched by Draw.
No tags attached.
parent of 0024084assigned oan Open CASCADE Additional tool for resolving 2d loops on discretized wires should be implemented in BRepMesh 
related to 0023581feedback abv Community [Regression] Performance of BRepMesh 6.5.4 can be up to Nx worse than 6.3.1 
related to 0024923closed bugmaster Community BRepMesh_CircleTool produces bad circles 
Not all the children of this issue are yet resolved or closed.
? 3359.500_Klima_high.stp (1,778,720) 2012-04-12 18:26
? bug23105_f372.brep (338,531) 2012-05-31 09:14
Issue History
2012-04-12 18:26goeranbarzNew Issue
2012-04-12 18:26goeranbarzAssigned To => jgv
2012-04-12 18:26goeranbarzFile Added: 3359.500_Klima_high.stp
2012-04-12 19:00szySteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3818#r3818
2012-05-31 09:14abvFile Added: bug23105_f372.brep
2012-05-31 09:19abvNote Added: 0020614
2012-05-31 09:19abvAssigned Tojgv => oan
2012-05-31 09:19abvStatusnew => assigned
2012-11-09 09:54abvCategoryOCCT:Modeling Algorithms => OCCT:Mesh
2013-03-01 10:15oanNote Added: 0023542
2013-03-01 10:15oanAssigned Tooan => pdn
2013-03-01 10:16oanStatusassigned => resolved
2013-03-01 15:39abvTarget Version => 6.6.0
2013-03-04 09:02pdnAssigned Topdn => bugmaster
2013-03-04 09:02pdnStatusresolved => reviewed
2013-03-04 14:36oanNote Added: 0023575
2013-03-04 18:43mkvAssigned Tobugmaster => mkv
2013-03-06 12:12mkvNote Added: 0023602
2013-03-06 12:16mkvAssigned Tomkv => oan
2013-03-06 12:16mkvStatusreviewed => assigned
2013-03-06 12:56oanNote Added: 0023603
2013-03-06 12:56oanAssigned Tooan => mkv
2013-03-06 12:56oanStatusassigned => resolved
2013-03-06 12:56oanStatusresolved => reviewed
2013-03-07 15:40oanRelationship addedrelated to 0023111
2013-03-07 15:43oanRelationship addedrelated to 0023614
2013-03-07 15:44oanRelationship addedrelated to 0023581
2013-03-07 15:51oanRelationship addedrelated to 0022641
2013-03-11 16:36mkvNote Added: 0023643
2013-03-11 16:36mkvTest case number => bugs mesh bug23105
2013-03-11 16:36mkvAssigned Tomkv => oan
2013-03-11 16:36mkvStatusreviewed => assigned
2013-03-29 11:36oanRelationship deletedrelated to 0023111
2013-04-12 10:07abvTarget Version6.6.0 => 6.7.0
2013-06-20 14:05oanNote Added: 0024815
2013-06-20 14:05oanAssigned Tooan => pdn
2013-06-20 14:05oanStatusassigned => resolved
2013-06-21 10:53pdnNote Added: 0024830
2013-06-21 10:53pdnStatusresolved => reviewed
2013-06-21 11:09oanAssigned Topdn => bugmaster
2013-06-21 16:22apnNote Added: 0024834
2013-06-21 16:23apnAssigned Tobugmaster => oan
2013-06-21 16:23apnStatusreviewed => assigned
2013-06-24 15:24oanNote Added: 0024842
2013-06-24 15:24oanAssigned Tooan => pdn
2013-06-24 15:24oanStatusassigned => feedback
2013-07-17 09:50pdnNote Added: 0025092
2013-07-17 09:50pdnStatusfeedback => resolved
2013-07-23 12:24oanRelationship addedparent of 0024084
2013-07-23 12:30oanNote Added: 0025134
2013-07-23 12:32oanNote Edited: 0025134bug_revision_view_page.php?bugnote_id=25134#r5654
2013-07-23 12:33oanStatusresolved => reviewed
2013-07-23 12:34oanAssigned Topdn => bugmaster
2013-07-23 13:13bugmasterAssigned Tobugmaster => apn
2013-07-23 13:13bugmasterStatusreviewed => assigned
2013-07-23 13:13apnStatusassigned => reviewed
2013-07-24 13:48apnNote Added: 0025145
2013-07-24 13:48apnAssigned Toapn => bugmaster
2013-07-24 13:48apnStatusreviewed => tested
2013-07-26 12:33oanChangeset attached => occt master 304c45c8
2013-07-26 12:33oanAssigned Tobugmaster => oan
2013-07-26 12:33oanStatustested => verified
2013-07-26 12:33oanResolutionopen => fixed
2013-08-26 13:32drazmyslovichNote Added: 0025380
2013-08-26 14:00drazmyslovichNote Deleted: 0025380
2013-12-19 13:52bugmasterStatusverified => closed
2013-12-19 13:57bugmasterFixed in Version => 6.7.0
2014-05-15 16:15abvRelationship addedrelated to 0024923

2012-05-31 09:19   
The attached file bug23105_f372.brep contains face 372 extracted from the original STEP file. Note that apart of the bug in triangulation, DRAW command incmesh also has a problem: it should report the error!
2013-03-01 10:15   
Dear pdn,
Could you please review the fix placed at CR23105_2 branch?
2013-03-04 14:36   
Dear Bugmaster,
Please test.
2013-03-06 12:12   
Dear BugMaster,

Branch CR23105_2 (and products from GIT master) was compiled on Linux and Windows platforms.
SHA-1: 0289fb03884ab8944d32213efb2c871afb04b020

There is compilation error on Linux: [^]
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../.. -I/dn48/PRODUCTS/salome/6.x/opt/MANDRIVA.2010/6.6.0/tbb30_018oss/include -DHAVE_TBB -I../../../inc -I../../../drv/BRepMesh -I../../../src/BRepMesh -I../../../drv/IntPoly -I../../../src/IntPoly -I/dn48/PRODUCTS/salome/6.x/opt/MANDRIVA.2010/6.6.0/jdk1.6.0/include -I/dn48/PRODUCTS/salome/6.x/opt/MANDRIVA.2010/6.6.0/jdk1.6.0/include/linux -DNDEBUG -DNo_Exception -DCSFDB -DOCC_CONVERT_SIGNALS -DLIN -DLININTEL -D_GNU_SOURCE=1 -O2 -MT BRepMesh_ElemHasherOfDataStructureOfDelaun_0.lo -MD -MP -MF .deps/BRepMesh_ElemHasherOfDataStructureOfDelaun_0.Tpo -c ../../../drv/BRepMesh/BRepMesh_ElemHasherOfDataStructureOfDelaun_0.cxx -fPIC -DPIC -o .libs/BRepMesh_ElemHasherOfDataStructureOfDelaun_0.o
In file included from ../../../inc/BRepMesh_ElemHasherOfDataStructureOfDelaun.hxx:20,
                 from ../../../drv/BRepMesh/BRepMesh_ElemHasherOfDataStructureOfDelaun_0.cxx:6:
../../../inc/BRepMesh_Triangle.hxx:61: error: extra qualification 'BRepMesh_Triangle::' on member 'Movability'
make[2]: *** [BRepMesh_ElemHasherOfDataStructureOfDelaun_0.lo] Error 1
2013-03-06 12:56   
Dear MKV,
mistake in file BRepMesh_Triangle.hxx has been corrected.

Please find updated version of fix at CR23105_3 branch and run the test campaign again.
2013-03-11 16:36   
Dear BugMaster,

Branch CR23105_3 (and products from GIT master) was compiled on Linux and Windows platforms.
SHA-1: 07d155c2f9ec0220e07a2308ed9e051e5e19ccb3

Number of compiler warnings:

occt component :
Linux: 2 (3 on master)
Windows: 12(12 on master)

products component :
Linux: 10 (10 on master)
Windows: 50 (50 on master)

http://occt-tests/CR23105-3-master-occt/Windows-32-VC9/summary.html [^]
bugs modalg_2(007) bug397 - Shading is missing in 3D Viewer
mesh standard_incmesh(002) U7 - Free links; Free nodes
mesh standard_incmesh_parallel(007) U7 - Free links; Free nodes
mesh standard_mesh(003) U7- Free links; Free nodes
mesh standard_shading U2(001) - New value of area
mesh standard_shading U7(001) - Faces without triangulation; Free links; Free nodes
mesh standard_shading W4(001) - Free nodes

http://occt-tests/CR23105-3-master-occt/Mandriva2010/summary.html [^]
bugs modalg_2(007) bug397 - Shading is missing in 3D Viewer
mesh advanced_incmesh(005) B6 - Free nodes
mesh advanced_incmesh_parallel(008) B6 - Free nodes
mesh advanced_mesh(006) B6 - Free nodes
mesh advanced_shading(004) B6 - Free nodes
mesh standard_incmesh(002) U7 - Faces without triangulation; Free links; Free nodes
mesh standard_incmesh_parallel(007) U7 - Faces without triangulation; Free links; Free nodes
mesh standard_mesh(003) U7 - Faces without triangulation; Free links; Free nodes
mesh standard_shading(001) U2 - New value of area
mesh standard_shading U7(001) - Faces without triangulation; Free links; Free nodes
mesh standard_shading W4(001) - Free nodes

No improvements

Testing cases:
bugs mesh bug23105 - OK.

Testing on Linux:
Total MEMORY difference: 233840920 / 233986292
Total CPU difference: 13772.859999999842 / 17375.690000000395

Testing on Windows:
Total MEMORY difference: 343119980 / 343290400
Total CPU difference: 18517.0 / 16966.21875

There are following serious differences in images found by testdiff:
http://occt-tests/CR23105-3-master-occt/Mandriva2010/diff-Mandriva2010.html [^]
http://occt-tests/CR23105-3-master-occt/Windows-32-VC9/diff-Windows-32-VC9.html [^]
IMAGE bugs modalg_2 bug23004: bug23004.png differs
IMAGE bugs modalg_2 bug23: bug23004.png differs
IMAGE bugs modalg_2 bug22641: bug22641.png differs - Improvement
IMAGE bugs modalg_4 bug8370: bug8370.png differs
2013-06-20 14:05   
Dear Pavel,

new functionality for resolving intersections on frontier edges for polygons has been implemented.

Please review the fix at GIT branch CR23105_4.
2013-06-21 10:53   
OK. Please test
2013-06-21 16:22   
Dear BugMaster,

Branch CR23105_4(and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 79cb4165c87349be35df7aaceba495cc887afd2a

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (7 on master)

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

OCCT Linux:
mesh standard_incmesh C7 C9 U2 U4 U7 V4 W9
mesh standard_incmesh_parallel C7 C9 U2 U4 U7 V4 W9
mesh standard_mesh C7 C9 U2 U4 U7 V4 W4 W9
mesh standard_shading C9 U2 V4 W9
http://occt-tests/CR23105-4-master-occt/Debian60-64/summary.html [^]

OCCT Windows:
mesh standard_incmesh C7 C9 U2 U4 U7 V4 W9
mesh standard_incmesh_parallel C7 C9 U2 U4 U7 V4 W9
mesh standard_mesh C7 C9 U2 U4 U7 V4 W4 W9
mesh standard_shading C9 U2 V4 W9
http://occt-tests/CR23105-4-master-occt/Windows-32-VC9/summary.html [^]

omf advanced_meshcommon A8 A9 G3 H0 J0
omf advanced_meshcut E1 E3 F3 O2 T9 U7 U9 W0 Y2 Z6
omf advanced_meshfuse D1 D3 E1 I0 L3 M2 M8 M9 O0 S9 Y2 Y3 Y7
omf advanced_meshtuc B1 B3 C3
omf standard_meshcommon K8 M2 Q0 ZN8
omf standard_meshcut J1 ZB5 ZD4 ZJ9 ZK7 ZM0 ZY5 ZY7 ZY9
omf standard_meshfuse K8 M2 Q0 ZL7
omf standard_meshtuc ZH9 ZK1

omf advanced_meshcommon A8 A9 G3
omf advanced_meshcut E1 O2 U7 U9 W0
omf advanced_meshfuse D3 I0 K6 L3 M8 M9 N2 O0 S9 X7 Y2 Y3 Y7 ZB2
omf advanced_meshtuc B1
omf standard_meshcommon Q0 ZN8
omf standard_meshcut J1 ZJ9 ZK7 ZM0 ZY7 ZZ1
omf standard_meshfuse Q0 ZL7
omf standard_meshtuc ZH9 ZK1

OCCT Linux and Windows:
mesh standard_incmesh Q6 U5
mesh standard_incmesh_parallel Q6 U5
mesh standard_mesh Q6 U5
mesh standard_shading U7

omf advanced_meshcut I9 T1 X6 X8 Y8 ZA3 ZA4 ZA5
omf advanced_meshfuse E4 K2 K6 N2 R4 ZH7
omf advanced_meshtuc F2
omf standard_meshcommon C9 O9 ZM1 ZM8
omf standard_meshcut F7 G1 N7 ZI2 ZK6
omf standard_meshfuse C9 O9 V9 ZF4 ZK7
omf standard_meshtuc L3 L8 ZC2 ZG3 ZI6
omf advanced_meshcommon J3

omf advanced_meshcommon H0 J0 J3
omf advanced_meshcut E3 F3 H9 I9 J8 L7 Q4 T1 X6 Y8 ZA3 ZA4 ZA5
omf advanced_meshfuse D1 E1 E4 K2 R4 ZH6 ZH7
omf advanced_meshtuc B3 C3 F2
omf standard_meshcommon C9 O1 O9 ZH2 ZM1 ZM8
omf standard_meshcut G1 N7 V3 V9 ZG9 ZI2 ZK6 ZY5 ZY9
omf standard_meshfuse C9 O1 O9 ZI1 ZK7
omf standard_meshtuc L8 ZC2 ZE9 ZG3 ZI6

Testing cases:
bugs mesh bug23105 - OK
2013-06-24 15:24   
Dear Bugmaster,

I think that OMF tests should be treated as unstable, because they are tightly-coupled with results produced by the BRepMesh. This means that even small change of trianglulation might bring sufficient changes into results of OMF operations. So, I propose to make amendments for these cases the more that shapes from tests are processed by BRepMesh without any problems and trianglulation is quite OK.

As for regressions in standard OCC tests:
1) regression indicators of tests C7, C9, U2, V4, W4, W9 are free nodes and free links.
Current architecture of BRepMesh doesn't contain wire corrector tool that allows resolving 2d loops on wires (statically existing in wire or introduced during discretization) for particular face with synchronization in 3d and neighboring faces. This fix provides functionality for resolving loops and touching cases on polygon level when face meshing is performed. In detail, it doesn't split existing mesh links by adding new points, it just tries to resolve problems by replacing set of problem frontier links by a single one or to divide the source polygon onto more simpliest ones. As a result problem links may be excluded from resulting mesh and replacing ones will form free links as far they don't reflect real boundary of face. From the other side, we mustn't remove discretization points that are not involved in resulting mesh for avoiding free nodes on particular face, because these points might be included into triangulation of neighboring face. Moreover, most of faces on which free nodes or free links are detected are not well-defined.

2) U7 - not a regression. Moreover, it could be considered as improvement, because number of faces without triangulation decreased (14 comparing to 15 in TODOs).

3) U4 - face without triangilation consists of two same-oriented coinciding edges - correct triangulation can't be build by definition.

I propose to integrate the fix and make corresponding corrections of OMF (upadte tolerance of operations, make TODOs, etc.) and OCC tests.

Dear Pavel, what do you think about it?
2013-07-17 09:50   
I think the fix can be considered as ready. It is necessary to create dedicated BUG for 2d loops resolving.
2013-07-23 12:30   
(edited on: 2013-07-23 12:32)
Dear Pavel,
Bug 0024084 has been registered for wire correction functionality.

Dear Bugmaster,
please manage the fix and dependent bugs taking into account the remarks made in previous posts.

2013-07-24 13:48   
Test cases in group mesh were modified.
Products branch CR23105_4 was created. It contains changes in OMF group.