Skip to content

test: stabilize S2FurthestEdgeQuery GetDistance check near Pi#624

Open
abhinavgautam01 wants to merge 3 commits into
google:masterfrom
abhinavgautam01:issue-592-macos-s2furthest-edge-query
Open

test: stabilize S2FurthestEdgeQuery GetDistance check near Pi#624
abhinavgautam01 wants to merge 3 commits into
google:masterfrom
abhinavgautam01:issue-592-macos-s2furthest-edge-query

Conversation

@abhinavgautam01
Copy link
Copy Markdown
Contributor

Fixes #592

Problem

macOS CI intermittently failed S2FurthestEdgeQuery.PointCloudEdges with:
GetDistance() slightly below expected_distance - max_error, even though the bulk comparison (CheckDistanceResults) passed.
See #592.

Cause

GetDistance() routes through FindFurthestEdge(), while the reference side runs brute-force FindFurthestEdges(). Near antipodal distances (~π / chord length near straight), tiny floating-point differences in length2() can trip a strict EXPECT_GE bound without indicating a real geometric mismatch.

Fix

In TestFindFurthestEdges, compare against:
(expected_distance - max_error) widened by
PlusError(-slack), where:

slack = max(
  GetUpdateMinDistanceMaxError(expected_distance)
    + GetUpdateMinDistanceMaxError(expected_distance - max_error),
  512 * DBL_EPSILON);

This keeps the check tied to documented distance-update error bounds, with a small absolute floor near 180°.

Validation

cd src
bazel test :s2furthest_edge_query_test --config=ci --test_filter='*PointCloudEdges*'

Comment thread src/s2/s2furthest_edge_query_test.cc Outdated
@abhinavgautam01 abhinavgautam01 requested a review from jmr May 13, 2026 10:27
Comment thread src/s2/s2furthest_edge_query_test.cc Outdated
@abhinavgautam01 abhinavgautam01 requested a review from jmr May 20, 2026 15:12
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.

macOS test failure: S2FurthestEdgeQuery.PointCloudEdges

2 participants