The angle between two vectors (in radians).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | v1 | ||
real(kind=wp), | intent(in), | dimension(3) | :: | v2 |
[rad]
pure function angle_between_vectors(v1,v2) result(ang) implicit none real(wp) :: ang !! [rad] real(wp),dimension(3),intent(in) :: v1 real(wp),dimension(3),intent(in) :: v2 real(wp) :: d,c d = dot_product(v1,v2) c = norm2(cross(v1,v2)) ang = atan2(c,d) end function angle_between_vectors