The trajectory to follow at time t: the current one if it contains t, else the first that does, else the closest.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(TrajectoryFollower), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
integer function chosen_trajectory(self, t) result(k) type(TrajectoryFollower), intent(in) :: self real(wp), intent(in) :: t !! the time (s) real(wp) :: dist, min_dist integer :: j k = 1 if (self%n == 1) return if (self%current >= 1 .and. self%current <= self%n) then if (self%trajs(self%current)%p%time_distance(t) <= 0.0_wp) then k = self%current return end if end if min_dist = huge(1.0_wp) do j = 1, self%n dist = self%trajs(j)%p%time_distance(t) if (dist <= 0.0_wp) then k = j return else if (dist < min_dist) then min_dist = dist k = j end if end do end function chosen_trajectory