@@ -54,6 +54,7 @@ module _AntimeridianHelpers
54
54
55
55
import GeoInterface as GI
56
56
import .. GeometryOps as GO
57
+ using .. GeometryOps: CutAtAntimeridianAndPoles
57
58
58
59
# Custom cross product for 3D tuples
59
60
function _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
65
66
end
66
67
67
68
# 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
69
71
lon, lat = point
70
72
slon, clon = sincosd (lon)
71
73
slat, clat = sincosd (lat)
79
81
# Calculate crossing latitude using great circle method
80
82
function crossing_latitude_great_circle (c:: CutAtAntimeridianAndPoles , start:: Tuple{Float64,Float64} , endpoint:: Tuple{Float64,Float64} ):: Float64
81
83
# 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)
84
86
85
87
# Cross product defines plane through both points
86
88
n1 = _cross (p1, p2)
87
89
88
90
# 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 ) )
90
92
91
93
# Intersection of planes defined by cross product
92
94
intersection = _cross (n1, n2)
@@ -294,7 +296,7 @@ function cut_at_antimeridian(
294
296
end
295
297
296
298
# Build final polygons
297
- result_polygons = build_polygons (segments)
299
+ result_polygons = build_polygons (c, segments)
298
300
299
301
# Add holes to appropriate polygons
300
302
for hole in holes
0 commit comments