BUG: Fix periodic feature-centroid model in Triangle and Feature centroid filters#1670
Open
imikejackson wants to merge 2 commits into
Open
Conversation
…artzSoftware#1665) The periodic path added a constant |max-min|/2 offset to the naive centroid, which is only correct when a wrapped feature's mass is symmetric about the seam and can place the centroid outside the domain for asymmetric features. * Reimplement the AdjustCentroidsForPeriodicFaces BoundingBox overload as a largest-empty-gap minimum-image mean computed from the feature's vertex coordinates, with in-domain wrap-back and an arithmetic-mean fallback for domain-filling features. * Fix a latent std::bad_function_call: the algorithm invoked m_MessageHandler.m_Callback() directly, bypassing the empty-callback guard; use the call operator instead. * Add cancel checks to the triangle and feature loops; avoid a per-feature std::set copy. * Add a Class 1 (Analytical) + Class 4 (Invariant) periodic oracle test covering non-wrapping, symmetric-wrap, asymmetric-wrap, and domain-filling features; passes in-core and out-of-core. * Add V&V deliverables (report, deviations, provenance) and document the Is Periodic behavior. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…uartzSoftware#1665) The periodic path applied a constant half-domain offset to the naive centroid. That model is only correct when a wrapped feature's mass is symmetric about the seam and can place asymmetric features outside the domain. The prior spacing fix (BlueQuartzSoftware#1658) was necessary but not sufficient. * Reimplement the periodic path as a minimum-image circular mean: accumulate per-feature unit-vector (cos/sin) sums during the cell sweep, and at finalize replace the arithmetic centroid with the circular mean on axes where the feature spans the full extent. A near-zero resultant (domain-filling feature) falls back to the arithmetic mean. Trig is only evaluated when Is Periodic is enabled. * Remove the range-based ImageGeom overload of AdjustCentroidsForPeriodicFaces: per-feature index ranges are mathematically insufficient to compute a wrapped centroid, and it now has no callers. * Re-derive periodic test fixtures D and E against an independent minimum-image oracle (no longer the circular constant-offset oracle), and add Fixture F for the domain-filling fallback. Pass in-core and OOC. * Update the ComputeFeatureCentroids V&V report, deviations, and user docs to reflect the corrected model. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
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
Fixes the periodic (wrap-aware) centroid computation in both
ComputeTriangleGeomCentroidsandComputeFeatureCentroids. Both used a constant half-domain offset added to the naive centroid, which is only correct when a wrapped feature's mass is symmetric about the seam and can place asymmetric wrapped features outside the domain.Fixes #1665.
AdjustCentroidsForPeriodicFacesBoundingBoxoverload as a largest-empty-gap minimum-image mean computed from the feature's vertex coordinates (in-domain wrap-back; arithmetic-mean fallback for domain-filling features).std::bad_function_call: the algorithm invokedm_MessageHandler.m_Callback()directly, bypassing the empty-callback guard; it threw whenever the periodic branch fired without an installed handler. Also add cancel checks to both loops and remove a per-featurestd::setcopy.Is Periodicis enabled). Remove the range-basedImageGeomoverload ofAdjustCentroidsForPeriodicFaces, whose per-feature index ranges are mathematically insufficient to compute a wrapped centroid.ComputeTriangleGeomCentroids.FindTriangleGeomCentroids/FindFeatureCentroidshave no periodic mode), so no legacy behavior changes. The non-periodic paths are unchanged.Test Plan
SimplnxCore::ComputeTriangleGeomCentroids,SimplnxCore::ComputeFeatureCentroids)simplnx-ooc-Rel)GeometryHelpersconsumers regression-checked (SharedFeatureFace)New oracle tests include the discriminating asymmetric-wrap case: the old code produced an out-of-bounds centroid (
4.625on a[0,4]domain) where the correct minimum-image value is3.625.