translate Function

public function translate(o) result(out)

Returns the Translation matrix for a given vector translation.

Arguments

Type IntentOptional Attributes Name
type(vector), intent(in) :: o

Vector to translate by.

Return Value real(kind=wp), (4,4)


Source Code

    function translate(o) result(out)
        !! Returns the Translation matrix for a given vector translation.

        !> Vector to translate by.
        type(vector), intent(IN) :: o

        real(kind=wp) :: out(4, 4)

        out(:, 1) = [1._wp, 0._wp, 0._wp, o%x] 
        out(:, 2) = [0._wp, 1._wp, 0._wp, o%y] 
        out(:, 3) = [0._wp, 0._wp, 1._wp, o%z] 
        out(:, 4) = [0._wp, 0._wp, 0._wp, 1._wp] 

    end function translate