sphere.tri.area: Area of triangles on a sphere

View source: R/geometry.R

sphere.tri.areaR Documentation

Area of triangles on a sphere

Description

This uses L'Hullier's theorem to compute the spherical excess and hence the area of the spherical triangle.

Usage

sphere.tri.area(P, Tr)

Arguments

P

2-column matrix of vertices of triangles given in spherical polar coordinates. Columns need to be labelled phi (latitude) and lambda (longitude).

Tr

3-column matrix of indices of rows of P giving triangulation

Value

Vectors of areas of triangles in units of steradians

Author(s)

David Sterratt

Source

Wolfram MathWorld http://mathworld.wolfram.com/SphericalTriangle.html and http://mathworld.wolfram.com/SphericalExcess.html

Examples

## Something that should be an eighth of a sphere, i.e. pi/2
P <- cbind(phi=c(0, 0, pi/2), lambda=c(0, pi/2, pi/2))
Tr <- cbind(1, 2, 3)
## The result of this should be 0.5
print(sphere.tri.area(P, Tr)/pi)

## Now a small triangle
P1 <- cbind(phi=c(0, 0, 0.01), lambda=c(0, 0.01, 0.01))
Tr1 <- cbind(1, 2, 3)
## The result of this should approximately 0.01^2/2
print(sphere.tri.area(P, Tr)/(0.01^2/2))

## Now check that it works for both
P <- rbind(P, P1)
Tr <- rbind(1:3, 4:6)
## Should have two components
print(sphere.tri.area(P, Tr))

retistruct documentation built on April 3, 2025, 5:58 p.m.