intermediates_by_distance Subroutine

private subroutine intermediates_by_distance(self, n)

Every spacing of arc length (the points joined by straight lines).

Arguments

Type IntentOptional Attributes Name
type(MarkerArtist), intent(inout) :: self
integer, intent(in) :: n

the points


Calls

proc~~intermediates_by_distance~~CallsGraph proc~intermediates_by_distance intermediates_by_distance proc~art_point art_point proc~intermediates_by_distance->proc~art_point proc~counted counted proc~intermediates_by_distance->proc~counted proc~push_intermediate push_intermediate proc~intermediates_by_distance->proc~push_intermediate 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~color_at color_at proc~push_intermediate->proc~color_at proc~is_colored LineChain%is_colored proc~push_intermediate->proc~is_colored num_times num_times proc~color_at->num_times proc~point_rgba_or point_rgba_or proc~color_at->proc~point_rgba_or time_index time_index proc~color_at->time_index proc~to_shown to_shown proc~to_shown_at->proc~to_shown proc~transformed transformed proc~to_shown_at->proc~transformed proc~color~3 Trajectory%color proc~point_rgba_or->proc~color~3 proc~num_colors Trajectory%num_colors proc~point_rgba_or->proc~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~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~2 proc~num_points Trajectory%num_points proc~interpolate_position->proc~num_points proc~point_between Trajectory%point_between proc~interpolate_position->proc~point_between proc~time_index->proc~time_distance proc~time_range~3 Trajectory%time_range proc~wrapped_time->proc~time_range~3 proc~point_between->proc~point~2 proc~point_between->proc~num_points proc~time_fraction Trajectory%time_fraction proc~point_between->proc~time_fraction

Called by

proc~~intermediates_by_distance~~CalledByGraph proc~intermediates_by_distance intermediates_by_distance proc~add_intermediates add_intermediates proc~add_intermediates->proc~intermediates_by_distance proc~marker_update MarkerArtist%marker_update proc~marker_update->proc~add_intermediates

Source Code

    subroutine intermediates_by_distance(self, n)
        type(MarkerArtist), intent(inout) :: self
        integer, intent(in) :: n                            !! the points
        real(wp) :: p(3), frac, t0, t1
        integer :: j
        if (self%next_index == 0) then
            self%next_index = 2
            self%arc = 0.0_wp
            self%prev_arc = 0.0_wp
            self%target = self%spacing_
            self%prev_point = art_point(self, counted(self, 1, n), self%sources_)
        end if
        do j = self%next_index, n
            p = art_point(self, counted(self, j, n), self%sources_)
            self%arc = self%arc + norm2(p - self%prev_point)
            t0 = self%traj%time(counted(self, j - 1, n))
            t1 = self%traj%time(counted(self, j, n))
            do while (self%arc >= self%target)
                frac = (self%target - self%prev_arc) / (self%arc - self%prev_arc)
                call push_intermediate(self, self%prev_point + frac * (p - self%prev_point), t0 + frac * (t1 - t0))
                self%target = self%target + self%spacing_
            end do
            self%prev_arc = self%arc
            self%prev_point = p
        end do
        self%next_index = n + 1
    end subroutine intermediates_by_distance