View Issue Details

IDProjectCategoryView StatusLast Update
0023105CommunityOCCT:Meshpublic2014-05-15 16:15
Reportergoeranbarz Assigned Tooan  
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2010 
Product Version6.5.2 
Target Version6.7.0Fixed in Version6.7.0 
Summary0023105: Exception during Meshing / Missing triangles
Descriptionwhen 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
Steps To ReproduceHere 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.
TagsNo tags attached.
Test case numberbugs mesh bug23105

Attached Files

  • 3359.500_Klima_high.stp (1,778,720 bytes)
  • bug23105_f372.brep (338,531 bytes)


parent of 0024084 assignedoan Open CASCADE Additional tool for resolving 2d loops on discretized wires should be implemented in BRepMesh 
related to 0023581 feedbackabv Community [Regression] Performance of BRepMesh 6.5.4 can be up to Nx worse than 6.3.1 
related to 0024923 closedbugmaster Community BRepMesh_CircleTool produces bad circles 
Not all the children of this issue are yet resolved or closed.



2012-04-12 18:26


3359.500_Klima_high.stp (1,778,720 bytes)


2012-05-31 09:14


bug23105_f372.brep (338,531 bytes)


2012-05-31 09:19

manager   ~0020614

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

developer   ~0023542

Dear pdn,
Could you please review the fix placed at CR23105_2 branch?


2013-03-04 14:36

developer   ~0023575

Dear Bugmaster,
Please test.


2013-03-06 12:12

tester   ~0023602

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

developer   ~0023603

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

tester   ~0023643

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)

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

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:
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

developer   ~0024815

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

reporter   ~0024830

OK. Please test


2013-06-21 16:22

administrator   ~0024834

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

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

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

developer   ~0024842

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

reporter   ~0025092

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

developer   ~0025134

Last edited: 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

administrator   ~0025145

Test cases in group mesh were modified.
Products branch CR23105_4 was created. It contains changes in OMF group.

Related Changesets

occt: master 304c45c8

2013-07-25 09:11:00


Details Diff
0023105: Exception during Meshing / Missing triangles

Fix compilation error on Linux
Adding test command for this fix
meshPolygon: simplify source polygon by splitting it onto parts without glued edges and loops
Check surrounded triangles during final cleaning of mesh
Correct polygon on frontier edges
Modified test cases in group mesh according to new behavior
Affected Issues
mod - src/BRepMesh/BRepMesh.cdl Diff File
rm - src/BRepMesh/BRepMesh_Delaun.cdl Diff File
mod - src/BRepMesh/BRepMesh_Delaun.cxx Diff File
add - src/BRepMesh/BRepMesh_Delaun.hxx Diff File
rm - src/BRepMesh/BRepMesh_Delaun.lxx Diff File
mod - src/BRepMesh/BRepMesh_FastDiscret.cxx Diff File
mod - src/BRepMesh/BRepMesh_FastDiscretFace.cxx Diff File
mod - src/BRepMesh/BRepMesh_MapOfInteger.hxx Diff File
rm - src/BRepMesh/BRepMesh_Triangle.cdl Diff File
mod - src/BRepMesh/BRepMesh_Triangle.cxx Diff File
add - src/BRepMesh/BRepMesh_Triangle.hxx Diff File
rm - src/BRepMesh/BRepMesh_Triangle.lxx Diff File
mod - src/BRepMesh/FILES Diff File
add - tests/bugs/mesh/bug23105 Diff File
mod - tests/mesh/data/standard/C7 Diff File
mod - tests/mesh/data/standard/C9 Diff File
mod - tests/mesh/data/standard/Q6 Diff File
mod - tests/mesh/data/standard/U2 Diff File
mod - tests/mesh/data/standard/U4 Diff File
mod - tests/mesh/data/standard/U5 Diff File
mod - tests/mesh/data/standard/U7 Diff File
mod - tests/mesh/data/standard/V4 Diff File
mod - tests/mesh/data/standard/W4 Diff File
mod - tests/mesh/data/standard/W9 Diff File

Issue History

