lengths.angle {cwhmath} | R Documentation |
Compute lengths of two vectors and the angle between them.
lengths.angle(x, y)
x |
the first vector. Alternatively, a single matrix with both vectors as columns can be provided. |
y |
the second vector, optional if x is an appropriate structure. |
A list with elements
lx |
the length of x . |
ly |
the length of y . |
angle |
the angle (in radian) between x and y . |
angleDeg |
the angle (in degrees) between x and y . |
Christian W. Hoffmann, christian.hoffmann@wsl.ch,
http://www.wsl.ch/staff/christian.hoffmann
x <- c(1,2,2,-1) y <- c(0,0.1,3,2) (l <- lengths.angle(x, y)) # == lengths.angle(cbind(x, y)) #> $lx #> [1] 3.16228 #> $ly #> [1] 3.60694 #> $angle #> [1] 1.1937 l$angle/pi*180 # in degrees > 68.394