cal_angle: Rotation angle of two speed vector

View source: R/cal_angle.R

cal_angleR Documentation

Rotation angle of two speed vector

Description

Rotation angle of two speed vector

Usage

cal_angle(v1, v2, clockwise = -1)

cal_azimuth(v, refer = c(0, 1))

Arguments

v1, v2

speed vector, in deg, (lon, lat).

  • v1 is the previous time.

  • v2 is the current time;

clockwise

one of c(-1, 1): -clockwise = -1: clockwise corresponds to negative angle -clockwise = 1: clockwise corresponds to positive angle (azimuth angle in this style)

Value

v2 -> v1:

  • rotation angle (in deg, ⁠[-180, 180]⁠)

    • counterclockwise is positive

    • clockwise is negative

  • azimuth angle (in deg, ⁠[-180, 180]⁠)

    • the angle with north (c(0, 1))

Examples

cal_angle(c(1, 0), c(2, 0)) # == 0
cal_angle(c(0, 1), c(0, 2)) # == 0

p1 <- c(1, 0)
p2 <- c(0, 1)

cal_angle(p1, p2) # == 90, counterclockwise
cal_angle(p2, p1) # == -90, clockwise

rpkgs/hydroTools documentation built on Oct. 8, 2024, 7:47 p.m.