angle2d determines the angle between pairs of coordinates in degrees or radians. The coordinats are assumed to be in 2d space.
Usage
angle2d(coords1, coords2, radians = FALSE)
Arguments
coords1
An \(N \times 2\) matrix of spatial coordinates.
coords2
An \(N \times 2\) matrix of spatial coordinates.
radians
A logical indicating whether degrees or radians should be returned. Default is FALSE, meaning return angle in degrees.
Value
Returns a vector of angles.
Details
Note that the angle is between the actual pairs of points, not the angle between the vectors extending from the origin to the points. e.g., the angle between cbind(0, 1) and cbind(1, 1) would be 90 degrees, not 45. Sign of the direction not accounted for, e.g., a -135 degree angle is rotated by 180 degrees to become a 45 degree angle. All angles returned are in the interval [0, 180].