Failed to create watertight mesh when geometry contains bezier curves with congruent control points

Hello,

I encountered an issue where surface meshing fails (returns `1`) when the given solid geometry contains bezier curves with congruent control points. The output mesh is not watertight at the area where the congruent control points are located. A complete example for reproduction is attached. However, this erroneous behavior can also be encountered with many different geometries containing congruent bezier control points.

Here is the code (OCCT 7.9, Netgen 6.2.2604):

const char* infile = “C:\\temp\\seg.brep”;
TopoDS_Shape shape;
BRepTools::Read(shape, infile, BRep_Builder());
auto occgeom = std::make_shared < netgen::OCCGeometry > (shape);

netgen::MeshingParameters mp;
mp.perfstepsend = netgen::MESHCONST_MESHSURFACE;
mp.minh = 1;
mp.maxh = 20;

auto mesh = std::make_shared < netgen::Mesh > ();
mesh->SetGeometry(occgeom);
auto result = occgeom->GenerateMesh(mesh, mp);

Here is a schematic view of the given rotational symmetric geometry. The outer contour is a bezier curve of degree 4 with 5 control points where the first 3 control points are congruent:

Geometry failing to mesh:

seg.brep (116.2 KB)

For comparison the following geometry has no congruent control points and meshing runs successfully:

seg_okay.brep (77.7 KB)

It would be great, if this issue can be fixed.

Best regards,

Matthias

It seems I reported a wrong Netgen version. With version 6.2.2604 the issue does not occur anymore. The following git-commit fixed it:

SHA-1: 2d5258cf4d24fa13818287eee6566dcfb9c69e17

Normalize only non-zero vectors (works around issues when parametrization has (near-)zero derivative)

Sorry I forgot to reply to you. Yes this has been fixed now. Also afterwards a few stability improvements regarding meshing of things where occt gives 0 derivatives and so on. So maybe also worth giving 2605 a shot :slight_smile:

Thank you, Christopher! I continued with version 2605.

Here is another example related to congruent spline control points, which still fails to mesh successfully. Meshing runs ~5 minutes and returns 0, however the mesh is invalid in the area of congruent control points:

geo_ctrlpntdupl.brep (411.1 KB)

const char* infile = “C:\\temp\\geo_ctrlpntdupl.brep”;
TopoDS_Shape shape;
BRepTools::Read(shape, infile, BRep_Builder());
auto occgeom = std::make_shared < netgen::OCCGeometry >(shape);

netgen::MeshingParameters mp;
mp.perfstepsend = netgen::MESHCONST_OPTSURFACE;
mp.optsteps2d = 1;
mp.optsteps3d = 1;
mp.minh = 0.1;
mp.maxh = 2;
mp.grading = 0.5;
mp.uselocalh = true;
mp.segmentsperedge = 1.0;
mp.curvaturesafety = 9.0;
mp.closeedgefac = 8.0;

auto mesh = std::make_shared < netgen::Mesh >();
mesh->SetGeometry(occgeom);
auto result = occgeom->GenerateMesh(mesh, mp);

If the control points are not congruent the geometry can be meshed successfully within a few seconds.

Best regards,

Matthias