MantisBT - Community
View Issue Details
0024127Community[OCCT] OCCT:Meshpublic2013-08-26 16:012014-11-11 13:01
Vitezslav Zajic 
bugmaster 
normalminor 
closedfixed 
[OCCT] 6.6.0 
[OCCT] 6.8.0[OCCT] 6.8.0 
bugs mesh(016) bug24127
0024127: Mesh generated with BRepMesh_FastDiscret does not reflect a deflection setting
In some cases, edges in triangulation generated by BRepMesh_FastDiscret can have much grater deflection from the curves they should approximate than is specified. This is due to the computation of the deflection in function splitSegment in file BRepMesh_FastDiscret.cxx. This function takes only one(!) sample point in the middle of the source curve and computes its distance from the segment. If this is lesser than the specified deflection, it considers the segment as a good approximation of the curve, even if it otherwise curves quite far from the segment.

One such example is shown in an attachment. When a surface shown in file surface.png is meshed with BRepMesh_FastDiscret, deflection set to 1.0, the generated mesh has only two triangles and very poorly approximates the one non-straight curve, the deflection of the approximating edge from the curve is greater than 2.5 (see surface_with_bad_triangulation.png). When a splitSegment method is alter in an easy way such that it takes several evenly spaced sample points, the generated mesh is OK, as is illustrated in file right_triangulation.png.

For easier reproducibility, I have also attached a simple test application that creates the above mentioned surface and triangulates it and a patch that alters the splitSegment function.

I hope that I'm not missing something, the documentation of meshing algorithms is quite poor (I definitely vote for feature 0024117).
You can compile and run attached wrong_triangulation.cpp to reproduce the bug.

Draw script reproducing the problem:
bsplinesurf s 2 4 0.0 3 0.34 1 0.67 1 1.0 3 1 2 0.0 2 1.0 2 10 0 0 1 6 0 0 1 4 0 0 1 2 0 0 1 0 0 0 1 10 5 0 1 6 5 0 1 4 5 0 1 1.5 9 0 1 0 5 0 1
mkface f s
incmesh f 1
trinfo f

#This shape contains 2 triangles.
# 4 nodes.
#Maximal deflection 0.65883450744480032
No tags attached.
related to 0024959closed bugmaster Open CASCADE GCPnts_TangentialDeflection does not implement functionality by its meaning in case of BSpline with local splash 
zip triangulation.zip (82,873) 2013-08-26 16:01
https://tracker.dev.opencascade.org/
Issue History
2013-08-26 16:01Vitezslav ZajicNew Issue
2013-08-26 16:01Vitezslav ZajicAssigned To => oan
2013-08-26 16:01Vitezslav ZajicFile Added: triangulation.zip
2014-05-21 13:10abvAssigned Tooan => azn
2014-05-21 13:10abvStatusnew => assigned
2014-05-21 13:10abvTarget Version => 6.8.0
2014-05-26 12:57oanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7538#r7538
2014-05-26 15:17oanRelationship addedrelated to 0024959
2014-09-26 12:09abvAssigned Toazn => oan
2014-09-26 15:58oanAssigned Tooan => bugmaster
2014-09-26 15:58oanNote Added: 0032249
2014-09-26 17:11abvNote Added: 0032263
2014-09-26 17:11abvStatusassigned => feedback
2014-09-29 15:47bugmasterAssigned Tobugmaster => mkv
2014-10-08 20:05gitNote Added: 0032843
2014-10-08 20:28mkvNote Added: 0032846
2014-10-08 20:28mkvAssigned Tomkv => bugmaster
2014-10-08 20:28mkvStatusfeedback => tested
2014-10-08 20:29mkvTest case number => bugs mesh(016) bug24127
2014-10-13 17:52bugmasterChangeset attached => occt master 432a8df0
2014-10-13 17:52bugmasterStatustested => verified
2014-10-13 17:52bugmasterResolutionopen => fixed
2014-10-21 16:42gitNote Added: 0033421
2014-11-11 12:43aivFixed in Version => 6.8.0
2014-11-11 13:01aivStatusverified => closed

Notes
(0032249)
oan   
2014-09-26 15:58   
Dear Bugmaster,

please create corresponding test case and check that current behavior of BRepMesh is correct and produces appropriate mesh.

Note that behavior should be checked using fix for issue 0024959.
(0032263)
abv   
2014-09-26 17:11   
Looks Ok on current master (90 triangles)
(0032843)
git   
2014-10-08 20:05   
Branch CR24127 has been created by mkv.

SHA-1: b1721cb348ed97574a2e3ac3e3ab17467d586aef


Detailed log of new commits:

Author: mkv
Date: Wed Oct 8 20:05:06 2014 +0400

    0024127: Mesh generated with BRepMesh_FastDiscret does not reflect a deflection setting \n Test case for issue CR24127
(0032846)
mkv   
2014-10-08 20:28   
Dear BugMaster,
Test cases bugs/mesh(016)/bug24127 is created and pushed to new branch CR24127 of occt git-repository.
Test cases bugs/mesh(016)/bug24127 is OK.
(0033421)
git   
2014-10-21 16:42   
Branch CR24127 has been deleted by inv.

SHA-1: b1721cb348ed97574a2e3ac3e3ab17467d586aef