Repository navigation
computeTopologyMetrics and computeBoundaryMetrics for a mesh part - #7635
Merged
Merged
Conversation
Returns MeshPartTopologyMetrics with the number of handles, holes, components and other counts, where all not-region faces are considered missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grantim
approved these changes
Dec 2, 2026
Grantim
left a comment
Contributor
There was a problem hiding this comment.
Are we going to reuse it ObjectMesh metrics caches and/or Mesh caches? Should we be able to request only subset of all metrics?
…ObjectMeshHolder Holes are traced with Turn::Rightmost, so for whole mesh their number equals MeshTopology::findNumHoles(); components are counted via vertices only if some vertex has several fans of region faces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tices Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
computeBoundaryMetrics visits only set bits when tracing loops and has a whole-mesh path for boundary edges; ObjectMeshHolder gets both component counts from one union-find structure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grantim
reviewed
Dec 3, 2026
…s less Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grantim
reviewed
Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grantim
approved these changes
Dec 3, 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.
New
MRTopologyMetrics.h:computeTopologyMetrics( const MeshPart& ), an analog ofObjectMeshHolder::numHandles()for a mesh part, where all not-region faces are considered missing. It returnsMeshPartTopologyMetrics:numFaces,numUndirectedEdges,numBdEdges,numVerts,numMultiHoleVerts(manifold vertices with more than one hole around)numHoles: region boundary loops traced withTurn::Rightmost, i.e. the holes as they would be filled; for whole mesh equal toMeshTopology::findNumHoles()numComponents(connected via vertices),eulerCharacteristic = numVerts - numUndirectedEdges + numFacesnumHandles = numComponents - ( eulerCharacteristic + numHoles ) / 2: the total genus after filling every hole with a diskcomputeBoundaryMetrics( topology, region ): parallel computation ofnumBdEdges,multiHoleVerts,numHolescomputeNumComponents( meshPart, bd ): components connected via vertices, asgetNumComponents( PerVertex )but via edge components united only inbd.multiHoleVertscomputeNumHandles( numComponents, eulerCharacteristic, numHoles )ObjectMeshHoldernow cachescomputeBoundaryMetricsinstead offindNumHoles()(samenumHoles()values) and returns it from new publicboundaryMetrics(), cachesnumHandles()and computes it viacomputeNumHandles;numComponents()(via edges) and the components via vertices fornumHandles()come from onecomputeNumComponentscall.ObjectMeshon a 4M-triangle torus, master vs PR, min of 3 interleaved runs x 12 calls with cleared caches:numHoles()numHoles()numComponents()+numHandles()+numHoles()numComponents()+numHandles()+numHoles()numComponents()alone takes 19 ms instead of 11 ms, since it computes boundary metrics first; all its callers (scene info, info lines, MCP stats) requestnumHoles()as well, which is then cached.Unit tests: whole torus, torus with holes (null region vs all valid faces), torus without one triangle, torus with cut tube, two cube triangles sharing only a vertex, empty region; torus with 551 holes, many passing common vertices:
computeBoundaryMetrics,findNumHolesandObjectMesh::numHoles()agree.🤖 Generated with Claude Code