ENH: Add Sharp Bounding Box Edges option to M3C surface meshing - #1735
Open
imikejackson wants to merge 2 commits into
Open
ENH: Add Sharp Bounding Box Edges option to M3C surface meshing#1735imikejackson wants to merge 2 commits into
imikejackson wants to merge 2 commits into
Conversation
M3C places every vertex on a cell edge, face center, or body center, so the marching squares that straddle a bounding box edge (one real corner, three ghost corners) join their edge midpoints with a diagonal. Every box edge and corner therefore came out with a 45 degree chamfer half a cell deep, which downstream FEA mesh preparation (e.g. Gmsh) cannot use without hand repair. * Add a "Sharp Bounding Box Edges" BoolParameter (default on) and bump the filter parameters version to 3; older pipelines take the default. * Add a post-pass in finalizeMesh that snaps the outermost row of wall nodes onto the neighbouring wall plane, merges the nodes that coincide on the box edge lines and corners, and drops the collapsed chamfer triangles. The pass works on the integer half-cell node lattice, so it is exact for any spacing and origin. One-cell-thick axes are left chamfered (ambiguous). * Add tests: exterior triangles are coplanar with a single wall, all eight box corners exist, no coincident vertices, single-feature box is watertight, one-cell-thick volume stays well formed, and Small IN100. * Document the option with before/after screenshots and update the demo pipeline. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
Issue BlueQuartzSoftware#1706 reported that M3C emitted vertices no triangle references (about 144 on a 12^3 volume, and a non-zero vertex count on an all-background volume once every face was pruned). Those orphans were a product of the six distinct ghost-shell sentinels: neighbouring ghost cells looked like a material interface to each other and marked candidate nodes whose triangles were never built. The single shared ghost sentinel introduced in BlueQuartzSoftware#1718 removed the cause. Re-measuring on the cylinder, all-background, polycrystal, porosity, toy, and Small IN100 datasets, in both Bounding Box Skin modes, now gives zero orphan vertices everywhere. * CheckMeshIntegrity now requires every emitted vertex to be referenced by a triangle, so a regression is caught by every M3C test that uses it. * The all-background skin test requires zero vertices instead of measuring a "pre-existing orphan" count, and the newly-orphaned check also requires zero unreferenced vertices overall. * Remove the orphan-vertex notes from the filter documentation and the stale comments in the algorithm and tests. Closes BlueQuartzSoftware#1706 Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
nyoungbq
reviewed
Sep 2, 2026
nyoungbq
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
M3C places every vertex on a cell edge, face center, or body center, so the marching squares that straddle a bounding box edge (one real corner, three ghost corners) join their edge midpoints with a diagonal. Every box edge and corner therefore came out with a 45 degree chamfer half a cell deep on each wall, which downstream FEA mesh preparation (Gmsh) cannot use without hand repair. Development builds of the port produced sharp edges; the chamfer appeared in the released version.
BoolParameter(default on) toM3CSurfaceMeshingFilterand bump the parameters version to 3. Older pipelines take the default.finalizeMeshthat snaps the outermost row of wall nodes onto the neighbouring wall plane, merges the nodes that coincide on the box edge lines and corners, and drops the collapsed chamfer triangles. The pass works on the integer half-cell node lattice, so it is exact for any spacing and origin. One-cell-thick axes are left chamfered since the single wall row is half a cell from both bounding planes.M3C_Demo.d3dpipeline.CheckMeshIntegritynow requires every emitted vertex to be referenced by a triangle, the all-background skin test requires zero vertices, and the orphan notes are removed from the docs and comments.Closes #1706
Test Plan
M3CSurfaceMeshingandBounding Box Skintests pass