Date Modified Username Field Change
2012-04-12 18:26 goeranbarz New Issue
2012-04-12 18:26 goeranbarz Assigned To => jgv
2012-04-12 18:26 goeranbarz File Added: 3359.500_Klima_high.stp
2012-04-12 19:00 szy Steps to Reproduce Updated
2012-05-31 09:14 abv File Added: bug23105_f372.brep
2012-05-31 09:19 abv Note Added: 0020614
2012-05-31 09:19 abv Assigned To jgv => oan
2012-05-31 09:19 abv Status new => assigned
2012-11-09 09:54 abv Category OCCT:Modeling Algorithms => OCCT:Mesh
2013-03-01 10:15 oan Note Added: 0023542
2013-03-01 10:15 oan Assigned To oan => pdn
2013-03-01 10:16 oan Status assigned => resolved
2013-03-01 15:39 abv Target Version => 6.6.0
2013-03-04 09:02 pdn Assigned To pdn => bugmaster
2013-03-04 09:02 pdn Status resolved => reviewed
2013-03-04 14:36 oan Note Added: 0023575
2013-03-04 18:43 mkv Assigned To bugmaster => mkv
2013-03-06 12:12 mkv Note Added: 0023602
2013-03-06 12:16 mkv Assigned To mkv => oan
2013-03-06 12:16 mkv Status reviewed => assigned
2013-03-06 12:56 oan Note Added: 0023603
2013-03-06 12:56 oan Assigned To oan => mkv
2013-03-06 12:56 oan Status assigned => resolved
2013-03-06 12:56 oan Status resolved => reviewed
2013-03-07 15:40 oan Relationship added related to 0023111
2013-03-07 15:44 oan Relationship added related to 0023581
2013-03-11 16:36 mkv Note Added: 0023643
2013-03-11 16:36 mkv Test case number => bugs mesh bug23105
2013-03-11 16:36 mkv Assigned To mkv => oan
2013-03-11 16:36 mkv Status reviewed => assigned
2013-03-29 11:36 oan Relationship deleted related to 0023111
2013-04-12 10:07 abv Target Version 6.6.0 => 6.7.0
2013-06-20 14:05 oan Note Added: 0024815
2013-06-20 14:05 oan Assigned To oan => pdn
2013-06-20 14:05 oan Status assigned => resolved
2013-06-21 10:53 pdn Note Added: 0024830
2013-06-21 10:53 pdn Status resolved => reviewed
2013-06-21 11:09 oan Assigned To pdn => bugmaster
2013-06-21 16:22 apn Note Added: 0024834
2013-06-21 16:23 apn Assigned To bugmaster => oan
2013-06-21 16:23 apn Status reviewed => assigned
2013-06-24 15:24 oan Note Added: 0024842
2013-06-24 15:24 oan Assigned To oan => pdn
2013-06-24 15:24 oan Status assigned => feedback
2013-07-17 09:50 pdn Note Added: 0025092
2013-07-17 09:50 pdn Status feedback => resolved
2013-07-23 12:24 oan Relationship added parent of 0024084
2013-07-23 12:30 oan Note Added: 0025134
2013-07-23 12:32 oan Note Edited: 0025134
2013-07-23 12:33 oan Status resolved => reviewed
2013-07-23 12:34 oan Assigned To pdn => bugmaster
2013-07-23 13:13 bugmaster Assigned To bugmaster => apn
2013-07-23 13:13 bugmaster Status reviewed => assigned
2013-07-23 13:13 apn Status assigned => reviewed
2013-07-24 13:48 apn Note Added: 0025145
2013-07-24 13:48 apn Assigned To apn => bugmaster
2013-07-24 13:48 apn Status reviewed => tested
2013-07-26 12:33 oan Changeset attached => occt master 304c45c8
2013-07-26 12:33 oan Assigned To bugmaster => oan
2013-07-26 12:33 oan Status tested => verified
2013-07-26 12:33 oan Resolution open => fixed
2013-12-19 13:52 bugmaster Status verified => closed
2013-12-19 13:57 bugmaster Fixed in Version => 6.7.0
2014-05-15 16:15 abv Relationship added related to 0024923