Compute the angle between to vectors (they should not both be the 0 vector).
This function uses the crossproduct and arctan to find the angle between two 2D vectors. It takes the four components of the vectors as scalar arguments to allow vectorized evaluation of multiple vector pairs at once. If one of the vectors is zero, the returned angle is also zero. Also multiplicities of Pi are ignored and a 0 angle will be returned for them.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | va_x | The first vector va |
||
real(kind=rk), | intent(in) | :: | va_y | The first vector va |
||
real(kind=rk), | intent(in) | :: | vb_x | The second vector vb |
||
real(kind=rk), | intent(in) | :: | vb_y | The second vector vb |
The angle betweend va and vb