UnitSpherical.spherical_arc_intersection is correct (matches a hand-rolled d3 great-circle intersector on every case tried, including the degenerate zero-length-segment guard), but it returns an ArcIntersectionResult holding Vectors and builds a candidates vector, so each call heap-allocates (~4 allocations / 240 B). That blocks using it inside a tight edge×edge polygon-clip loop.
An allocation-free entry point — a small immutable result (type + ≤2 UnitSphericalPoints + a frac tuple, no Vectors), or an in-place variant — would let downstreams delegate the core spherical primitive.
using GeometryOps.UnitSpherical, BenchmarkTools
u = UnitSphereFromGeographic()
@btime spherical_arc_intersection($(u((0.,0.))), $(u((40.,0.))), $(u((20.,-20.))), $(u((20.,20.)))) # ~4 allocations: 240 bytes
Context: an in-review GeoMakie PR (MakieOrg/GeoMakie.jl#381) keeps an allocation-free hand-rolled great-circle intersector for its hot clip loop to work around this — released GeoMakie does not have or need this. (cf. #414, which adds an allocation cache for ConvexConvexSutherlandHodgman.)
UnitSpherical.spherical_arc_intersectionis correct (matches a hand-rolled d3 great-circle intersector on every case tried, including the degenerate zero-length-segment guard), but it returns anArcIntersectionResultholdingVectors and builds acandidatesvector, so each call heap-allocates (~4 allocations / 240 B). That blocks using it inside a tight edge×edge polygon-clip loop.An allocation-free entry point — a small immutable result (type + ≤2
UnitSphericalPoints + a frac tuple, noVectors), or an in-place variant — would let downstreams delegate the core spherical primitive.Context: an in-review GeoMakie PR (MakieOrg/GeoMakie.jl#381) keeps an allocation-free hand-rolled great-circle intersector for its hot clip loop to work around this — released GeoMakie does not have or need this. (cf. #414, which adds an allocation cache for
ConvexConvexSutherlandHodgman.)