AssembleTrajectories Module

Module contents

template<typename TrajectoryT, typename PointIteratorT>
class AssembleTrajectories

Assemble time-sorted points into trajectories.

We often receive input data as sequences of points sorted by timestamp. In order to manipulate these data sets as trajectories instead of as isolated points we must perform some sort of connect-the-dots operation to group them together. This class implements that operation.

Suppose for the sake of argument that our input is sorted first by object ID and second by increasing timestamp. Now consider the block of points corresponding to a single object ID. We divide that into one or more trajectories as follows:

  • If too much time (as specified by the separation_time parameter) has elapsed between one point and the next, one trajectory has ended and another begins.

  • If too much distance (as specifide by the separation_distance parameter) lies between one point and the next, one trajectory has ended and another begins.

We implement AssembleTrajectories as an iterator. It consumes an input stream of points sorted by timestamp (not by object ID) and produces complete trajectories. Internally, it keeps track of all the object IDs seen recently and applies the process above to identify and emit complete trajectories.

We can also set a third parameter (minimum_trajectory_length) that silently rejects trajectories that do not contain enough points to be interesting.

Public Types

typedef TrajectoryT trajectory_type
typedef trajectory_type::point_type point_type
typedef AssembleTrajectoriesIterator<point_type, PointIteratorT, trajectory_type> iterator

Public Functions

AssembleTrajectories()
AssembleTrajectories(PointIteratorT rangeBegin, PointIteratorT rangeEnd)
AssembleTrajectories(AssembleTrajectories const &other)
AssembleTrajectories &operator=(AssembleTrajectories const &other)
virtual ~AssembleTrajectories()
bool operator==(AssembleTrajectories const &other) const
bool operator!=(AssembleTrajectories const &other) const
iterator begin()
iterator end()
void set_input(PointIteratorT const &forefront, PointIteratorT const &rearguard)
void set_separation_time(Duration const &d)
void set_separation_distance(double d)
void set_minimum_trajectory_length(std::size_t len)
void set_cleanup_interval(int points_between_cleanup)
Duration separation_time() const
double separation_distance() const
std::size_t minimum_trajectory_length() const

Protected Functions

virtual void set_default_configuration()

Private Members

PointIteratorT PointBegin
PointIteratorT PointEnd
Duration SeparationTime
double SeparationDistance
std::size_t MinimumTrajectoryLength
int CleanupInterval