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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | s |
fraction of the way (0: |
||
| real(kind=wp), | intent(in) | :: | from(3,3) |
(columns: eye, center, up) |
||
| real(kind=wp), | intent(in) | :: | to(3,3) |
(columns: eye, center, up) |
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