reflect Subroutine

private subroutine reflect(I, N)

get vector of reflected photon

Arguments

Type IntentOptional Attributes Name
type(vector), intent(inout) :: I

incident vector

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

normal vector


Source Code

    subroutine reflect(I, N)
    !! get vector of reflected photon

        !> incident vector
        type(vector), intent(INOUT) :: I
        !> normal vector
        type(vector), intent(IN)    :: N

        type(vector) :: R

        R = I - 2._wp * (N .dot. I) * N
        I = R

    end subroutine reflect