GeographicFromUnitSphere computes the latitude as asind(z) without clamping. For a normalised vector whose z component is a floating-point hair over 1 (or under -1), asind throws a DomainError, so the transform is not total on its own (unit-sphere) domain.
A clamp(z, -1, 1) before asind (and likewise for any asin/acos on dot products elsewhere) would make it robust. Context: an in-review GeoMakie PR (MakieOrg/GeoMakie.jl#381) keeps a hand-rolled _sph only to get this clamp — released GeoMakie does not have or need it.
Split out of #418 per maintainer request.
GeographicFromUnitSpherecomputes the latitude asasind(z)without clamping. For a normalised vector whosezcomponent is a floating-point hair over 1 (or under -1),asindthrows aDomainError, so the transform is not total on its own (unit-sphere) domain.A
clamp(z, -1, 1)beforeasind(and likewise for anyasin/acoson dot products elsewhere) would make it robust. Context: an in-review GeoMakie PR (MakieOrg/GeoMakie.jl#381) keeps a hand-rolled_sphonly to get this clamp — released GeoMakie does not have or need it.Split out of #418 per maintainer request.