camera_between Function

public pure function camera_between(s, from, to) result(cam)

The camera a fraction s (0 to 1) of the way from camera from to camera to (columns: eye, center, up; in one frame's coordinates): the center moved along a straight line, the distance to it changed by the same factor at each step (so far-to-near flights don't rush the near part), and the orientation turned by the shortest rotation.

Arguments

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

fraction of the way (0: from, 1: to)

real(kind=wp), intent(in) :: from(3,3)

(columns: eye, center, up)

real(kind=wp), intent(in) :: to(3,3)

(columns: eye, center, up)

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


Calls

proc~~camera_between~~CallsGraph proc~camera_between camera_between proc~camera_orientation camera_orientation proc~camera_between->proc~camera_orientation proc~quat_normalize quat_normalize proc~camera_between->proc~quat_normalize proc~quat_slerp quat_slerp proc~camera_between->proc~quat_slerp proc~quat_to_matrix quat_to_matrix proc~camera_between->proc~quat_to_matrix proc~cross cross proc~camera_orientation->proc~cross proc~quat_from_matrix quat_from_matrix proc~camera_orientation->proc~quat_from_matrix

Called by

proc~~camera_between~~CalledByGraph proc~camera_between camera_between proc~fly fly proc~fly->proc~camera_between proc~place_camera place_camera proc~place_camera->proc~fly proc~frame WindowProxy%frame proc~frame->proc~place_camera proc~resize WindowProxy%resize proc~resize->proc~frame proc~run WindowProxy%run proc~run->proc~frame

Source Code

    pure function camera_between(s, from, to) result(cam)
        real(wp), intent(in) :: s           !! fraction of the way (0: `from`, 1: `to`)
        real(wp), intent(in) :: from(3,3)   !! (columns: eye, center, up)
        real(wp), intent(in) :: to(3,3)     !! (columns: eye, center, up)
        real(wp) :: cam(3,3)
        real(wp) :: q0(4), q1(4), m(3,3), d0, d1, d, c(3)
        call camera_orientation(from, q0, d0)
        call camera_orientation(to, q1, d1)
        c = from(:, 2) + s * (to(:, 2) - from(:, 2))
        d = d0 * (d1 / d0)**s
        m = quat_to_matrix(quat_normalize(quat_slerp(s, q0, q1)))      ! columns: right, up, back
        cam(:, 1) = c + d * m(:, 3)
        cam(:, 2) = c
        cam(:, 3) = m(:, 2)
    end function camera_between