bearing {cylcop}R Documentation

Compass Bearing of a Line Between 2 Points

Description

The angle between a line between 2 points in Euclidean 2-D space and the line from (0,0) to (0,1) is calculated. In other words, the compass bearing of a line between 2 points where north is 0. Angles increase in clockwise direction.

Usage

bearing(point1, point2, fullcirc = FALSE)

Arguments

point1

numeric vector holding the x and y coordinates of the first point.

point2

numeric vector holding the x and y coordinates of the second point.

fullcirc

logical value indicating whether the output should be an angle on [0, 2\pi) or [-\pi, \pi).

Value

If fullcirc = FALSE, the function returns a numeric value (angle) from the interval [-\pi, \pi).
If fullcirc = TRUE, the function returns a numeric value numeric from the interval [0, 2\pi).

Examples

bearing(c(3,5), c(1,4))
bearing(c(3,5), c(1,4), fullcirc = TRUE)

[Package cylcop version 0.2.0 Index]