rotate_y Function

public function rotate_y(angle) result(r)

Uses

    • utils

rotation in the y-axis function from here

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: angle

Angle to rotate by

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


Source Code

    function rotate_y(angle) result(r)
        !! rotation in the y-axis function from [here](https://inspirnathan.com/posts/54-shadertoy-tutorial-part-8/)

        use utils, only : deg2rad
        
        !> Angle to rotate by
        real(kind=wp), intent(IN) :: angle

        real(kind=wp) :: r(4, 4), c, s, a

        a = deg2rad(angle)
        c = cos(a)
        s = sin(a)

        r(:, 1) = [c,  0._wp, s,  0._wp]
        r(:, 2) = [0._wp, 1._wp,  0._wp, 0._wp]
        r(:, 3) = [-s,  0._wp,  c,  0._wp]
        r(:, 4) = [0._wp, 0._wp,  0._wp, 1._wp]

    end function rotate_y