sl.angle: Compute Angle between Triangle Edges on Sphere

View source: R/sl.angle.R

sl.angleR Documentation

Compute Angle between Triangle Edges on Sphere

Description

Compute the angle between two edges of a triangle on a sphere.

Usage

sl.angle(lon, lat, return.degree = FALSE, left = FALSE)

Arguments

lon

a vector of length 3 specifying the longitudes of the triangle vertices; the angle is computed at the second vertex.

lat

a vector of length 3 specifying the longitudes of the triangle vertices; the angle is computed at the second vertex.

return.degrees

a logical value specifying whether the result shall be provided in degrees instead of radians (default).

left

a logical value specifying whether the angle to the left shall be returned. If FALSE (default), the smaller of the two (left/right) angles is returned.

Details

The angle is computed at the second vertex. If left=FALSE (default), the smaller of the two (left/right) angles is returned (angle<=pi or angle<=180). To get the right-side angle, set left=TRUE and compute 2*pi-angle (or 360-angle).

Value

A scalar giving the angle (on a unit sphere) in radians (default) or in degrees (if return.degree=TRUE).

Author(s)

Helge Goessling

Examples

sl.angle(c(0,60,30),c(0,0,30))
## Should return:
## [1] 0.8570719

FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.