Make _contains(::SphericalCap, ::SphericalCap) inclusive#400
Merged
Conversation
Change `<` to `<=` so that an internally-tangent small cap counts as contained. Matches the convention of the sibling `_contains(::SphericalCap, ::UnitSphericalPoint)` method one line below (which uses `<=` for a point exactly on the cap boundary) and S2's `S2Cap::Contains(const S2Cap&)`. The pre-existing `@test_broken` in `test/utils/unitspherical.jl` exercised exactly this boundary case: big_cap = hemisphere centered at (1,0,0), small_cap centered at (1/√2, 1/√2, 0) with radius π/4. `dist(centers) = π/4` and `small.radius + dist = π/2 = big.radius` exactly. Flip the tripwire to `@test`. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
_contains(::SphericalCap, ::SphericalCap)atsrc/utils/UnitSpherical/cap.jl:108from strict<to<=, so internally-tangent small caps count as contained._contains(::SphericalCap, ::UnitSphericalPoint)method (cap.jl:111) and S2'sS2Cap::Contains(const S2Cap&).@test_brokenintest/utils/unitspherical.jlthat exercised exactly this boundary case to@test.The broken test had:
big_cap= hemisphere centered at(1,0,0),small_capcentered at(1/√2, 1/√2, 0)with radiusπ/4.dist(centers) = π/4andsmall.radius + dist = π/2 = big.radiusexactly.Test plan
test/utils/unitspherical.jl: Spherical caps now 455 pass / 0 broken / 0 fail (was 454 pass / 1 broken)🤖 Generated with Claude Code