hammer_to_sph: Map Cartesian coordinates into Hammer projection

View source: R/angles.R

hammer_to_sphR Documentation

Map Cartesian coordinates into Hammer projection

Description

Computes the Hammer projection of points on the sphere.

Usage

sph_to_hammer(x)

hammer_to_sph(y)

Arguments

x

matrix of size c(n, 3) with the Cartesian coordinates on \mathcal{S}^2. Assumed to be of unit norm in the rows.

y

matrix of size c(n, 2) with the Hammer coordinates.

Value

  • sph_to_hammer: the matrix y.

  • hammer_to_sph: the matrix x.

Examples

# Plot Fibonacci lattice
plot(sph_to_hammer(fib_latt(n = 1000)))
points(sph_to_hammer(rbind(c(0, 0, 1), c(0, 0, -1))), col = 2, pch = 19)
points(sph_to_hammer(rbind(c(1, 0, 0), c(-1, 0, 0))), col = 3, pch = 19)
points(sph_to_hammer(rbind(c(0, 1, 0), c(0, -1, 0))), col = 4, pch = 19)

# Check changes of coordinates
hammer_to_sph(sph_to_hammer(rbind(c(1, 0, 0), c(0, 1, 0))))
sph_to_hammer(hammer_to_sph(rbind(c(0, 0), c(0.5, 0.5))))

polykde documentation built on Aug. 8, 2025, 6:55 p.m.