Commits

bergsoe committed f180e4c

Trajectory construction.

  • Participants
  • Parent commits 7ac34fa

Comments (0)

Files changed (2)

         (fun s -> (ip s).q)
 
   let of_path interpolate path =
-    let rev_trajectories =
-      PaplPath.fold_adjacent
-        (fun x0 x1 acc ->
-           let traj = of_interpolate interpolate x0 x1 in
-             traj :: acc)
-        path
-        []
-    in
-    let trajectories = List.rev rev_trajectories in
-    let t0 = PaplTrajectory.t0 (List.hd trajectories)
-    in PaplTrajectory.of_list ~t0:t0 trajectories
+    let trajectories = PaplPath.map_adjacent
+      (fun x0 x1 -> of_interpolate interpolate x0 x1)
+      path in
+    let t0 = (List.hd path).time in
+      PaplTrajectory.of_list ~t0:t0 trajectories
 end
 
 module Planner = struct
 module Trajectory : sig
   val of_interpolate :
     'a t PaplInterpolate.t ->
-    'a t -> 'a t -> 'a PaplTrajectory.t
+    'a t ->
+    'a t ->
+    'a PaplTrajectory.t
   (** [of_interpolate interpolate a b] constructs a trajectory on the range
       [(a.time, b.time)] using [interpolate] to interpolate from [a] to [b].
   *)
 
   val of_path : 'a t PaplInterpolate.t -> 'a t list -> 'a PaplTrajectory.t
-(** The trajectory [of_time_path ?t0 interpolate path] passes through the
-    elements of [path], reaching each element [x] of the path at time [t0 x].
+(** The trajectory [of_path interpolate path] passes through the elements of
+    [path], reaching each element [x] of [path] at time [x.time].
 
-    The start of the trajectory is thus [t0 (List.hd path)].
-
-    The elements of [path] must be ordered by time.
+    The elements of [path] must have increasing time values.
 *)
 end