Skip to content

GeographicFromUnitSphere throws DomainError on FP |z| slightly > 1 (missing clamp) #421

Description

@briochemc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions