Mesh triangulation quality


I'm using BRepMesh_IncrementalMesh to tessellate faces and I'm getting a weird behaviour: whenever a edge requires a finer set of triangles the whole U and V strips are using that smaller triangle size (see attached picture).
I agree I should get a higher number of triangles near the round borders, but I wouldn't expect the corresponding horizontal and vertical strips to be over-triangularized. Other meshers still use the same tessellation as in other areas there.

The code:
> BRepMesh_IncrementalMesh M(MyFace,Tol,Standard_False,M_PI/2.,Standard_True);

Are my parameters not optimal?  Am I doing something wrong?
Is there any way to achieve what I'd like to get?
Is BRepMesh_IncrementalMesh the correct class to use for this?

Thanks in advance.

Qr Qr's picture

Hi Andrea,

This tool is designed to generate visualization facets only. If you want to have more regular tessellation, it is definitely not a good choice. What about Netgen?


Andrea Venturoli's picture

Hello Qr and thanks for your reply.

My problem is not a "regularity" one; in fact I'm asking the mesh to be less regular, but faster to process later: what we are getting is more than acceptable tolerance-wise, but features a lot of triangles which are not really needed. Is there anything we can do to tweak this class to achieve this?

As for Netgen, it's a different product we'd need to integrate; I'll have a look into it, anyway.


Qr Qr's picture

Andrea, can you attach the CAD file of your test model so that I can do some experiments with it?

Andrea Venturoli's picture

Sure: here it is.


Qr Qr's picture

I've tried to run it for a very coarse setting: I've set 1 for linear deflection and 15 degrees for the angular deflection. The result I obtained is at the picture attached. For Netgen, people say it is quite slow.

Andrea Venturoli's picture

I don't care much for angular deflection, so I set it at M_PI/2 (it should be in radiants, shouldn't it?).

Anyway, I tried with your settings and, of course, I'm getting what you get; unfortunately 1 (assuming it means 1mm) is too big a deflection for us (we need 0.01mm).

As a test, I tried starting with 1 and lowering it:

_ at 0.5 the mesh still looks fine (as in your pictures);

_ at 0.25 some triangles start appearing which should not IMHO be needed;

_ at 0.125 the situation is like in my original picture (with way too many triangles added).

In the end, you confirm there is no way to achieve what we want?

 bye & Thanks

Qr Qr's picture

No way here. I tried all parameters it offers and see no gradation in element size from boundary to interior. Visualization mesh is not targeted for that. Personally, I believe, NetGen will give you the expected level of quality.

Andrea Venturoli's picture

Thanks, I'll try NetGen.

Mikhail Sazonov's picture

The OCCT bug #27693 registered after this topic has been fixed. In the current master the picture is the following. Linear deflection is 0.01, angular is pi/2.