color_at Function

private function color_at(self, t, own) result(rgba)

The trajectory's color at time t (between points i and i + 1: blended), own for points without one.

Arguments

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

the time; the color for points without one

real(kind=wp), intent(in) :: own(4)

the time; the color for points without one

Return Value real(kind=wp), (4)


Calls

proc~~color_at~~CallsGraph proc~color_at color_at 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~color~3 Trajectory%color proc~point_rgba_or->proc~color~3 proc~num_colors Trajectory%num_colors proc~point_rgba_or->proc~num_colors

Called by

proc~~color_at~~CalledByGraph proc~color_at color_at proc~push_intermediate push_intermediate proc~push_intermediate->proc~color_at proc~intermediates_by_data intermediates_by_data proc~intermediates_by_data->proc~push_intermediate proc~intermediates_by_distance intermediates_by_distance proc~intermediates_by_distance->proc~push_intermediate proc~intermediates_by_time intermediates_by_time proc~intermediates_by_time->proc~push_intermediate proc~add_intermediates add_intermediates proc~add_intermediates->proc~intermediates_by_data proc~add_intermediates->proc~intermediates_by_distance proc~add_intermediates->proc~intermediates_by_time proc~marker_update MarkerArtist%marker_update proc~marker_update->proc~add_intermediates

Source Code

    function color_at(self, t, own) result(rgba)
        type(MarkerArtist), intent(in) :: self
        real(wp), intent(in) :: t, own(4)                   !! the time; the color for points without one
        real(wp) :: rgba(4), c1(4), t0, t1
        integer :: status, i, n
        n = self%traj%num_times()
        status = self%traj%time_index(t, i)
        i = max(1, min(n, i))
        rgba = point_rgba_or(self%traj, i, own)
        if (i >= n) return
        t0 = self%traj%time(i)
        t1 = self%traj%time(i + 1)
        if (t1 == t0) return
        c1 = point_rgba_or(self%traj, i + 1, own)
        rgba = rgba + max(0.0_wp, min(1.0_wp, (t - t0) / (t1 - t0))) * (c1 - rgba)
    end function color_at