angle_between_vectors Function

public pure function angle_between_vectors(v1, v2) result(ang)

The angle between two vectors (in radians).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(3) :: v1
real(kind=wp), intent(in), dimension(3) :: v2

Return Value real(kind=wp)

[rad]


Calls

proc~~angle_between_vectors~~CallsGraph proc~angle_between_vectors vector_module::angle_between_vectors proc~cross vector_module::cross proc~angle_between_vectors->proc~cross

Called by

proc~~angle_between_vectors~~CalledByGraph proc~angle_between_vectors vector_module::angle_between_vectors proc~sphere_of_influence_earth_moon orbital_mechanics_module::sphere_of_influence_earth_moon proc~sphere_of_influence_earth_moon->proc~angle_between_vectors

Source Code

    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