update_tail Subroutine

private subroutine update_tail(self, t, k, k2)

The tail: from point k (the latest passed) to the point interpolated at time t toward point k2 (the next in time: k + 1, or k - 1 for decreasing times); none if either isn't a point written (before the start, or everything passed).

Type Bound

CurveArtist

Arguments

Type IntentOptional Attributes Name
class(CurveArtist), intent(inout) :: self
real(kind=wp), intent(in) :: t

the current time

integer, intent(in) :: k

the tail's ends (0: none)

integer, intent(in) :: k2

the tail's ends (0: none)


Calls

proc~~update_tail~~CallsGraph proc~update_tail CurveArtist%update_tail distance distance proc~update_tail->distance interface~vkf_line_points_changed vkf_line_points_changed proc~update_tail->interface~vkf_line_points_changed interface~vkf_line_set_range vkf_line_set_range proc~update_tail->interface~vkf_line_set_range proc~art_point art_point proc~update_tail->proc~art_point proc~art_point_between art_point_between proc~update_tail->proc~art_point_between proc~check_status check_status proc~update_tail->proc~check_status proc~line_buffer line_buffer proc~update_tail->proc~line_buffer proc~split_distances split_distances proc~update_tail->proc~split_distances proc~split_points split_points proc~update_tail->proc~split_points proc~tail_colors tail_colors proc~update_tail->proc~tail_colors time_fraction time_fraction proc~update_tail->time_fraction proc~point~2 Trajectory%point proc~art_point->proc~point~2 proc~to_shown_at to_shown_at proc~art_point->proc~to_shown_at proc~point_between Trajectory%point_between proc~art_point_between->proc~point_between proc~to_shown to_shown proc~art_point_between->proc~to_shown proc~transformed transformed proc~art_point_between->proc~transformed interface~vkf_line_points vkf_line_points proc~line_buffer->interface~vkf_line_points interface~vkf_line_colors vkf_line_colors proc~tail_colors->interface~vkf_line_colors is_colored is_colored proc~tail_colors->is_colored proc~point_rgba point_rgba proc~tail_colors->proc~point_rgba proc~point_between->proc~point~2 proc~num_points Trajectory%num_points proc~point_between->proc~num_points proc~time_fraction Trajectory%time_fraction proc~point_between->proc~time_fraction color color proc~point_rgba->color num_colors num_colors proc~point_rgba->num_colors proc~data_to_shown data_to_shown proc~to_shown->proc~data_to_shown proc~moves moves proc~to_shown->proc~moves proc~to_shown_at->proc~to_shown proc~to_shown_at->proc~transformed proc~rigid_inverse rigid_inverse proc~data_to_shown->proc~rigid_inverse proc~world_matrix_at ReferenceFrame%world_matrix_at proc~data_to_shown->proc~world_matrix_at proc~moves->proc~moves proc~is_following ReferenceFrame%is_following proc~moves->proc~is_following proc~num_parents ReferenceFrame%num_parents proc~moves->proc~num_parents proc~parent ReferenceFrame%parent proc~moves->proc~parent proc~num_trajectories TrajectoryFollower%num_trajectories proc~is_following->proc~num_trajectories proc~world_matrix_at->proc~world_matrix_at proc~local_matrix_at ReferenceFrame%local_matrix_at proc~world_matrix_at->proc~local_matrix_at proc~followed_pose followed_pose proc~local_matrix_at->proc~followed_pose proc~frame_matrix frame_matrix proc~local_matrix_at->proc~frame_matrix proc~followed_pose->proc~rigid_inverse proc~followed_pose->proc~world_matrix_at proc~quat_from_matrix quat_from_matrix proc~followed_pose->proc~quat_from_matrix proc~quat_multiply quat_multiply proc~followed_pose->proc~quat_multiply proc~quat_normalize quat_normalize proc~followed_pose->proc~quat_normalize proc~state_at TrajectoryFollower%state_at proc~followed_pose->proc~state_at proc~quat_to_matrix quat_to_matrix proc~frame_matrix->proc~quat_to_matrix proc~chosen_trajectory chosen_trajectory proc~state_at->proc~chosen_trajectory proc~data_valid TrajectoryFollower%data_valid proc~state_at->proc~data_valid proc~interpolate_attitude interpolate_attitude proc~state_at->proc~interpolate_attitude proc~interpolate_position interpolate_position proc~state_at->proc~interpolate_position proc~time_index Trajectory%time_index proc~state_at->proc~time_index proc~wrapped_time wrapped_time proc~state_at->proc~wrapped_time proc~time_distance Trajectory%time_distance proc~chosen_trajectory->proc~time_distance proc~verify_data Trajectory%verify_data proc~data_valid->proc~verify_data proc~attitude~3 Trajectory%attitude proc~interpolate_attitude->proc~attitude~3 proc~num_attitudes Trajectory%num_attitudes proc~interpolate_attitude->proc~num_attitudes proc~quat_slerp quat_slerp proc~interpolate_attitude->proc~quat_slerp proc~interpolate_position->proc~point_between proc~interpolate_position->proc~point~2 proc~interpolate_position->proc~num_points proc~time_index->proc~time_distance proc~time_range~3 Trajectory%time_range proc~wrapped_time->proc~time_range~3

Source Code

    subroutine update_tail(self, t, k, k2)
        class(CurveArtist), intent(inout) :: self
        real(wp), intent(in) :: t                           !! the current time
        integer, intent(in) :: k, k2                        !! the tail's ends (0: none)
        real(c_float), dimension(:,:,:), pointer :: p
        real(wp) :: frac, xyz(3, 2), along
        self%tail_shown = .false.
        if (.not. c_associated(self%tail)) return
        if (min(k, k2) < 1 .or. max(k, k2) > self%n_written) then
            call check_status(vkf_line_set_range(self%tail, 1_c_int, 0_c_int), 'trajectory artists')
            return
        end if
        frac = self%traj%time_fraction(k, k2, t)
        xyz(:, 1) = art_point(self, k, self%sources_)
        xyz(:, 2) = art_point_between(self, k, k2, t, self%sources_)
        call line_buffer(self%tail, p)
        if (.not. associated(p)) return
        call split_points(xyz, p(:, :, 1:2))
        along = merge(1.0_wp, -1.0_wp, k2 > k) * norm2(xyz(:, 2) - xyz(:, 1))   ! (the distance along: in point order)
        call split_distances(self%chain%distance(k) + [0.0_wp, along], p(4, :, 1:2))
        self%tail_from = k
        self%tail_to = k2
        call tail_colors(self, k, k2, frac)
        call check_status(vkf_line_points_changed(self%tail, 2_c_int), 'trajectory artists')
        self%tail_shown = .true.
    end subroutine update_tail