get_camera Subroutine

private subroutine get_camera(self, eye, center, up, in_root)

The camera of the view shown (from the last frame): eye, center and up in the view frame's coordinates (OpenFrames' trackball getTransformation), or in its root frame's if in_root. Zero before the window's first frame.

Type Bound

WindowProxy

Arguments

Type IntentOptional Attributes Name
class(WindowProxy), intent(in) :: self
real(kind=wp), intent(out) :: eye(3)

view frame's coordinates (or root's)

real(kind=wp), intent(out) :: center(3)

view frame's coordinates (or root's)

real(kind=wp), intent(out) :: up(3)

view frame's coordinates (or root's)

logical, intent(in), optional :: in_root

true: in the root frame's coordinates (default: the view frame's)


Calls

proc~~get_camera~~CallsGraph proc~get_camera WindowProxy%get_camera interface~vkf_viewer_get_look_at vkf_viewer_get_look_at proc~get_camera->interface~vkf_viewer_get_look_at proc~is_open WindowProxy%is_open proc~get_camera->proc~is_open proc~rigid_inverse rigid_inverse proc~get_camera->proc~rigid_inverse proc~transform_camera transform_camera proc~get_camera->proc~transform_camera proc~world_to_view View%world_to_view proc~get_camera->proc~world_to_view proc~world_to_view->proc~rigid_inverse proc~frame_to_root frame_to_root proc~world_to_view->proc~frame_to_root proc~identity_matrix identity_matrix proc~world_to_view->proc~identity_matrix proc~quat_from_vectors quat_from_vectors proc~world_to_view->proc~quat_from_vectors proc~quat_to_matrix quat_to_matrix proc~world_to_view->proc~quat_to_matrix proc~rotated rotated proc~world_to_view->proc~rotated proc~translation_matrix translation_matrix proc~world_to_view->proc~translation_matrix proc~frame_to_root->proc~rigid_inverse proc~world_matrix ReferenceFrame%world_matrix proc~frame_to_root->proc~world_matrix proc~cross cross proc~quat_from_vectors->proc~cross proc~quat_normalize quat_normalize proc~quat_from_vectors->proc~quat_normalize proc~translation_matrix->proc~identity_matrix proc~world_matrix->proc~world_matrix proc~local_matrix ReferenceFrame%local_matrix proc~world_matrix->proc~local_matrix proc~frame_matrix frame_matrix proc~local_matrix->proc~frame_matrix proc~frame_matrix->proc~quat_to_matrix

Called by

proc~~get_camera~~CalledByGraph proc~get_camera WindowProxy%get_camera proc~view_camera view_camera proc~view_camera->proc~get_camera proc~cursor_ray WindowProxy%cursor_ray proc~cursor_ray->proc~view_camera proc~screen_position WindowProxy%screen_position proc~screen_position->proc~view_camera proc~window_pick WindowProxy%window_pick proc~window_pick->proc~view_camera proc~drag_handle drag_handle proc~drag_handle->proc~cursor_ray proc~grab_handle grab_handle proc~grab_handle->proc~cursor_ray proc~hover_handle hover_handle proc~hover_handle->proc~window_pick proc~dispatch_event dispatch_event proc~dispatch_event->proc~drag_handle proc~dispatch_event->proc~grab_handle proc~dispatch_event->proc~hover_handle proc~release_handle release_handle proc~dispatch_event->proc~release_handle proc~release_handle->proc~hover_handle proc~dispatch_events dispatch_events proc~dispatch_events->proc~dispatch_event proc~frame WindowProxy%frame proc~frame->proc~dispatch_events proc~resize WindowProxy%resize proc~resize->proc~frame proc~run WindowProxy%run proc~run->proc~frame

Source Code

    subroutine get_camera(self, eye, center, up, in_root)
        class(WindowProxy), intent(in) :: self
        real(wp), intent(out) :: eye(3), center(3), up(3)   !! view frame's coordinates (or root's)
        logical, intent(in), optional :: in_root            !! true: in the root frame's coordinates (default: the view frame's)
        real(wp) :: cam(3,3)
        eye = 0.0_wp
        center = 0.0_wp
        up = 0.0_wp
        if (.not. self%is_open() .or. .not. associated(self%shown)) return
        if (vkf_viewer_get_look_at(self%viewer_, eye, center, up) /= 0) return
        if (.not. present(in_root)) return
        if (.not. in_root) return
        cam = transform_camera(rigid_inverse(self%shown%world_to_view()), reshape([eye, center, up], [3, 3]))
        eye = cam(:, 1)
        center = cam(:, 2)
        up = cam(:, 3)
    end subroutine get_camera