PolygonContains::Spherical
Instance methods
contains?(polygon : Array(Array(Point)), point : Point) : Bool
Spherical Winding Number Method Based on Chamberlain & Duquette (2007) and D3-Geo
Chamberlain-Duquette algorithm steps (adapted for meridian-crossing approach):
- Convert polygon vertices and test point to Cartesian coordinates on unit sphere
- For each edge, check if it crosses the test point's meridian
- For crossing edges, compute the geodesic arc and its intersection with the meridian
- Update winding number based on crossing direction (clockwise/counter-clockwise)
- Determine containment: odd winding number = inside, even = outside