This function calculate the cross product of two 3D vector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a(3) |
input vector a |
||
real(kind=rk), | intent(in) | :: | b(3) |
input vector b |
resulting cross produkt
pure function cross_product3D(a, b) result( cross )
! ---------------------------------------------------------------------------
!> resulting cross produkt
real(kind=rk) :: cross(3)
!> input vector a
real(kind=rk), intent(in) :: a(3)
!> input vector b
real(kind=rk), intent(in) :: b(3)
! ---------------------------------------------------------------------------
cross(1) = a(2) * b(3) - a(3) * b(2)
cross(2) = a(3) * b(1) - a(1) * b(3)
cross(3) = a(1) * b(2) - a(2) * b(1)
end function cross_product3D