Heat_method_3: fix multi-source distance normalization (value_at_source_set) - #9565
Open
jf--- wants to merge 1 commit into
Open
Heat_method_3: fix multi-source distance normalization (value_at_source_set)#9565jf--- wants to merge 1 commit into
jf--- wants to merge 1 commit into
Conversation
value_at_source_set() normalized the Poisson potential phi per vertex against the SET of source values (min_s |phi(v) - phi(s)|). phi is only determined up to one additive constant and is in general not constant across a multi-vertex source set, so every vertex whose phi lies inside the source-value spread was folded toward 0 and the far field was shifted by max_s phi(s) instead of a constant. Seeding all boundary vertices of an open mesh read ~0.5x the true distance near the boundary, with most near-boundary vertices below the euclidean lower bound; the error grows with the number/spread of sources. Single-source is the degenerate (correct) case and is unchanged. Anchor phi with a single constant instead: the mean of phi over the source set (the least-squares choice, matching common practice). Add a test on a flat fixture where the euclidean distance to the nearest source is the exact truth in the near-boundary band and a hard lower bound everywhere: before this fix the band mean d/d_true is 0.54 with 83% of band vertices below the lower bound (assertion fails); after, 1.13 with 2.4% marginal violations, identically in Direct and Intrinsic_Delaunay modes.
Member
|
Successfully tested in CGAL-6.3-Ic-31 |
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.
Surface_mesh_geodesic_distances_3::estimate_geodesic_distances()returns badly wrong distances for multi-vertex source sets — the more sources (and the larger the spread of the recovered potential across them), the worse. The flagship "distance from the domain boundary" usage (add every boundary vertex of an open mesh as a source) reads ~0.5x the true distance near the boundary, with most near-boundary vertices reading below the euclidean straight-line lower bound, which is impossible for a distance. Single-source results are correct, which is why the examples and the existing tests never exposed it.Root cause. The Poisson step recovers the potential
phionly up to one additive constant, andphiis in general not constant across a multi-vertex source set (the normalized gradient field is not exactly integrable).value_at_source_set()then computeswhich is the 1-D distance from the value
phi(i)to the set of source values, not a shift: every vertex whosephilands inside the source-value spread is folded toward 0, and the far field is shifted bymax_s phi(s)instead of a single constant. With one source the rule degenerates to the correct shift.Fix. Anchor
phiwith a single constant: the mean ofphiover the source set (the least-squares choice, matching common practice in other heat-method implementations, e.g. geometry-central). Single-source behavior is unchanged (mean of one value = that value). Distances at source vertices are now ~0 up to discretization error instead of exactly 0-by-construction of the fold; the existing package tests (which check distance ranges) pass unchanged.Test.
heat_method_surface_mesh_multisource_test.cpp+data/flat_star_disk_irregular_rim.off: a small flat star-shaped disk (z = 0) with irregular, variable-density boundary sampling, all 508 boundary vertices used as sources. Because the mesh is flat and simply covered, the exact geodesic distance to the source set equals — in the near-boundary band — the euclidean distance to the nearest source (verified to ~1e-15 against exact polyhedral geodesics when the fixture was generated; agreement stated in the file header), and the euclidean distance is a hard lower bound everywhere. So the test is self-contained: no oracle dependency, and the failure is unambiguous (a distance smaller than the straight line). The fixture is fully synthetic (generated programmatically; CC0).Measured with this test (band = 2h..6h of the euclidean distance to the source set, h = mean edge length), identically in
DirectandIntrinsic_Delaunaymodes:d / d_trueOn a real-world case (12.9k-vertex planar slice of a Stanford-bunny print, 434 boundary sources, measured against exact MMP geodesics): near-boundary ratio 0.41 before, 1.00 after.