get_area_spherical_polygon Function

public function get_area_spherical_polygon(p1, p4, p2, p3) result(area)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: p1(2)
real(kind=real64), intent(in) :: p4(2)
real(kind=real64), intent(in) :: p2(2)
real(kind=real64), intent(in) :: p3(2)

Return Value real(kind=real64)


Source Code

 function get_area_spherical_polygon(p1,p4,p2,p3) result(area)
    real(real64) :: area
    real(real64), intent(in) :: p1(2),p2(2),p3(2),p4(2)
    
    real(real64) :: e1(3),e2(3),e3(3)
    real(real64) :: ang1,ang2,ang3,ang4

    e1 = convert_to_cart(p1)
    e2 = convert_to_cart(p2)
    e3 = convert_to_cart(p4)
    ang1 = spherical_angles(e1, e2, e3)

    e1 = convert_to_cart(p2)
    e2 = convert_to_cart(p3)
    e3 = convert_to_cart(p1)
    ang2 = spherical_angles(e1, e2, e3)

    e1 = convert_to_cart(p3)
    e2 = convert_to_cart(p4)
    e3 = convert_to_cart(p2)
    ang3 = spherical_angles(e1, e2, e3)

    e1 = convert_to_cart(p4)
    e2 = convert_to_cart(p3)
    e3 = convert_to_cart(p1)
    ang4 = spherical_angles(e1, e2, e3)

    area = ang1 + ang2 + ang3 + ang4 - 2.0d0*MAPL_PI_R8

 end function get_area_spherical_polygon