@@ -54,6 +54,7 @@ module _AntimeridianHelpers
5454
5555import GeoInterface as GI
5656import .. GeometryOps as GO
57+ using .. GeometryOps: CutAtAntimeridianAndPoles
5758
5859# Custom cross product for 3D tuples
5960function _cross (a:: Tuple{Float64,Float64,Float64} , b:: Tuple{Float64,Float64,Float64} )
@@ -65,7 +66,8 @@ function _cross(a::Tuple{Float64,Float64,Float64}, b::Tuple{Float64,Float64,Floa
6566end
6667
6768# Convert spherical degrees to cartesian coordinates
68- function spherical_degrees_to_cartesian (point:: Tuple{Float64,Float64} ):: Tuple{Float64,Float64,Float64}
69+ function spherical_degrees_to_cartesian (c:: CutAtAntimeridianAndPoles , point:: Tuple{Float64,Float64} ):: Tuple{Float64,Float64,Float64}
70+ # TODO : handle non-degree domains somehow
6971 lon, lat = point
7072 slon, clon = sincosd (lon)
7173 slat, clat = sincosd (lat)
7981# Calculate crossing latitude using great circle method
8082function crossing_latitude_great_circle (c:: CutAtAntimeridianAndPoles , start:: Tuple{Float64,Float64} , endpoint:: Tuple{Float64,Float64} ):: Float64
8183 # Convert points to 3D vectors
82- p1 = spherical_degrees_to_cartesian (start)
83- p2 = spherical_degrees_to_cartesian (endpoint)
84+ p1 = spherical_degrees_to_cartesian (c, start)
85+ p2 = spherical_degrees_to_cartesian (c, endpoint)
8486
8587 # Cross product defines plane through both points
8688 n1 = _cross (p1, p2)
8789
8890 # Unit vector that defines the meridian plane
89- n2 = spherical_degrees_to_cartesian (c. left, 0.0 )
91+ n2 = spherical_degrees_to_cartesian (c, (c . left, 0.0 ) )
9092
9193 # Intersection of planes defined by cross product
9294 intersection = _cross (n1, n2)
@@ -294,7 +296,7 @@ function cut_at_antimeridian(
294296 end
295297
296298 # Build final polygons
297- result_polygons = build_polygons (segments)
299+ result_polygons = build_polygons (c, segments)
298300
299301 # Add holes to appropriate polygons
300302 for hole in holes
0 commit comments