Skip to content

Make _contains(::SphericalCap, ::SphericalCap) inclusive#400

Merged
asinghvi17 merged 1 commit into
mainfrom
cap-contains-inclusive
Apr 21, 2026
Merged

Make _contains(::SphericalCap, ::SphericalCap) inclusive#400
asinghvi17 merged 1 commit into
mainfrom
cap-contains-inclusive

Conversation

@asinghvi17
Copy link
Copy Markdown
Member

Summary

  • Change _contains(::SphericalCap, ::SphericalCap) at src/utils/UnitSpherical/cap.jl:108 from strict < to <=, so internally-tangent small caps count as contained.
  • Matches the convention of the sibling _contains(::SphericalCap, ::UnitSphericalPoint) method (cap.jl:111) and S2's S2Cap::Contains(const S2Cap&).
  • Flip the pre-existing @test_broken in test/utils/unitspherical.jl that exercised exactly this boundary case to @test.

The broken test had: 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.

Test plan

  • test/utils/unitspherical.jl: Spherical caps now 455 pass / 0 broken / 0 fail (was 454 pass / 1 broken)

🤖 Generated with Claude Code

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>
@asinghvi17 asinghvi17 merged commit 6fadd17 into main Apr 21, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant