Skip to content

Document edge-case behavior in api.md#31

Open
gistrec wants to merge 1 commit into
fix/docs-and-test-helpersfrom
docs/edge-cases
Open

Document edge-case behavior in api.md#31
gistrec wants to merge 1 commit into
fix/docs-and-test-helpersfrom
docs/edge-cases

Conversation

@gistrec

@gistrec gistrec commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Documents four previously unspecified or divergent behaviors in docs/api.md. Docs-only change, no code touched.

  • heading — when from == to or the points are exactly antipodal, the heading is mathematically undefined; the returned value is unspecified and platform-dependent (e.g. 0 vs -180 depending on FMA contraction; observed difference between x86 and ARM clang).
  • interpolate — exactly antipodal endpoints have no unique great circle (result unspecified); nearly antipodal endpoints (within ~1e-6 rad of 180°) hit the linear-interpolation fallback and can be thousands of kilometers off any true arc. Behavior inherited from android-maps-utils.
  • contains — edges spanning exactly 180° of longitude have an ambiguous direction and are never counted as crossed (android-maps-utils convention). Documents the behavior fixed in Fix contains() for polygon edges spanning exactly 180° of longitude #29.
  • distance_to_segment — degenerate segments are detected with the approximate LatLng equality (longitudes modulo 360°), so pairs like (0, -180)/(0, 180) collapse to a point. Deliberate divergence from the Java original, which compares exactly. Extends the Approximation note added in Document distance_to_segment limits; fix epsilon doc and test helper #26.

Not added: a geodesic-defaults note — already documented on master. Verified against upstream PolyUtil.kt: it has no geodesic defaults at all (only tolerance = DEFAULT_TOLERANCE), so the defaults are this port's own documented choice.

Stacking

Test plan

  • Docs-only: review rendered markdown of docs/api.md (four new blockquote notes).

- heading: result for from == to / exact antipodes is unspecified and
  platform-dependent (FMA contraction).
- interpolate: exact antipodes unspecified; near-antipodal pairs fall
  back to linear interpolation (inherited from android-maps-utils).
- contains: edges spanning exactly 180 degrees of longitude are never
  counted as crossed (upstream convention, fixed in #29).
- distance_to_segment: degenerate segments detected via approximate
  LatLng equality (lng modulo 360) — deliberate divergence from Java.
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