Description Usage Arguments Value Examples
Function comes in two flavors. Either it calculates the smallest angle [0, 180) or the anti-clockwise angle with respect to the second vector [0, 360).
1 | vec_angles(a, b, rad = TRUE, mode = 1)
|
a |
A matrix or a vector |
b |
A reference vector to find angle against. |
rad |
Angular measure is radian? (default |
mode |
1= smallest angle in [0, 180); 2=anti-clockwise angle with respect vector b in [0, 360). |
Vector of angles
1 2 3 4 5 6 7 8 9 10 11 12 | v <- c(1,0) # point vector
rad <- seq(0, 2*pi, length=10) # radians to rotate
m <- cbind(cos(rad), sin(rad)) # 2d m matrix
# mode 1: between 0 and 180 degrees, minimal angle / radian
vec_angles(v, c(1,0))
vec_angles(m, c(1,0))
# mode 2: between 0 and 360 degrees, anti-clockwise
vec_angles(v, c(1,0), mode=2)
vec_angles(m, c(1,0), mode=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.