From 1be3a1284eb80ea140bd163c176cb93e2108da0c Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Tue, 28 Jan 2025 16:26:49 -0500 Subject: [PATCH] BUG: Changes the Face Label value to -1 for boundary triangles in SurfaceNets Also updated documentation with a short section about the face labels. Signed-off-by: Michael Jackson --- .../SimplnxCore/docs/QuickSurfaceMeshFilter.md | 15 +++++++++++---- src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md | 6 ++++++ .../Filters/Algorithms/SurfaceNets.cpp | 10 +++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Plugins/SimplnxCore/docs/QuickSurfaceMeshFilter.md b/src/Plugins/SimplnxCore/docs/QuickSurfaceMeshFilter.md index 089713dddf..0c695395af 100644 --- a/src/Plugins/SimplnxCore/docs/QuickSurfaceMeshFilter.md +++ b/src/Plugins/SimplnxCore/docs/QuickSurfaceMeshFilter.md @@ -63,13 +63,20 @@ One of the arrays to come out of the algorithm is the "Node Type" vertex array. | 13 | Node that is on the exterior of the mesh and is a triple line | | 14 | Node that is on the exterior of the mesh and is a quadruple point | +### Exterior or Boundary Triangles + +Each triangle that is created will have an 2 component attribute called `Face Labels` that represent the Feature ID on either +side of the triangle. If one of the triangles represents the border of the virtual box then one of the FaceLables will +have a value of -1. + ## Notes -The Quickmesh algorithm is very crude and naive in its implementation. This filter +The Quick Mesh algorithm is very crude and naive in its implementation. This filter along with the Laplacian Smoothing filter can give you reasonable results. The -newer filter that should replace both the quick mesh and the Laplacian Smoothing -filter is the "SurfaceNets" surface meshing algorithm. This will create the surface -mesh and smooth in a single filter and give subjectively better results. +newer filter that should replace both the Quick Mesh and the Laplacian Smoothing +filter is the "Surface Nets" surface meshing algorithm. This will create the surface +mesh and smooth in a single filter and give subjectively better results and perform +much faster at both. % Auto generated parameter table will be inserted here diff --git a/src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md b/src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md index 441dca1613..71b1dccb15 100644 --- a/src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md +++ b/src/Plugins/SimplnxCore/docs/SurfaceNetsFilter.md @@ -58,6 +58,12 @@ Nodes that appear on the exterior of a volume have Node Type values starting at ![Exterior Node Types](Images/SurfaceNets_NodeType_Exterior.png) +### Exterior or Boundary Triangles + +Each triangle that is created will have an 2 component attribute called `Face Labels` that represent the Feature ID on either +side of the triangle. If one of the triangles represents the border of the virtual box then one of the FaceLables will +have a value of -1. + ## Notes This filter should be used in place of the "QuickMesh Surface Filter". diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SurfaceNets.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SurfaceNets.cpp index 81beb435e0..1e64beedd4 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SurfaceNets.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SurfaceNets.cpp @@ -242,7 +242,6 @@ Result<> SurfaceNets::operator()() std::array vData{}; for(int idxVtx = 0; idxVtx < nodeCount; idxVtx++) { - // Back-bottom edge if(cellMapPtr->getEdgeQuad(idxVtx, MMCellFlag::Edge::BackBottomEdge, vertexIndices.data(), quadLabels.data())) { @@ -420,5 +419,14 @@ Result<> SurfaceNets::operator()() } } + // Now run through the FaceLabels to make them consistent with Quick Surface Mesh + for(usize tIdx = 0; tIdx < triangleCount * 2; tIdx++) + { + if(faceLabels[tIdx] == 0) + { + faceLabels[tIdx] = -1; + } + } + return {}; }