time_distance Function

private pure function time_distance(self, t)

The "distance" from time t to the time range [t0, tf]: > 0 outside it (to the nearer end), 0 at its ends, < 0 inside; huge() without times. (OpenFrames' getTimeDistance.)

Type Bound

Trajectory

Arguments

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

the time

Return Value real(kind=wp)


Called by

proc~~time_distance~~CalledByGraph proc~time_distance Trajectory%time_distance proc~chosen_trajectory chosen_trajectory proc~chosen_trajectory->proc~time_distance proc~time_index Trajectory%time_index proc~time_index->proc~time_distance proc~point_at Trajectory%point_at proc~point_at->proc~time_index proc~state_at TrajectoryFollower%state_at proc~state_at->proc~chosen_trajectory proc~state_at->proc~time_index proc~followed_pose followed_pose proc~followed_pose->proc~state_at proc~world_matrix_at ReferenceFrame%world_matrix_at proc~followed_pose->proc~world_matrix_at proc~trajectory_path_position TrajectoryPath%trajectory_path_position proc~trajectory_path_position->proc~point_at proc~update~2 TrajectoryFollower%update proc~update~2->proc~state_at proc~local_matrix_at ReferenceFrame%local_matrix_at proc~local_matrix_at->proc~followed_pose proc~update ReferenceFrame%update proc~update->proc~followed_pose proc~update->proc~update~2 proc~drawable_update DrawableTrajectory%drawable_update proc~drawable_update->proc~update proc~fm_update FrameManager%fm_update proc~fm_update->proc~update proc~sphere_update Sphere%sphere_update proc~sphere_update->proc~update proc~terrain_update TerrainBody%terrain_update proc~terrain_update->proc~update proc~world_matrix_at->proc~local_matrix_at proc~world_matrix_at->proc~world_matrix_at proc~data_to_shown data_to_shown proc~data_to_shown->proc~world_matrix_at proc~to_shown to_shown proc~to_shown->proc~data_to_shown proc~art_point_between art_point_between proc~art_point_between->proc~to_shown proc~to_shown_at to_shown_at proc~to_shown_at->proc~to_shown proc~art_point art_point proc~art_point->proc~to_shown_at proc~art_points art_points proc~art_points->proc~to_shown_at proc~intermediates_by_time intermediates_by_time proc~intermediates_by_time->proc~art_point_between proc~marker_point marker_point proc~marker_point->proc~to_shown_at proc~marker_point->proc~art_point proc~update_ribbon_tail RibbonArtist%update_ribbon_tail proc~update_ribbon_tail->proc~art_point_between proc~update_ribbon_tail->proc~art_point proc~update_tail CurveArtist%update_tail proc~update_tail->proc~art_point_between proc~update_tail->proc~art_point proc~write_segments write_segments proc~write_segments->proc~to_shown_at proc~add_intermediates add_intermediates proc~add_intermediates->proc~intermediates_by_time proc~intermediates_by_data intermediates_by_data proc~add_intermediates->proc~intermediates_by_data proc~intermediates_by_distance intermediates_by_distance proc~add_intermediates->proc~intermediates_by_distance proc~curve_pick curve_pick proc~curve_pick->proc~art_point proc~intermediates_by_data->proc~art_point proc~intermediates_by_distance->proc~art_point proc~marker_update MarkerArtist%marker_update proc~marker_update->proc~marker_point proc~marker_update->proc~add_intermediates proc~update_bounds update_bounds proc~marker_update->proc~update_bounds proc~segment_update SegmentArtist%segment_update proc~segment_update->proc~write_segments proc~update_bounds->proc~art_points proc~write_curve CurveArtist%write_curve proc~write_curve->proc~art_points proc~write_ribbon RibbonArtist%write_ribbon proc~write_ribbon->proc~art_points proc~drawable_pick DrawableTrajectory%drawable_pick proc~drawable_pick->proc~curve_pick

Source Code

    pure real(wp) function time_distance(self, t)
        class(Trajectory), intent(in) :: self
        real(wp), intent(in) :: t                           !! the time
        real(wp) :: t0, tf
        if (self%n_times == 0) then
            time_distance = huge(1.0_wp)
            return
        end if
        t0 = min(self%t(1), self%t(self%n_times))
        tf = max(self%t(1), self%t(self%n_times))
        if (t <= t0) then
            time_distance = t0 - t
        else if (t >= tf) then
            time_distance = t - tf
        else
            time_distance = (t - t0) * (t - tf)
        end if
    end function time_distance