vec_cross_vec Function

private pure elemental function vec_cross_vec(a, b) result(cross)

vec3 x vec3

Type Bound

vector

Arguments

Type IntentOptional Attributes Name
class(vector), intent(in) :: a

Input vector

type(vector), intent(in) :: b

vec3 to cross with

Return Value type(vector)


Source Code

        pure elemental function vec_cross_vec(a, b) result(cross)
            !! vec3 x vec3
            !> Input vector
            class(vector), intent(in) :: a
            !> vec3 to cross with
            type(vector),  intent(in) :: b
            type(vector) :: cross

            cross%x = a%y*b%z - a%z*b%y
            cross%y = -a%x*b%z + a%z*b%x
            cross%z = a%x*b%y - a%y*b%x

        end function vec_cross_vec