Refactoring of BRepMesh

Forums: 

We are glad to inform the community of Open CASCADE Technology about a complete overhaul of BRepMesh component that is waiting for release in the upcoming 7.4.0 version. This overhaul, constrained by the requirement to keep non-regression of test cases collected during the last 20 years, took a while. In the end, the entire component has gained a new appearance. The new architecture simplifies the process of mesh generation over OCCT's BRep models and enables processing of some corner cases that were hard to handle before.

Improvements

Major improvements of the updated BRepMesh component have been implemented in the context of the issue #0026106 “BRepMesh - revision of data model” and its descendants:

Internal code structure

  • New internal data structures as a backbone;
  • Removed connections between data structures, auxiliary tools, and algorithms;
  • Refactored source code which simplifies debugging, readability, and further improvements;

Performance

  • Edges tessellation in parallel mode;
  • Checks, healing of discrete model and model pre- and post-processing in partially parallel mode;
  • Intersections of discrete representations of edges in the face are resolved by re-tessellation of only the relevant edges and not the entire face;

Robustness and quality

  • Preprocessing of a data model to resolve common cases of self-intersections of discrete representation;
  • Improved presentation of cones near seam edges;
  • Improved presentation of spheres near poles;
  • Two new parameters to control linear and angular deflection for the interior part of faces separately from their boundaries;
  • Additional improvements over NURBS surfaces to fit specified linear and angular deflection;
  • Some improvements to resolve unrestricted consumption of memory and hang-ups on specific cases of NURBS surfaces.

Examples

Some cases of visual improvements

OCCT 7.3.0 Master

Some cases of accuracy improvements

OCCT 7.3.0 Master

Some cases of performance improvements

 

 

The shape above contains an assembly where a single solid box is replicated ~93000 times. The performance on this case has been improved up to 10 times comparing to 7.3.0:

 

 

Implications on porting

In the new version, deflection is controlled more accurately. Due to this improvement, it may be necessary to tune parameters of call of the BRepMesh algorithm on the application side to obtain the same visual quality of presentation and/or performance as before. For the details related to the structure and the usage of updated component browse Meshing part of OCCT documentation.

Conclusion

As a result of separating data structures from the processing part, the component has acquired more flexibility, which enables local modifications and opens the door for further improvements including runtime change of core triangulation algorithm.

At the moment, we have resolved about 40 issues thanks to the introduced changes and believe that it will help to fix many other use cases specific for your OCCT-based projects.

We tried to keep interface and behavior of BRepMesh compatible with previous versions of OCCT as much as possible, and it works for the cases found in our test database. However, there might be use cases that show different behavior after this improvement. So if you encounter any issues or have a question, you are welcome to share it here or register an issue in the OCCT bug tracker. Your patches are always welcomed.

Our collaborative work is sure to make the component meet the needs of your user's engineering art process.

Sébastien Raymond's picture

This is a good news, thanks for this developement