🐛 Handle degenerate 4-fold Voronoi vertices in _assemble_forces#42
Merged
🐛 Handle degenerate 4-fold Voronoi vertices in _assemble_forces#42
Conversation
When 4+ seed points are co-circular, qhull can produce a single Voronoi vertex incident to 4+ ridges, causing "too many values to unpack" when the code assumes exactly 3 incident cells. Add a fallback and extend the geometry test to cover the square configuration.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Owner
Author
Investigation note: same-looking pts, different behaviorDuring testing I observed that two point arrays that print identically as Root cause: the displayed values are rounded. The actual float64 bit patterns differ:
That tiny difference in the lower bits determines what qhull sees:
|
When input points are nearly cocircular, qhull can emit two nearly- coincident finite vertices whose angles from a cell center are indistinguishable, making the polygon sort unstable and causing a KeyError in geometry construction. Retry with QJ (joggle) on failure to skip the degenerate frame cleanly. Adds regression test using the saved degenerate point set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #38
Summary
ValueError: too many values to unpackwhen unpackingvertex_points[h]._assemble_forcesfor this degenerate case.Test plan
pytest tests/test_geom.py— covers right-angle and square configurations