changeset 1159:e1e7acef8eab

moved trajectory management library into Traffic Intelligence
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 22 Feb 2021 22:09:35 -0500
parents 7eb972942f22
children 3a6b00f13e95
files c/Makefile trajectorymanagement/CMakeLists.txt trajectorymanagement/src/CanberraMetric.h trajectorymanagement/src/ChebyshevMetric.h trajectorymanagement/src/DBSQLiteAccess.cpp trajectorymanagement/src/DBSQLiteAccess.h trajectorymanagement/src/DTWMetric.h trajectorymanagement/src/EuclideanMetric.h trajectorymanagement/src/HausdorffMetric.h trajectorymanagement/src/HuMetric.h trajectorymanagement/src/LCSMetric.h trajectorymanagement/src/ManhattanMetric.h trajectorymanagement/src/Metric.h trajectorymanagement/src/MinimumMetric.h trajectorymanagement/src/PointOperations.h trajectorymanagement/src/SquaredEuclideanMetric.h trajectorymanagement/src/Trajectory.h trajectorymanagement/src/TrajectoryDBAccess.h trajectorymanagement/src/TrajectoryDBAccessBlob.h trajectorymanagement/src/TrajectoryDBAccessList.h trajectorymanagement/src/TrajectoryElement.h trajectorymanagement/src/TrajectoryExceptions.h trajectorymanagement/src/TrajectoryWriter.h trajectorymanagement/src/doxygen.config trajectorymanagement/test/CanberraMetricTest.cpp trajectorymanagement/test/CanberraMetricTest.h trajectorymanagement/test/ChebyshevMetricTest.cpp trajectorymanagement/test/ChebyshevMetricTest.h trajectorymanagement/test/DBSQLiteAccessTest.cpp trajectorymanagement/test/DBSQLiteAccessTest.h trajectorymanagement/test/DTWMetricTest.cpp trajectorymanagement/test/DTWMetricTest.h trajectorymanagement/test/EuclideanMetricTest.cpp trajectorymanagement/test/EuclideanMetricTest.h trajectorymanagement/test/HausdorffMetricTest.cpp trajectorymanagement/test/HausdorffMetricTest.h trajectorymanagement/test/HuMetricTest.cpp trajectorymanagement/test/HuMetricTest.h trajectorymanagement/test/LCSMetricTest.cpp trajectorymanagement/test/LCSMetricTest.h trajectorymanagement/test/ManhattanMetricTest.cpp trajectorymanagement/test/ManhattanMetricTest.h trajectorymanagement/test/MinimumMetricTest.cpp trajectorymanagement/test/MinimumMetricTest.h trajectorymanagement/test/PointOperationsTest.cpp trajectorymanagement/test/PointOperationsTest.h trajectorymanagement/test/SquaredEuclideanMetricTest.cpp trajectorymanagement/test/SquaredEuclideanMetricTest.h trajectorymanagement/test/TestRunner.cpp trajectorymanagement/test/TrajectoryDBAccessBlobTest.h trajectorymanagement/test/TrajectoryDBAccessListTest.h trajectorymanagement/test/TrajectoryDBAccessTest.h trajectorymanagement/test/TrajectoryElementTest.h trajectorymanagement/test/TrajectoryTest.cpp trajectorymanagement/test/TrajectoryTest.h
diffstat 55 files changed, 8686 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/c/Makefile	Tue Jan 05 10:45:39 2021 -0500
+++ b/c/Makefile	Mon Feb 22 22:09:35 2021 -0500
@@ -1,6 +1,6 @@
 EXE_DIR=../bin
 SCRIPTS_DIR=../scripts
-TRAJECTORYMANAGEMENT_DIR=../../trajectorymanagementandanalysis/trunk/src/TrajectoryManagementAndAnalysis
+TRAJECTORYMANAGEMENT_DIR=../trajectorymanagement
 
 CXX = g++
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/CMakeLists.txt	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,15 @@
+CMAKE_MINIMUM_REQUIRED( VERSION 3.1 )
+
+PROJECT( TrajectoryManagementAndAnalysis )
+FIND_PACKAGE(OpenCV REQUIRED)
+
+FIND_LIBRARY(SQLite3_LIBS sqlite3)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+
+#SET(CMAKE_CXX_FLAGS "-g -Wall -DNDEBUG -fpermissive -std=c++11")
+
+include_directories( ${OpenCV_INCLUDE_DIRS} )
+
+ADD_LIBRARY(TrajectoryManagementAndAnalysis src/DBSQLiteAccess.cpp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/CanberraMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,86 @@
+#ifndef CANBERRAMETRIC_H_
+#define CANBERRAMETRIC_H_
+
+#include "Metric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * CanberraMetric class.
+ *
+ * The Canberra metric measures the similarity between two trajectories.
+ */
+template<typename Tr>
+class CanberraMetric: public Metric<Tr, double>
+{
+public:
+	/**
+	 * Compute distance between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, double &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		result = double(0);
+		
+		if (nbOfPoints == std::numeric_limits<unsigned int>::max())
+		  checkTrajectoryLength(a->size(), b->size());
+
+		double diff = double(0);
+		for (unsigned int i = 0; i < a->size() and i < nbOfPoints; ++i)
+		{
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> A(a->getPoint(i));
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> B(b->getPoint(i));
+			diff += calculate(A.x, B.x);
+			diff += calculate(A.y, B.y);
+			diff += calculate(A.z, B.z);
+		}
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a != b || a == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+
+	/**
+	 * Compute similarity between two values.
+	 *
+	 * @param a first value
+	 * @param b second value
+	 * @return result
+	 */
+	double calculate(double a, double b)
+	{
+		double result = std::abs(a - b);
+
+		a = std::fabs(a);
+		b = std::fabs(b);
+
+		a += b;
+
+		if (a == 0)
+		{
+			return 0;
+		}
+
+		result /= a;
+
+		return result;
+	}
+};
+
+#endif /* CANBERRAMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/ChebyshevMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,60 @@
+#ifndef CHEBYSHEVMETRIC_H_
+#define CHEBYSHEVMETRIC_H_
+
+#include "Metric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * ChebyshevMetric class.
+ *
+ * The Chebyshev metric measures the similarity between two trajectories.
+ * This metric represents the largest distance of all points in every dimension. Expressed in meters.
+ */
+template<typename Tr, typename To>
+class ChebyshevMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Compute distance between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+  {
+		result = To(0);
+
+		if (nbOfPoints == std::numeric_limits<unsigned int>::max())
+		  checkTrajectoryLength(a->size(), b->size());
+
+		To diff = abs((a->getPoint(0) - b->getPoint(0)).x);
+		for (unsigned int i = 0; i < a->size() and i < nbOfPoints ; ++i)
+		{
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> p(a->getPoint(i) - b->getPoint(i));
+			diff = std::max(diff, abs(p.x));
+			diff = std::max(diff, abs(p.y));
+			diff = std::max(diff, abs(p.z));
+		}
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a != b || a == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+};
+
+#endif /* CHEBYSHEVMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/DBSQLiteAccess.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,260 @@
+#include "DBSQLiteAccess.h"
+#include "TrajectoryElement.h"
+
+#include <cassert>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
+DBSQLiteAccess::DBSQLiteAccess()
+{
+	db = 0;
+	connected = false;
+}
+
+DBSQLiteAccess::~DBSQLiteAccess()
+{
+	if (connected)
+	{
+		disconnect();
+	}
+}
+
+bool DBSQLiteAccess::connect(const char *database)
+{
+	if (connected)
+	{
+		return false;
+	}
+
+	int success = sqlite3_open(database, &db);
+	connected = (success == SQLITE_OK);
+	if (!connected)
+	{
+		sqlite3_close(db);
+	} else {
+	  connected = connected && executeStatement("PRAGMA synchronous = OFF") && executeStatement("PRAGMA journal_mode = MEMORY");
+	}
+	return connected;
+}
+
+bool DBSQLiteAccess::isConnected()
+{
+	return connected;
+}
+
+bool DBSQLiteAccess::disconnect()
+{
+	if (connected)
+	{
+		int success = sqlite3_close(db);
+		if (success == SQLITE_OK)
+		{
+			db = 0;
+			connected = false;
+		}
+	}
+	return connected == false;
+}
+
+int DBSQLiteAccess::sqliteErrCode()
+{
+	return sqlite3_errcode(db);
+}
+
+const char *DBSQLiteAccess::sqliteErrMsg()
+{
+	return sqlite3_errmsg(db);
+}
+
+bool DBSQLiteAccess::executeStatement(const char *statement)
+{
+	if (!connected)
+	{
+		return false;
+	}
+
+	char *errorMsg = 0;
+	int errorCode = sqlite3_exec(db, statement, 0, 0, &errorMsg);
+	return errorCode == SQLITE_OK;
+}
+
+bool DBSQLiteAccess::executeStatementGetSingleValue(const char *statement, string& result)
+{
+	char **dbResult = 0;
+	int nrows, ncols;
+	bool success = executeStatement(statement, &dbResult, nrows, ncols);
+
+	if (success && nrows == 1 && ncols == 1 && dbResult[1] != NULL)
+	{
+		result = *dbResult[1];
+	}
+	else
+	{
+		success = false;
+	}
+
+	sqlite3_free_table(dbResult);
+
+	return success;
+}
+
+bool DBSQLiteAccess::executeStatementGetMatrix(const char *statement, vector<vector<string> >& result)
+{
+	char **dbResult = 0;
+	int nrows, ncols;
+	bool success = executeStatement(statement, &dbResult, nrows, ncols);
+
+	result.resize(nrows);
+	if (success)
+	{
+		for (int row = 0; row < nrows; ++row)
+		{
+		  result[row].resize(ncols);
+			for (int col = 0; col < ncols; ++col)
+			{
+				if (dbResult[ncols + row * ncols + col] != NULL)
+				{
+					result[row][col] = dbResult[ncols + row * ncols + col];
+				}
+				else
+				  {
+				    result[row][col] = string();
+				  }
+			}
+		}
+	}
+
+	sqlite3_free_table(dbResult);
+
+	return success;
+}
+
+bool DBSQLiteAccess::executeStatementSelect(vector<vector<string> >& result, const char *statement) {
+  result.clear();
+  sqlite3_stmt *preparedStatement;
+  if (sqlite3_prepare_v2(db, statement, -1, &preparedStatement, 0) == SQLITE_OK) {
+    int nCols = sqlite3_column_count(preparedStatement);
+
+    int dbResult = sqlite3_step(preparedStatement);
+    while (dbResult == SQLITE_ROW) {
+      vector<string> row(nCols);
+      for(int col = 0; col < nCols; col++) {
+	row[col] = (char*)(sqlite3_column_text(preparedStatement, col));
+      }
+      result.push_back(row);
+
+      dbResult = sqlite3_step(preparedStatement);
+    }
+  }
+
+  return (sqlite3_finalize(preparedStatement) == SQLITE_OK);
+}
+
+bool DBSQLiteAccess::executeStatementSelectIntegers(std::vector<int>& result, const char *statement) {
+  result.clear();
+  sqlite3_stmt *preparedStatement;
+  if (sqlite3_prepare_v2(db, statement, -1, &preparedStatement, 0) == SQLITE_OK) {
+    assert(sqlite3_column_count(preparedStatement) == 1);
+    int dbResult = sqlite3_step(preparedStatement);
+    while (dbResult == SQLITE_ROW) {
+      result.push_back(sqlite3_column_int(preparedStatement, 0));
+      dbResult = sqlite3_step(preparedStatement);
+    }
+  }
+  return (sqlite3_finalize(preparedStatement) == SQLITE_OK);
+}
+
+bool DBSQLiteAccess::executeStatementSelectMultipleIntegers(std::vector<std::vector<int> >& result, const char *statement) {
+  result.clear();
+  sqlite3_stmt *preparedStatement;
+  if (sqlite3_prepare_v2(db, statement, -1, &preparedStatement, 0) == SQLITE_OK) {
+    int nColumns = sqlite3_column_count(preparedStatement);
+    vector<int> tmp(nColumns);
+    int dbResult = sqlite3_step(preparedStatement);
+    while (dbResult == SQLITE_ROW) {
+      for (int i=0; i<nColumns; ++i)
+	tmp[i]=sqlite3_column_int(preparedStatement, i);
+      result.push_back(tmp);
+      dbResult = sqlite3_step(preparedStatement);
+    }
+  }
+  return (sqlite3_finalize(preparedStatement) == SQLITE_OK);
+}
+
+bool DBSQLiteAccess::executeStatementSelectTrajectoryElements(map<int, vector<TrajectoryElement<Point2f> > >& trajectoryElements, const char *statement) {
+  trajectoryElements.clear();
+  sqlite3_stmt *preparedStatement;
+  if (sqlite3_prepare_v2(db, statement, -1, &preparedStatement, 0) == SQLITE_OK) {
+    assert(sqlite3_column_count(preparedStatement) == 4);
+
+    int dbResult = sqlite3_step(preparedStatement);
+    while (dbResult == SQLITE_ROW) {
+      int id =  sqlite3_column_int(preparedStatement, 0);
+      int frameNumber = sqlite3_column_int(preparedStatement, 1);
+      float x =  static_cast<float>(sqlite3_column_double(preparedStatement, 2));
+      float y =  static_cast<float>(sqlite3_column_double(preparedStatement, 3));
+      trajectoryElements[id].push_back(TrajectoryElement<Point2f>(frameNumber, Point2f(x, y)));
+
+      dbResult = sqlite3_step(preparedStatement);
+    }
+  }
+
+  return (sqlite3_finalize(preparedStatement) == SQLITE_OK);
+}
+
+bool DBSQLiteAccess::executeStatementSelectPrototypeMatches(multimap<int,int>& matches, const char *statement) {
+  sqlite3_stmt *preparedStatement;
+  if (sqlite3_prepare_v2(db, statement, -1, &preparedStatement, 0) == SQLITE_OK) {
+    assert(sqlite3_column_count(preparedStatement) == 2); // à vérifier
+
+    int dbResult = sqlite3_step(preparedStatement);
+    while (dbResult == SQLITE_ROW) {
+      int prototype_id =  sqlite3_column_int(preparedStatement, 0);
+      int trajectory_id = sqlite3_column_int(preparedStatement, 1);
+      matches.insert(pair<int,int>(prototype_id,trajectory_id));
+
+      dbResult = sqlite3_step(preparedStatement);
+    }
+  }
+
+  return (sqlite3_finalize(preparedStatement) == SQLITE_OK);
+}
+
+
+bool DBSQLiteAccess::begin()
+{
+	const char *stmt = "begin transaction";
+	return executeStatement(stmt);
+}
+
+bool DBSQLiteAccess::end()
+{
+	const char *stmt = "end transaction";
+	return executeStatement(stmt);
+}
+
+bool DBSQLiteAccess::rollback()
+{
+	const char *stmt = "rollback;";
+	return executeStatement(stmt);
+}
+
+bool DBSQLiteAccess::commit()
+{
+	const char *stmt = "commit;";
+	return executeStatement(stmt);
+}
+
+bool DBSQLiteAccess::executeStatement(const char *statement, char ***result, int &nrows, int &ncols)
+{
+	if (!connected)
+	{
+		return false;
+	}
+
+	char *errorMsg = NULL;
+	int errorCode = sqlite3_get_table(db, statement, result, &nrows, &ncols, &errorMsg);
+	return errorCode == SQLITE_OK;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/DBSQLiteAccess.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,185 @@
+#ifndef DBSQLITEACCESS_H_
+#define DBSQLITEACCESS_H_
+
+#include "opencv2/core/core.hpp"
+
+#include <sqlite3.h>
+
+#include <sstream>
+#include <string>
+#include <vector>
+#include <map>
+
+template<typename T> class TrajectoryElement;
+
+/**
+ * DBSQLiteAccess class.
+ *
+ * The DBSQLiteAccess class allows to perform basic operations on the database like connecting, disconnecting, creating a table, deleting a table or executing other statements.
+ */
+class DBSQLiteAccess
+{
+public:
+	/**
+	 * Constructor.
+	 */
+	DBSQLiteAccess();
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~DBSQLiteAccess();
+
+	/**
+	 * Connect to the database.
+	 *
+	 * @param[in] database name of the database
+	 * @return information whether the operation was successful
+	 */
+	bool connect(const char *database);
+
+	/**
+	 * Inform whether the connection to the database has been established.
+	 *
+	 * @return information whether the connection to the database has been established
+	 */
+	bool isConnected();
+
+	/**
+	 * Disconnect from the database.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool disconnect();
+
+	int sqliteErrCode();
+
+	/**
+	 * Get error message.
+	 *
+	 * @return last error message
+	 */
+	const char *sqliteErrMsg();
+
+	/**
+	 * Execute statement.
+	 *
+	 * @param[in] statement statement
+	 * @return information whether the operation was successful
+	 */
+	bool executeStatement(const char *statement);
+
+	bool executeStatementGetSingleValue(const char *statement, std::string& result);
+
+	template<typename T>
+	bool executeStatementGetSingleValue(const char *statement, T& result)
+	{
+		char **dbResult = 0;
+		int nrows, ncols;
+		bool success = executeStatement(statement, &dbResult, nrows, ncols);
+
+		if (success && nrows == 1 && ncols == 1 && dbResult[1] != NULL)
+		{
+		  std::istringstream is(dbResult[1]);
+		  is >> result;
+		}
+		else
+		{
+			success = false;
+		}
+
+		sqlite3_free_table(dbResult);
+
+		return success;
+	}
+
+	/**
+	 * Execute statement and get results.
+	 *
+	 * @param[in] statement statement
+	 * @return result as a matrix of strings
+	 */
+	bool executeStatementGetMatrix(const char *statement, std::vector<std::vector<std::string> >& result);
+
+	/**
+	 * Execute statement and get results of a select.
+	 *
+	 * @param[in] statement statement
+	 * @return result as a matrix of strings
+	 */
+	bool executeStatementSelect(std::vector<std::vector<std::string> >& result, const char *statement);
+
+	/** Execute statement and get result of select as a list of integers (eg trajectory ids) */
+	bool executeStatementSelectIntegers(std::vector<int>& result, const char *statement);
+
+	/** Execute statement and get result of select as a list of integers (more than one per row, eg trajectory first and last frames) */
+	bool executeStatementSelectMultipleIntegers(std::vector<std::vector<int> >& result, const char *statement);
+
+	/**
+	 * Execute statement and get results of a select for two integers followed by two floats.
+	 *
+	 * @param[in] statement statement
+	 * @return result as a matrix of strings
+	 */
+	bool executeStatementSelectTrajectoryElements(std::map<int, std::vector<TrajectoryElement<cv::Point2f> > >& trajectoryElements, const char *statement);
+
+/**
+	 * Execute statement and get results of a select for two integers (prototype id and matched trajectory id)
+	 *
+	 * @param[in] 
+	 * @return result as a matrix of strings
+	 */
+	bool executeStatementSelectPrototypeMatches(std::multimap<int,int>& matches, const char *statement);
+
+	/**
+	 * Execute begin transaction command.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool begin();
+
+	/**
+	 * Execute end transaction command.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool end();
+
+	/**
+	 * Execute rollback transaction command.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool rollback();
+
+	/**
+	 * Execute commit transaction command.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool commit();
+
+private:
+	/**
+	 * Pointer to SQLite3 class.
+	 */
+	sqlite3 *db;
+
+	/**
+	 * Information whether a connection has been established.
+	 */
+	bool connected;
+
+	/**
+	 * Execute statement and get result.
+	 *
+	 * @param[in] statement statement
+	 * @param[out] result results
+	 * @param[out] nrows of rows in the returned data \a result
+	 * @param[out] ncols of columns in the returned data \a result
+	 * @return information whether the operation was successful
+	 */
+	bool executeStatement(const char *statement, char ***result, int &nrows, int &ncols);
+};
+
+#endif /* DBSQLITEACCESS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/DTWMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,115 @@
+#ifndef DTWMETRIC_H_
+#define DTWMETRIC_H_
+
+#include "Metric.h"
+
+/**
+ * DTWMetric class.
+ *
+ * The Dynamic Time Warping metric measures the similarity between two trajectories.
+ */
+template<typename Tr, typename To>
+class DTWMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Constructor.
+	 */
+	DTWMetric()
+	{
+		maxDTWValue = (std::numeric_limits<To>::max()) / To(2);
+	}
+
+	/**
+	 * Set maximum value that occurs during the calculation process.
+	 *
+	 * @param[in] maxDTWValue maximum value
+	 */
+	bool setMaxDTWValue(To maxDTWValue)
+	{
+		if (maxDTWValue >= 0.0)
+		{
+			this->maxDTWValue = maxDTWValue;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Set maximum value that occurs during the calculation process.
+	 *
+	 * @param[in] imgSize image size
+	 * @param[in] eps machine epsilon
+	 */
+	bool setMaxDTWValue(CvSize &imgSize, double eps)
+	{
+		if (imgSize.width > 0 && imgSize.height > 0 && eps > 0)
+		{
+			cv::Point_<int> p(imgSize.width, imgSize.height);
+			maxDTWValue = std::numeric_limits<To>::max() - norm(p) - eps;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories.
+	 */
+	void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		To DTW[a->size() + 1][b->size() + 1];
+
+		{ //initialization
+			for (unsigned int i = 0; i <= a->size(); ++i)
+			{
+				DTW[i][0] = maxDTWValue;
+			}
+
+			for (unsigned int j = 0; j <= b->size(); ++j)
+			{
+				DTW[0][j] = maxDTWValue;
+			}
+
+			DTW[0][0] = 0.0;
+		}
+
+		{ //algorithm
+			for (unsigned int i = 1; i <= a->size(); ++i)
+			{
+				for (unsigned int j = 1; j <= b->size(); ++j)
+				{
+					To smallest = min(DTW[i - 1][j], DTW[i][j - 1], DTW[i - 1][j - 1]);
+					cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i-1)).x)> p(a->getPoint(i - 1) - b->getPoint(j - 1));
+					To distance = std::sqrt(std::pow(p.x, 2) + std::pow(p.y, 2) + std::pow(p.z, 2));
+					DTW[i][j] = std::min(smallest + distance, maxDTWValue);
+				}
+			}
+		}
+
+		result = DTW[a->size()][b->size()];
+	}
+
+private:
+	/**
+	 * Maximum value that occurs during the calculation process.
+	 */
+	To maxDTWValue;
+
+	/**
+	 * Compute the minimum of \a a, \a b and \c c.
+	 *
+	 * @param[in] a input parameter
+	 * @param[in] b input parameter
+	 * @param[in] c input parameter
+	 */
+	To min(To a, To b, To c)
+	{
+		return std::min(std::min(a, b), c);
+	}
+};
+
+#endif /* DTWMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/EuclideanMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,57 @@
+#ifndef EUCLIDIANMETRIC_H_
+#define EUCLIDIANMETRIC_H_
+
+#include "SquaredEuclideanMetric.h"
+#include "TrajectoryExceptions.h"
+
+/**
+ * EuclideanMetric class.
+ *
+ * The Euclidean metric measures the distance between two trajectories.
+ */
+template<typename Tr, typename To>
+class EuclideanMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Constructor.
+	 */
+	EuclideanMetric()
+	{
+	  squaredEuclideanMetric = new SquaredEuclideanMetric<Tr, To> ();
+	}
+
+	/**
+	 * Destructor.
+	 */
+	~EuclideanMetric()
+	{
+		delete squaredEuclideanMetric;
+	}
+
+	/**
+	 * Compute distance between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+	void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		To diff = To(0);
+
+		squaredEuclideanMetric->distance(a, b, diff, nbOfPoints);
+
+		diff = sqrt(diff);
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Pointer to a SquaredEuclideanMetric class.
+	 */
+	Metric<Tr, To> *squaredEuclideanMetric;
+};
+
+#endif /* EUCLIDIANMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/HausdorffMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,83 @@
+#ifndef HAUSDORFFMETRIC_H_
+#define HAUSDORFFMETRIC_H_
+
+#include "Metric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * HausdorffMetric class.
+ *
+ * The Hausdorff metric measures the similarity between two trajectories.
+ */
+template<typename Tr, typename To>
+class HausdorffMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		result = To(0);
+
+		checkTrajectoryLength(a->size(), b->size());
+
+		To distAB = computeDistance(a, b);
+		To distBA = computeDistance(b, a);
+
+		result = std::max(distAB, distBA);
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a == 0 || b == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+
+	/**
+	 * Compute the maximum distance from the trajectory given as a first parameter to the other.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @return distance between two trajectories
+	 */
+	To computeDistance(const Trajectory<Tr> *a, const Trajectory<Tr> *b)
+	{
+		To maxDist = -1;
+		for (unsigned ia = 0; ia < a->size(); ++ia)
+		{
+		  To minDist = (To)norm(a->getPoint(ia) - b->getPoint(0));
+			for (unsigned ib = 1; ib < b->size(); ++ib)
+			{
+			  To dist = (To)norm(a->getPoint(ia) - b->getPoint(ib));
+				if (dist < minDist)
+				{
+					minDist = dist;
+				}
+			}
+
+			if (minDist > maxDist)
+			{
+				maxDist = minDist;
+			}
+		}
+
+		return maxDist;
+	}
+};
+
+#endif /* HAUSDORFFMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/HuMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,58 @@
+#ifndef HUMETRIC_H_
+#define HUMETRIC_H_
+
+#include "EuclideanMetric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * HuMetric class.
+ *
+ * The Hu metric measures the normalized distance between two trajectories.
+ */
+template<typename Tr, typename To>
+class HuMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Constructor.
+	 */
+	HuMetric()
+	{
+	  euclideanMetric = new EuclideanMetric<Tr,To> ();
+	}
+
+	/**
+	 * Destructor.
+	 */
+	~HuMetric()
+	{
+		delete euclideanMetric;
+	}
+
+	/**
+	 * Compute normalized distance between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+	void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		To diff = To(0);
+
+		euclideanMetric->distance(a, b, diff, nbOfPoints);
+
+		diff /= To(a->size() * 2);
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Pointer to EuclideanMetric class.
+	 */
+	Metric<Tr, To> *euclideanMetric;
+};
+
+#endif /* HUMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/LCSMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,130 @@
+#ifndef LCSMETRIC_H_
+#define LCSMETRIC_H_
+
+#include "Metric.h"
+
+/**
+ * LCSMetric class.
+ *
+ * The Longest Common Subsequence metric
+ * This class mesures :
+ * 1) the similarity (number of points in "common", ie relative to distance similarity threshold) ; 
+ * 2) the normalized distance between two trajectories
+ */
+
+template<typename Tr, typename To>
+class LCSMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Constructor.
+	 */
+ LCSMetric() : similarityThreshold(0.0), eps(1e-6)
+	{
+	}
+
+	/**
+	 * Set similarity threshold between two points.
+	 *
+	 * @param[in] similarityThreshold similarity threshold
+	 */
+	bool setSimilarityThreshold(double similarityThreshold)
+	{
+		if (similarityThreshold >= 0.0)
+		{
+			this->similarityThreshold = similarityThreshold;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Set machine epsilon.
+	 *
+	 * @param[in] eps machine epsilon
+	 */
+	bool setEps(double eps)
+	{
+		if (eps >= 0.0)
+		{
+			this->eps = eps;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+	void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max())
+	{
+	  result = To(0);	  
+	  unsigned int LCSS = 0;
+	  similarity(a,b, LCSS); 
+	  unsigned int min_size = min(a->size(),b->size());
+	  result = 1 - double(LCSS/min_size);
+	}
+
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result similarity between two trajectories
+	 */
+	void similarity(const Trajectory<Tr> *a, const Trajectory<Tr> *b, unsigned int &result)
+	{
+		unsigned int LCS[a->size() + 1][b->size() + 1];
+
+		{ //initialisation
+			for (unsigned int i = 0; i <= a->size(); ++i)
+			{
+				LCS[i][0] = 0;
+			}
+
+			for (unsigned int j = 0; j <= b->size(); ++j)
+			{
+				LCS[0][j] = 0;
+			}
+		}
+
+		{ //algorithm
+			for (unsigned int i = 1; i <= a->size(); ++i)
+			{
+				for (unsigned int j = 1; j <= b->size(); ++j)
+				{
+					cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i-1)).x)> p(a->getPoint(i - 1) - b->getPoint(j - 1));
+					double distance = sqrt(pow(p.x, 2) + pow(p.y, 2) + pow(p.z, 2)); // il faudrait généraliser
+					if (distance <= similarityThreshold + eps)
+					{ //a[i] == b[j]
+						LCS[i][j] = LCS[i - 1][j - 1] + 1;
+					}
+					else
+					{
+					  LCS[i][j] = std::max(LCS[i - 1][j], LCS[i][j - 1]);
+					}
+				}
+			}
+		}
+
+		result = LCS[a->size()][b->size()];
+	}
+
+private:
+	/**
+	 * Similarity threshold between two points.
+	 */
+	double similarityThreshold;
+
+	/**
+	 * Machine epsilon.
+	 */
+	double eps;
+
+};
+
+#endif /* LCSMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/ManhattanMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,57 @@
+#ifndef MANHATTANMETRIC_H_
+#define MANHATTANMETRIC_H_
+
+#include "Metric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * ManhattanMetric class.
+ *
+ * The Manhattan metric measures the similarity between two trajectories.
+ */
+template<typename Tr, typename To>
+class ManhattanMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		result = To(0);
+
+		if (nbOfPoints == std::numeric_limits<unsigned int>::max())
+		  checkTrajectoryLength(a->size(), b->size());
+
+		To diff = To(0);
+		for (unsigned int i = 0; i < a->size() and i < nbOfPoints; ++i)
+		{
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> p(a->getPoint(i) - b->getPoint(i));
+			diff += abs(p.x) + abs(p.y) + abs(p.z);
+		}
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a != b || a == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+};
+
+#endif /* MANHATTANMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/Metric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,40 @@
+#ifndef METRIC_H_
+#define METRIC_H_
+
+#include "Trajectory.h"
+
+/**
+ * Metric class.
+ *
+ * The Metric class is an abstract class. Every class computing similarity between two trajectories should inherit this class.
+ */
+template<typename Tr, typename To>
+class Metric
+{
+public:
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result similarity between two trajectories
+	 */
+  virtual void similarity(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result) {
+    result = To(0);
+  }
+
+	/**
+	 * Compute distance (or normalized distance) between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[in] nbOfPoints is the limit to which the distance of trajectories is calculated. This is useful in the event of different sizes.
+	 * @param[out] result distance between two trajectories
+	 */
+  virtual void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) = 0;
+
+	
+
+};
+
+#endif /* METRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/MinimumMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,64 @@
+#ifndef MINIMUMMETRIC_H_
+#define MINIMUMMETRIC_H_
+
+#include "Metric.h"
+
+#include "TrajectoryExceptions.h"
+
+/**
+ * MinimumMetric class.
+ *
+ * The Minimum metric measures the similarity between two trajectories.
+ * This class represents the smallest distance all 3 dimensions, for ALL points.
+ * 
+ */
+template<typename Tr, typename To>
+class MinimumMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Compute similarity between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max()) 
+	{
+		result = To(0);
+
+		if (nbOfPoints == std::numeric_limits<unsigned int>::max())
+		  checkTrajectoryLength(a->size(), b->size());
+
+		To diff = abs((a->getPoint(0) - b->getPoint(0)).x);//est-ce que ça fait vraiment une différence de x ?
+		for (unsigned int i = 0; i < a->size() and i < nbOfPoints; ++i)
+		{
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> p(a->getPoint(i) - b->getPoint(i));
+			diff = std::min(diff, abs(p.x));
+			diff = std::min(diff, abs(p.y));
+			if (dim(a->getPoint(i)) == 3)
+			{
+			  diff = std::min(diff, abs(p.z));
+			}
+		}
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a != b || a == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+};
+
+#endif /* MINIMUMMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/PointOperations.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,46 @@
+#ifndef POINTOPERATIONS_H_
+#define POINTOPERATIONS_H_
+
+#include "opencv2/core/core.hpp"
+
+template<typename Ti, typename Tr>
+  std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, cv::Point_<Tr>& point)
+{
+	Tr x, y;
+	if (in >> x >> y)
+	{
+		point.x = x;
+		point.y = y;
+	}
+	return in;
+}
+
+template<typename Ti, typename Tr>
+std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, cv::Point3_<Tr>& point)
+{
+	Tr x, y, z;
+	if (in >> x >> y >> z)
+	{
+		point.x = x;
+		point.y = y;
+		point.z = z;
+	}
+	return in;
+}
+
+
+template<typename Tr>
+inline std::ostringstream& operator<<(std::ostringstream& out, const cv::Point_<Tr>& point)
+{
+	out << point.x << " " << point.y;
+	return out;
+}
+
+template<typename Tr>
+inline std::ostringstream& operator<<(std::ostringstream& out, const cv::Point3_<Tr>& point)
+{
+	out << point.x << " " << point.y << " " << point.z;
+	return out;
+}
+
+#endif /* POINTOPERATIONS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/SquaredEuclideanMetric.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,54 @@
+#ifndef SQUAREDEUCLIDIANMETRIC_H_
+#define SQUAREDEUCLIDIANMETRIC_H_
+#include "Metric.h"
+#include "TrajectoryExceptions.h"
+
+/**
+ * SquaredEuclideanMetric class.
+ *
+ * The Squared Euclidean metric measures the similarity between two trajectories.
+ */
+template<typename Tr, typename To>
+class SquaredEuclideanMetric: public Metric<Tr, To>
+{
+public:
+	/**
+	 * Compute distance between two trajectories.
+	 *
+	 * @param[in] a input trajectory
+	 * @param[in] b input trajectory
+	 * @param[out] result distance between two trajectories
+	 */
+  void distance(const Trajectory<Tr> *a, const Trajectory<Tr> *b, To &result, unsigned int nbOfPoints = std::numeric_limits<unsigned int>::max())
+	{
+		result = To(0);
+		if (nbOfPoints == std::numeric_limits<unsigned int>::max())
+		  checkTrajectoryLength(a->size(), b->size());
+
+		To diff = To(0);
+		for (unsigned int i = 0; i < a->size() and i < nbOfPoints; ++i)
+		{
+			cv::Point3_<typeof(static_cast<Tr>(a->getPoint(i)).x)> p(a->getPoint(i) - b->getPoint(i));
+			diff += pow(p.x, 2) + pow(p.y, 2) + pow(p.z, 2);
+		}
+
+		result = diff;
+	}
+
+private:
+	/**
+	 * Check the length of the trajectories.
+	 *
+	 * @param[in] a the size of the trajectory
+	 * @param[in] b the size of the trajectory
+	 */
+	void checkTrajectoryLength(size_t a, size_t b) const
+	{
+		if (a != b || a == 0)
+		{
+			throw TrajectoryLengthErrorException();
+		}
+	}
+};
+
+#endif /* SQUAREDEUCLIDIANMETRIC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/Trajectory.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,504 @@
+#ifndef TRAJECTORY_H_
+#define TRAJECTORY_H_
+
+#include "TrajectoryElement.h"
+#include "TrajectoryExceptions.h"
+
+#include "opencv2/core/core.hpp"
+
+#include <ostream>
+#include <vector>
+#include <cassert>
+#include <algorithm>
+
+/**
+ * Trajectory class.
+ *
+ * The Trajectory class is a container to keep information about a trajectory.
+ * defined as a sequence of not necessarily consecutive trajectory elements (instand + point coordinates)
+ * 
+ * \todo check (and remove) stuff about ascending frame numbers
+ */
+template<typename Type>
+class Trajectory
+{
+public:
+  /// Constructor.
+ Trajectory() : id(0), checkAscFrameNumber(false) {}
+
+  /**
+   * Constructor.
+   *
+   * @param trajectory trajectory
+   */
+  Trajectory(const Trajectory &itrajectory) {
+    setId(itrajectory.getId());
+    for (unsigned int i = 0; i < itrajectory.size(); ++i)
+      trajectory.push_back(itrajectory.getTrajectoryElement(i)); // justified because we directly copy the first and last instants
+    
+    setCheckAscFrameNumber(itrajectory.getCheckAscFrameNumber());
+  }
+
+  /**
+   * Constructor.
+   *
+   * @param trajectory trajectory
+   */
+ Trajectory(const int& id, const std::vector<TrajectoryElement<Type> >& trajectoryElements):
+  id(id), checkAscFrameNumber(false) {
+    for (typename std::vector<TrajectoryElement<Type> >::const_iterator iter = trajectoryElements.begin();
+	 iter != trajectoryElements.end(); iter++)
+      add(*iter);
+  }
+
+  /**
+   * Get id of the trajectory.
+   *
+   * @return id
+   */
+  unsigned int getId(void) const { return id;}
+
+  /**
+   * Set id of the trajectory.
+   *
+   * @param[in] id id
+   */
+  void setId(const unsigned int& iid) { id = iid;}
+
+  /**
+   * Get element of the trajectory.
+   *
+   * @param[in] position index of the element of the trajectory
+   * @return element of the trajectory#include "OpenCVPointTypeSupport.h"
+   */
+  const TrajectoryElement<Type> getTrajectoryElement(unsigned int position) const
+  {
+    return trajectory[position];
+  }
+  
+  /**
+   * Add an element to the trajectory.
+   *
+   * @param[in] frameNumber number of the frame of the new element of the trajectory
+   * @param[in] point position of the new element of the trajectory
+   */
+  void add(unsigned int frameNumber, const Type &point)
+  {
+    TrajectoryElement<Type> trajectoryElement = TrajectoryElement<Type> (frameNumber, point);
+    
+    if (getCheckAscFrameNumber())
+      {
+	ascFrameNumberAddCheck(frameNumber);
+      }
+    trajectory.push_back(trajectoryElement);
+  }
+  
+  /**
+   * Add an element to the trajectory.
+   *
+   * @param[in] point position of the new element of the trajectory
+   */
+  void add(const Type &point)
+  {
+    unsigned int frameNumber = 1;
+    add(frameNumber, point);
+  }
+  
+  void add(const TrajectoryElement<Type> &trajectoryElement)
+  {
+    int frameNumber = trajectoryElement.getFrameNumber();
+    if (getCheckAscFrameNumber())
+      {
+	ascFrameNumberAddCheck(frameNumber);
+      }
+    trajectory.push_back(trajectoryElement);
+  }
+
+  /**
+   * Get number of the frame of the element of the trajectory.
+   *
+   * @param[in] position index of the elesize_t ment of the trajectory
+   * @return number of the frame of the element of the trajectory.
+   */
+  unsigned int getFrameNumber(unsigned int position) const
+  {
+    return trajectory[position].getFrameNumber();
+  }
+
+  /**
+   * Get position of the element of the trajectory.
+   *
+   * @param[in] position index of the element of the trajectory
+   * @return position of the element of the trajectory
+   */
+  const Type &getPoint(unsigned int position) const
+  {
+    return trajectory[position].getPoint();
+  }
+
+  /** Get position of the element of the trajectory. */
+  const Type& getPointAtInstant(const unsigned int& t) const
+  {
+    typename std::vector<TrajectoryElement<Type> >::const_iterator iter = trajectory.begin();
+    while (iter != trajectory.end() && iter->getFrameNumber() != t)      
+      iter++;
+    if (iter != trajectory.end())
+      return iter->getPoint();
+    else {
+      throw TrajectoryOutOfRangeErrorException(t);
+    }
+  }
+
+  bool getCheckAscFrameNumber() const
+  {
+    return checkAscFrameNumber;
+  }
+
+  void setCheckAscFrameNumber(bool icheckAscFrameNumber)
+  {
+    if (icheckAscFrameNumber)
+      {
+	ascFrameNumberCheck();
+      }
+
+    checkAscFrameNumber = icheckAscFrameNumber;
+  }
+
+  /**
+   * Get number of elements in the trajectory.
+   *
+   * @return number of elements in the trajectory
+   */
+  unsigned int size() const
+  {
+    return trajectory.size();
+  }
+
+  bool empty() const
+  {
+    return trajectory.empty();
+  }
+
+  void insert(unsigned int position, unsigned int frameNumber, const Type &point)
+  {
+    trajectoryRangeLeEqCheck(position);
+
+    if (getCheckAscFrameNumber())
+      {
+	ascFrameNumberInsertCheck(position, frameNumber);
+      }
+
+    trajectory.insert(trajectory.begin() + position, TrajectoryElement<Type> (frameNumber, point));
+  }
+
+  /**
+   * Erase an element from the trajectory.
+   *TrajectoryFrameNumberErrorException
+   * @param[in] position index of the trajectory to be removed
+   */
+  void erase(unsigned int position)
+  {
+    trajectoryRangeLeCheck(position);
+    trajectory.erase(trajectory.begin() + position);
+  }
+
+  /**
+   * Erase the last element from the trajectory.
+   */
+  void pop_back()
+  {
+    trajectoryNotEmptyCheck();
+    trajectory.pop_back();
+  }
+
+  /**
+   * Clear the trajectory.
+   */
+  void clear()
+  {
+    trajectory.clear();
+  }
+
+  /**
+   * Get position of the element of the trajectory.
+   *
+   * @param[in] i index of the element of the trajectory
+   * @return position of the element of the trajectory
+   */
+  Type operator [](unsigned int i) const
+  {
+    return trajectory[i].getPoint();
+  }
+
+  /**
+   * Get position of the element of the trajectory.
+   *
+   * @param[in] i index of the element of the trajectory
+   * @return position of the element of the trajectory
+   */
+  const Type& at(unsigned int i) const
+  {
+    trajectoryRangeLeCheck(i);
+    return trajectory[i].getPoint();
+  }
+
+  /**
+   * Shift each element of the trajectory.
+   *
+   * @param[in] t vector by which the position of each element of the trajectory should be shifted.
+   */
+  void shift(const Type& t)
+  {
+    for (unsigned int i = 0; i < trajectory.size(); ++i)
+      {
+	trajectory[i].shift(t);
+      }
+  }
+
+   /** Computes the first and last instants */
+  void computeInstants(unsigned int& firstInstant, unsigned int& lastInstant) {
+    if (trajectory.empty()) {
+      firstInstant = 0;
+      lastInstant = 0;
+    } else {
+      typename std::vector<TrajectoryElement<Type> >::iterator iter = trajectory.begin();
+      firstInstant = iter->getFrameNumber();
+      lastInstant = iter->getFrameNumber();
+      iter++;
+      while (iter != trajectory.end()) {
+	unsigned int frameNumber = iter->getFrameNumber();
+	if (frameNumber < firstInstant)
+	  firstInstant = frameNumber;
+	else if (frameNumber > lastInstant)
+	  lastInstant = frameNumber;
+	iter++;
+      }
+    }
+  }
+
+  /** Smoothes the trajectory positions (parameter is the half-window used for moving average) */
+  void movingAverage(const unsigned int& nFramesSmoothing) {
+    if (!trajectory.empty() && nFramesSmoothing >= 1) {
+      // todo check the frames are in increasing order
+      std::vector<TrajectoryElement<Type> > smoothedTrajectory;
+      unsigned int nPositions = trajectory.size();
+      for(unsigned int i=0; i<nPositions; ++i) {
+      	Type p(0,0);
+      	unsigned int delta = std::min(nFramesSmoothing, std::min(i, nPositions-1-i));
+      	for (unsigned int j=i-delta; j<=i+delta; ++j)
+      	  p = p+getPoint(j);
+      	smoothedTrajectory.push_back(TrajectoryElement<Type>(trajectory[i].getFrameNumber(), p*(1./(1.+2.*static_cast<float>(delta)))));
+      }
+      trajectory = smoothedTrajectory;
+    }
+  }
+
+protected:
+  /**
+   * Check the length of the trajectories.
+   *
+   * @param[in] a the size of the trajectory
+   * @param[in] b the size of the trajectory
+   */
+  void trajectoryNotEmptyCheck() const
+  {
+    if (trajectory.size() == 0)
+      {
+	throw TrajectoryLengthErrorException();
+      }
+  }
+
+  /**
+   * Check the range of the trajectory.
+   *
+   * @param[in] n index of the element of the trajectory
+   */
+  void trajectoryRangeLeEqCheck(unsigned int n) const
+  {
+    if (n > trajectory.size())
+      {
+	throw TrajectoryOutOfRangeErrorException();
+      }
+  }
+
+  /**
+   * Check the range of the trajectory.
+   *
+   * @param[in] n index of the element of the trajectory
+   */
+  void trajectoryRangeLeCheck(unsigned int n) const
+  {
+    if (n >= trajectory.size())
+      {
+	throw TrajectoryOutOfRangeErrorException();
+      }
+  }
+
+  void ascFrameNumberCheck(unsigned int prevFrameNumber, unsigned int currFrameNumber) const
+  {
+    if (prevFrameNumber >= currFrameNumber)
+      {
+	throw TrajectoryFrameNumberErrorException();
+      }
+  }
+
+  void ascFrameNumberCheck() const
+  {
+    for (unsigned int i = 1; i < trajectory.size(); ++i)
+      {
+	ascFrameNumberCheck(trajectory[i - 1].getFrameNumber(), trajectory[i].getFrameNumber());
+      }
+  }
+
+  void ascFrameNumberAddCheck(unsigned int frameNumber) const
+  {
+    if (!trajectory.empty())
+      {
+	ascFrameNumberCheck(trajectory.back().getFrameNumber(), frameNumber);
+      }
+  }
+
+  void ascFrameNumberInsertCheck(unsigned int position, unsigned int frameNumber) const
+  {
+    if (position > 0)
+      {
+	ascFrameNumberCheck(trajectory[position - 1].getFrameNumber(), frameNumber);
+      }
+
+    if (position < trajectory.size())
+      {
+	ascFrameNumberCheck(frameNumber, trajectory[position].getFrameNumber());
+      }
+  }
+
+ private:
+
+  /// Id of the trajectory.
+  unsigned int id;
+
+  /**
+   * Trajectory.
+   */
+  std::vector<TrajectoryElement<Type> > trajectory;
+
+  bool checkAscFrameNumber;
+};
+
+typedef Trajectory<cv::Point_<int> > TrajectoryPoint2i;
+typedef TrajectoryPoint2i TrajectoryPoint;
+typedef Trajectory<cv::Point_<float> > TrajectoryPoint2f;
+typedef Trajectory<cv::Point_<double> > TrajectoryPoint2d;
+typedef Trajectory<cv::Point3_<int> > TrajectoryPoint3i;
+typedef Trajectory<cv::Point3_<float> > TrajectoryPoint3f;
+typedef Trajectory<cv::Point3_<double> > TrajectoryPoint3d;
+
+/**
+ * Compare two trajectories.
+ *
+ * @param[in] t trajectory trajectory
+ * @return information whether trajectories are equal or notPoint_<_Tp>
+ */
+template<typename T>
+static inline bool operator ==(const Trajectory<T>& a, const Trajectory<T>& b)
+{
+  if (a.getId() != b.getId() || a.getCheckAscFrameNumber() != b.getCheckAscFrameNumber() || a.size() != b.size())
+    {
+      return false;
+    }
+
+  for (unsigned int i = 0; i < a.size(); ++i)
+    {
+      if (a.getTrajectoryElement(i) != b.getTrajectoryElement(i))
+	{
+	  return false;
+	}
+    }
+
+  return true;
+}
+
+template<typename T>
+static inline Trajectory<T>& operator +=(Trajectory<T>& a, const T& b)
+{
+  a.add(b);
+  return a;
+}
+
+template<typename T>
+static inline Trajectory<T>& operator +=(Trajectory<T>& a, const TrajectoryElement<T>& b)
+{
+  a.add(b);
+  return a;
+}
+
+template<typename Ti, typename Tr>
+  std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, Trajectory<Tr>& trajectory)
+{
+  unsigned int id;
+  if (in >> id)
+    {
+      trajectory.setId(id);
+      TrajectoryElement<Tr> trajectoryElement;
+      while (in >> trajectoryElement)
+	{
+	  trajectory.add(trajectoryElement);
+	}
+    }
+  return in;
+}
+
+template<typename Tr>
+std::ostream& operator<<(std::ostream& out, const Trajectory<Tr>& trajectory)
+{
+  out << trajectory.getId();
+  for (unsigned int i = 0; i < trajectory.size(); ++i)
+    {
+      out << " ";
+      out << trajectory.getTrajectoryElement(i);
+    }
+  return out;
+}
+
+/**
+ * Compute the minimum and the maximum position of the trajectory.
+ *
+ * @param[out] _min minimum position of the trajectory
+ * @param[out] _max maximum position of the trajectory
+ */
+template<typename T>
+static inline T min(const Trajectory<T>& trajectory)
+{
+  if (trajectory.empty())
+    {
+      throw TrajectoryLengthErrorException();
+    }
+
+  T point = trajectory.getPoint(0);
+
+  for (unsigned int i = 1; i < trajectory.size(); ++i)
+    {
+      point = min(point, trajectory.getPoint(i));
+    }
+
+  return point;
+}
+
+template<typename T>
+static inline T max(const Trajectory<T>& trajectory)
+{
+  if (trajectory.empty())
+    {
+      throw TrajectoryLengthErrorException();
+    }
+
+  T point = trajectory.getPoint(0);
+
+  for (unsigned int i = 1; i < trajectory.size(); ++i)
+    {
+      point = max(point, trajectory.getPoint(i));
+    }
+
+  return point;
+}
+
+#endif /* TRAJECTORY_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryDBAccess.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,373 @@
+#ifndef TRAJECTORYDBACCESS_H_
+#define TRAJECTORYDBACCESS_H_
+
+#include "DBSQLiteAccess.h"
+#include "Trajectory.h"
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+/**
+ * TrajectoryDBAccess class.
+ *
+ * The TrajectoryDBAccess is an abstract class with basic operations on trajectories and databases.
+ */
+
+template<typename T>
+class TrajectoryDBAccess
+{
+public:
+	/**
+	 * Constructor.
+	 */
+	TrajectoryDBAccess()
+	{
+		db = new DBSQLiteAccess();
+	}
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~TrajectoryDBAccess()
+	{
+		delete db;
+	}
+
+	/**
+	 * Connect to the database.
+	 *
+	 * @param[in] database name of the database
+	 * @return information whether the operation was successful
+	 */
+	bool connect(const char *database)
+	{
+		return db->connect(database);
+	}
+
+	/**
+	 * Disconnect from the database.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool disconnect()
+	{
+		return db->disconnect();
+	}
+
+	/**
+	 * Create a table.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	virtual bool createTable(const std::string& tableName = "trajectories") = 0;
+
+	/**
+	 * This function creates a prototype table which contains a map between prototype and trajectory_id 
+	 * which matches the prototype
+	 */
+	bool createPrototypeTable(const std::string& tableName = "prototypes"){
+	  if (!db->isConnected()){
+	    return false;
+	  }
+	  
+	  std::string statementString = "create table "+tableName+" ( prototype_id INTEGER, trajectory_id_matched INTEGER);";
+	  bool success = db->executeStatement(statementString.c_str());
+	  return success;
+	}
+
+	/** Create a table of objects, ie list of trajectory ids with attributes */
+	bool createObjectTable(const std::string& objectTableName = "objects", const std::string& linkTableName = "objects_features") {
+	  //id_obj, road user type, size / db lien features-obj id_feature, id_obj
+	  
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	    {
+	      return false;
+	    }
+	  
+	  std::string statementString = "create table "+objectTableName+" ( object_id INTEGER, road_user_type INTEGER DEFAULT 0, n_objects INTEGER DEFAULT 1, PRIMARY KEY(object_id) );";
+	  bool success = TrajectoryDBAccess<T>::db->executeStatement(statementString.c_str());
+	  statementString = "create table "+linkTableName+" (object_id INTEGER, trajectory_id INTEGER, PRIMARY KEY(object_id, trajectory_id) );";
+	  success = success && TrajectoryDBAccess<T>::db->executeStatement(statementString.c_str());
+	  return success;
+	}
+
+	/** Create a table of bounding boxes of the objects in image space */
+	bool createBoundingBoxTable(const std::string& bbTableName = "bounding_box") {
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	    {
+	      return false;
+	    }
+	  
+	  std::string statementString = "CREATE TABLE bounding_boxes (object_id INTEGER, frame_number INTEGER, x_top_left REAL, y_top_left REAL, x_bottom_right REAL, y_bottom_right REAL,  PRIMARY KEY(object_id, frame_number))";
+	  bool success = TrajectoryDBAccess<T>::db->executeStatement(statementString.c_str());
+	  return success;
+	}
+
+	/**
+	 * Delete a table.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool deleteTable(const std::string& tableName = "trajectories")
+	{
+		if (!db->isConnected())
+		{
+			return false;
+		}
+
+		std::string statementString = "drop table "+tableName+";";
+		const char *statement = statementString.c_str();
+
+		bool success = db->executeStatement(statement);
+		return success;
+	}
+
+	/**
+	 * Read trajectories from a database.
+	 *
+	 * @param[out] trajectories trajectories
+	 * @return information whether the operation was successful
+	 */
+	virtual bool read(std::vector<std::shared_ptr<Trajectory<T> > > &trajectories, const std::string& tableName = "trajectories") = 0;
+
+	/**
+	 * Read prototypes from a database and matching trajectory Ids.
+	 *
+	 * @param[out] multimap of prototype ids and trajectory ids
+	 * @retur boolean : if  the operation was successful or not
+	 * 
+	 */
+	bool read(std::multimap<int,int>& matches, const std::string& tableName = "prototypes") { 
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	      return false;
+
+	  std::string statement = "select * from "+tableName+" order by prototype_id, trajectory_id_matched;";
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectPrototypeMatches(matches, statement.c_str());
+	  return success;
+	}
+
+	/// Reads trajectory with specific number
+	virtual bool read(std::shared_ptr<Trajectory<T> >& trajectory, const int& trajectoryId, const std::string& tableName = "trajectories") = 0;
+
+	bool beginTransaction(void) { return db->begin();}
+
+	bool endTransaction(void) { return db->end();}
+
+	/**
+	 * Write the trajectory to the database within a transaction, calling write.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @return information whether the operation was successful
+	 */
+	bool writeTransaction(const Trajectory<T> &trajectory, const std::string& tableName = "trajectories") {
+	  if (!db->isConnected())
+	    {
+	      return false;
+	    }
+
+		bool success = db->begin();
+		if (!success)
+		{
+			return false;
+		}
+
+		success = write(trajectory, tableName);
+		if (!success)
+		{
+			return false;
+		}
+
+		success = db->end();
+		if (!success)
+		{
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Write the trajectory to the database.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @return information whether the operation was successful
+	 */
+	virtual bool write(const Trajectory<T> &trajectory, const std::string& tableName = "trajectories") = 0;
+
+	/**
+	 * Write the prototype and trajectory id matches to the database.
+	 *
+	 * @param[in] the multimap between prototype_id and trajectory_id 
+	 * @return boolean on whether the operation was successful
+	 */
+	bool write(const std::multimap<int,int> &matches, const std::string& tableName = "prototypes"){
+	  std::string stmt;
+	  bool success = true;
+	  bool failure = false;
+	  int p_id;
+	  int t_id;
+
+	  std::multimap<int,int>::const_iterator it;
+	  for (it = matches.begin(); it != matches.end(); ++it){
+	    p_id = it->first;
+	    t_id = it->second;
+	    stmt = "insert into "+tableName+" (prototype_id, trajectory_id_matched) values ("+TrajectoryDBAccess<T>::toString(p_id)+", "+TrajectoryDBAccess<T>::toString(t_id)+")";
+	    success = db->executeStatement(stmt.c_str());
+	    if (success == false)
+	      failure = true;
+	  } // (go) for it
+	  return !failure;
+	}
+
+	/** Write object */
+	bool writeObject(const unsigned int id, const std::vector<unsigned int>& object, const int roadUserType = 0, const int nObjects = 1, const std::string& objectTableName = "objects", const std::string& linkTableName = "objects_features") {
+	  std::string sid = TrajectoryDBAccess<T>::toString(id);
+	  std::string stmt = "insert into "+objectTableName+" (object_id, road_user_type, n_objects) values ("+sid+", "+TrajectoryDBAccess<T>::toString(roadUserType)+", "+TrajectoryDBAccess<T>::toString(nObjects)+")";
+	  bool success = TrajectoryDBAccess<T>::db->executeStatement(stmt.c_str());
+
+	  if (!success)	{
+	    std::cout << "rollback" << std::endl;
+	    success = TrajectoryDBAccess<T>::db->rollback();
+	    if (!success)
+	      return false;
+	  }
+
+	  for (unsigned int i=0; i<object.size(); ++i) {
+	    std::string stmt = "insert into "+linkTableName+" (object_id, trajectory_id) values ("+sid+","+TrajectoryDBAccess<T>::toString(object[i])+")";
+	    success = TrajectoryDBAccess<T>::db->executeStatement(stmt.c_str());
+	    // check rollback?
+	  }
+	  return success;
+	}
+
+	/**
+	 * Get the label of the trajectory.
+	 *
+	 * @param[in] trajectoryId id of the trajectory
+	 * @param[out] resultOut label
+	 * @return information whether the operation was successful
+	 */
+	bool getTrajectoryLabel(unsigned trajectoryId, std::string& resultOut)
+	{
+		std::string trajectoryIdString = toString(trajectoryId);
+		std::string stmtStr = "select label from trajectorytypes where trajectory_id=" + trajectoryIdString + ";";
+		resultOut.clear();
+		bool success = db->executeStatementGetSingleValue(stmtStr.c_str(), resultOut);
+		return success;
+	}
+
+	/**
+	 * Inform whether the table with trajectories exists or not.
+	 *
+	 * @param[out] result information whether the table exists or not
+	 * @return information whether the operation was successful
+	 */
+	bool tableExists(bool &result, const std::string& tableName = "trajectories")
+	{
+		std::string stmtStr = "select count() from sqlite_master where name=\'"+tableName+"\' and type=\'table\'";
+		bool success = db->executeStatementGetSingleValue(stmtStr.c_str(), result);
+		return success;
+	}
+
+	/**
+	 * Inform whether the table with labels of trajectories exists or not.
+	 *
+	 * @param[out] result information whether the table exists or not
+	 * @return information whether the operation was successful
+	 */
+	bool labelTableExists(bool &result)
+	{
+		std::string stmtStr = "select count() from sqlite_master where name=\'trajectorytypes\' and type=\'table\'";
+		bool success = db->executeStatementGetSingleValue(stmtStr.c_str(), result);
+		return success;
+	}
+
+	/**
+	 * Get the number of trajectories in the database.
+	 *
+	 * @param[out] result number of trajectories in the database
+	 * @return information whether the operation was successful
+	 */
+	bool size(unsigned int &result, const std::string& tableName = "trajectories")
+	{
+		std::string stmtStr = "select count(distinct trajectory_id) from "+tableName+";";
+		const char *stmt = stmtStr.c_str();
+		bool success = db->executeStatementGetSingleValue(stmt, result);
+		return success;
+	}
+
+	/**
+	 * Get the minimum id of all trajectories in a database.
+	 *
+	 * @param[out] result minimum id
+	 * @return information whether the operation was successful
+	 */
+	bool minTrajectoryId(unsigned int &result, const std::string& tableName = "trajectories")
+	{
+		std::string stmtStr = "select min(trajectory_id) from "+tableName+";";
+		const char *stmt = stmtStr.c_str();
+		bool success = db->executeStatementGetSingleValue(stmt, result);
+		return success;
+	}
+
+	/**
+	 * Get the maximum id of all trajectories in a database.
+	 *
+	 * @param[out] result maximum id
+	 * @return information whether the operation was successful
+	 */
+	bool maxTrajectoryId(unsigned int &result, const std::string& tableName = "trajectories")
+	{
+		std::string stmtStr = "select max(trajectory_id) from "+tableName+";";
+		const char *stmt = stmtStr.c_str();
+		bool success = db->executeStatementGetSingleValue(stmt, result);
+		return success;
+	}
+
+	/** Returns the first and last instants of all trajectory elements */
+	bool firstLastInstants(unsigned int& firstInstant, unsigned int& lastInstant) {
+	  std::string stmtStr = "select min(first_instant), max(last_instant) from trajectory_instants";
+	  std::vector<std::vector<int> > result;
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectMultipleIntegers(result, stmtStr.c_str());
+	  if (!result.empty()) {
+	    firstInstant = result[0][0];
+	    lastInstant = result[0][1];
+	  }
+	  return success;
+	}
+
+	/** Returns the first and last frame of the trajectory with given id */
+	bool timeInterval(unsigned int& firstInstant, unsigned int& lastInstant, const int& trajectoryId) {
+	  std::stringstream stmtSS;
+	  stmtSS << "select first_instant,last_instant from trajectory_instants where trajectory_id=" << trajectoryId;
+	  std::vector<std::vector<int> > result;
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectMultipleIntegers(result, stmtSS.str().c_str());
+	  assert(result.size() == 1);
+	  assert(result[0].size() == 2);
+	  firstInstant = result[0][0];
+	  lastInstant = result[0][1];
+	  return success;
+	}
+
+protected:
+	/**
+	 * Pointer to the DBSQLiteAccess class.
+	 */
+	DBSQLiteAccess *db;
+
+	/**
+	 * Convert variable \a x to string.
+	 *
+	 * @param x input parameter
+	 * @return output string
+	 */
+	template<typename Ts> std::string toString(Ts x)
+	{
+	  std::stringstream ss;
+	  ss << x;
+	  return ss.str();
+	}
+};
+
+#endif /* TRAJECTORYDBACCESS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryDBAccessBlob.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,117 @@
+#ifndef TRAJECTORYDBACCESSBLOB_H_
+#define TRAJECTORYDBACCESSBLOB_H_
+
+#include "TrajectoryDBAccess.h"
+
+/**
+ * TrajectoryDBAccessBlob class.
+ *
+ * The TrajectoryDBAccessBlob class allows to perform basic operations on a database representing trajectory as a Blob.
+ */
+template<typename T>
+class TrajectoryDBAccessBlob: public TrajectoryDBAccess<T>
+{
+public:
+	/**
+	 * Create a table.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool createTable(const std::string& tableName = "trajectories")
+	{
+		if (!TrajectoryDBAccess<T>::db->isConnected())
+		{
+			return false;
+		}
+
+		std::string statementString = "create table "+tableName+" ( trajectory_id INTEGER, trajectory BLOB );";
+		const char *statement = statementString.c_str();
+
+		bool success = TrajectoryDBAccess<T>::db->executeStatement(statement);
+		return success;
+	}
+
+	/**
+	 * Read trajectories from a database.
+	 *
+	 * @param[out] trajectories trajectories
+	 * @param[in] limit maximum number of trajectories, which will be read
+	 * @param[in] offset offset
+	 * @return information whether the operation was successful
+	 */
+	bool read(std::vector<Trajectory<T>*>* &trajectories, int limit = -1, int offset = -1, const std::string& tableName = "trajectories")
+	{
+		if (!TrajectoryDBAccess<T>::db->isConnected())
+		{
+			return false;
+		}
+
+		std::string statementString = "select * from "+tableName;
+		if (limit > 0)
+		{
+			statementString += " limit " + TrajectoryDBAccess<T>::toString(limit);
+		}
+		if (offset > 0)
+		{
+			statementString += " offset " + TrajectoryDBAccess<T>::toString(offset);
+		}
+		const char *statement = statementString.c_str();
+
+		std::vector<std::vector<std::string> > result;
+		bool success = TrajectoryDBAccess<T>::db->executeStatementGetMatrix(statement, result);
+		if (success)
+		{
+			if (trajectories == 0)
+			{
+				trajectories = new std::vector<Trajectory<T>*> ();
+			}
+
+			for (unsigned int i = 0; i < result.size(); ++i)
+			{
+				std::string s = "";
+				for (unsigned int j = 0; j < result[i].size(); ++j)
+				{
+					s += result[i][j];
+
+					if (j == 0)
+					{
+						s += " ";
+					}
+				}
+
+				std::istringstream is(s);
+				Trajectory<T> *trajectory = new Trajectory<T> ();
+				is >> *trajectory;
+				trajectories->push_back(trajectory);
+			}
+		}
+
+		return success;
+	}
+
+	/**
+	 * Write the trajectory to the database.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @return information whether the operation was successful
+	 */
+	bool write(const Trajectory<T> &trajectory, const std::string& tableName = "trajectories")
+	{
+	  std::stringstream ss;
+		ss << trajectory;
+		std::string s = ss.str();
+
+		unsigned int sIdLen = TrajectoryDBAccess<T>::toString(trajectory.getId()).length();
+		s[sIdLen] = ',';
+		s.insert(sIdLen, "\"");
+		s.insert(sIdLen + 2, "\"");
+
+		std::string statementString = "insert into "+tableName+" (trajectory_id, trajectory) values (\"" + s + "\")";
+		const char *statement = statementString.c_str();
+
+		bool success = TrajectoryDBAccess<T>::db->executeStatement(statement);
+		return success;
+	}
+};
+
+#endif /* TRAJECTORYDBACCESSBLOB_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryDBAccessList.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,287 @@
+#ifndef TRAJECTORYDBACCESSLIST_H_
+#define TRAJECTORYDBACCESSLIST_H_
+
+#include "TrajectoryDBAccess.h"
+
+#include <boost/foreach.hpp>
+
+/**
+ * TrajectoryDBAccessList class.
+ *
+ * The TrajectoryDBAccessList class allows to perform basic operations on a database representing trajectory as a List.
+ */
+template<typename T>
+class TrajectoryDBAccessList: public TrajectoryDBAccess<T> {
+ protected:
+  /** Get ids of trajectories starting or ending at frameNum
+      (specific to list version of db) */
+  bool trajectoryIdStartingEndingAt(std::vector<int>& ids, const int& frameNum, const std::string& firstOrLast) {
+    if (!TrajectoryDBAccess<T>::db->isConnected())
+      return false;
+    
+    std::stringstream stmtSS;
+    stmtSS << "SELECT trajectory_id from trajectory_instants WHERE "<< firstOrLast <<"_instant=" << frameNum;
+    return TrajectoryDBAccess<T>::db->executeStatementSelectIntegers(ids, stmtSS.str().c_str());
+  }
+
+ public:
+  /** Create single index for a table. */
+  bool createIndex(const std::string& tableName, const std::string& columnName, const bool& unique = false) {
+    if (!TrajectoryDBAccess<T>::db->isConnected())
+      return false;
+    
+    std::string stmtStr = "CREATE ";
+    if (unique)
+      stmtStr += "UNIQUE ";
+    stmtStr += "INDEX "+tableName+"_"+columnName+"_index ON "+tableName+"("+columnName+")";
+    return TrajectoryDBAccess<T>::db->executeStatement(stmtStr.c_str());
+  }
+
+	/**
+	 * Create a Trajectory table.
+	 *
+	 * @return information whether the operation was successful
+	 */
+	bool createTable(const std::string& tableName = "trajectories")
+	{
+		if (!TrajectoryDBAccess<T>::db->isConnected())
+		{
+			return false;
+		}
+
+		std::string statementString = "create table "+tableName+" ( trajectory_id INTEGER, frame_number INTEGER, x_coordinate REAL, y_coordinate REAL, PRIMARY KEY( trajectory_id, frame_number ) );";
+		  //"create table trajectories ( trajectory_id INTEGER, frame_number INTEGER, x_coordinate REAL, y_coordinate REAL, z_coordinate REAL, PRIMARY KEY( trajectory_id, frame_number ) );";
+		bool success = TrajectoryDBAccess<T>::db->executeStatement(statementString.c_str());
+		return success;
+	}
+
+	/** Create view of first and last frame numbers of trajectories.
+	 * (specific to list version of db) */
+	bool createViewInstants(const std::string& firstOrLast) {
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	    return false;
+
+	  std::string minOrMax = (firstOrLast=="first")?"min":"max";
+	  std::string stmtStr = "CREATE VIEW IF NOT EXISTS "+getViewName(firstOrLast)+" AS select trajectory_id, "+minOrMax+"(frame_number) as frame_number from positions group by trajectory_id";
+	  bool success = TrajectoryDBAccess<T>::db->executeStatement(stmtStr.c_str());
+	  return success;
+	}
+
+	/** Create view or temporary table of first and last instants, 
+	    as well as length of each trajectory
+	    (specific to list version of db) */
+	bool createInstants(const std::string& view) {
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	    return false;
+
+	  std::string viewOrTable = (view=="view")?"VIEW":"TEMP TABLE";
+	  std::string stmtStr = "CREATE "+viewOrTable+" IF NOT EXISTS trajectory_instants AS select trajectory_id, min(frame_number) as first_instant, max(frame_number) as last_instant, max(frame_number)-min(frame_number)+1 as length from positions group by trajectory_id";
+	  // alternative for trajectory length: SELECT count(*) as length FROM trajectories GROUP BY trajectory_id
+
+	  bool success = TrajectoryDBAccess<T>::db->executeStatement(stmtStr.c_str());
+
+	  //success = success && createIndex("trajectory_instants", "first_instant");
+	  success = success && createIndex("trajectory_instants", "last_instant");
+	  success = success && createIndex("trajectory_instants", "trajectory_id", true);
+
+	  return success;
+	}
+
+	/** Get ids of trajectories starting at frameNum
+	    (specific to list version of db) */
+	bool trajectoryIdStartingAt(std::vector<int>& ids, const int& frameNum) { return trajectoryIdStartingEndingAt(ids, frameNum, "first");}
+	/** Get ids of trajectories ending at frameNum
+	    (specific to list version of db) */
+	bool trajectoryIdEndingAt(std::vector<int>& ids, const int& frameNum) { return trajectoryIdStartingEndingAt(ids, frameNum, "last");}
+
+	/** Get ids of trajectories with one instant between first and last instant */
+	bool trajectoryIdInInterval(std::vector<int>& ids, const unsigned int& firstInstant, const unsigned int& lastInstant) {
+	  if (!TrajectoryDBAccess<T>::db->isConnected())
+	    return false;
+	  
+	  std::stringstream stmtSS;
+	  stmtSS << "SELECT trajectory_id from positions WHERE frame_number BETWEEN " << firstInstant << " and " << lastInstant;
+	  return TrajectoryDBAccess<T>::db->executeStatementSelectIntegers(ids, stmtSS.str().c_str());
+	}
+
+	/** Returns the maximum trajectory length
+	 * \TODO if trajectory_instants does not exist, get it from positions table
+	 * \TODO provide a mechanism to handle empty results */
+	bool maxTrajectoryLength(unsigned int& length) {
+	  std::string stmtStr = "select max(length) from trajectory_instants";
+	  std::vector<int> result;
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectIntegers(result, stmtStr.c_str());
+	  if (!result.empty())
+	    length = result[0];
+	  return success;
+	}
+
+	
+
+	/**
+	 * Read trajectories from a database.
+	 *
+	 * @param[out] trajectories trajectories
+	 * @param[in] limit maximum number of trajectories, which will be read
+	 * @param[in] offset offset
+	 * @return information whether the operation was successful
+	 */
+	bool read(std::vector<std::shared_ptr<Trajectory<T> > > &trajectories, const std::string& tableName = "trajectories")
+	{
+		if (!TrajectoryDBAccess<T>::db->isConnected())
+		{
+			return false;
+		}
+
+		std::string statement = "select * from "+tableName+" order by trajectory_id, frame_number;";
+
+		std::vector<std::vector<std::string> > result;
+		bool success = TrajectoryDBAccess<T>::db->executeStatementGetMatrix(statement.c_str(), result);
+		if (success)
+		{
+		  if (trajectories.empty())
+			{
+			  trajectories = std::vector<std::shared_ptr<Trajectory<T> > >();
+			}
+
+			bool firstId = true;
+			unsigned int prev = 0;
+			for (unsigned int i = 0; i < result.size(); ++i)
+			{
+				unsigned int trajectoryId = convertString<unsigned int> (result[i][0]);
+
+				std::string s = "";
+				for (unsigned int j = 1; j < result[i].size(); ++j)
+				{
+					s += result[i][j] + " ";
+				}
+
+				std::istringstream is(s);
+				TrajectoryElement<T> t;
+				is >> t;
+
+				if (firstId || trajectoryId != prev)
+				{
+					firstId = false;
+					trajectories.push_back(std::shared_ptr<Trajectory<T> >(new Trajectory<T> ()));
+					trajectories.back()->setId(trajectoryId);
+					prev = trajectoryId;
+				}
+
+				trajectories.back()->add(t);
+			}
+		}
+
+		return success;
+	}
+
+	/**
+	 * Read prototypes from a database and matching trajectory Ids.
+	 *
+	 * @param[out] multimap of prototype ids and trajectory ids
+	 * @retur boolean : if  the operation was successful or not
+	 * 
+	 */
+	bool read(std::multimap<int,int>& matches, const std::string& tableName = "prototypes") { 
+	  if (TrajectoryDBAccess<T>::db->isConnected())
+	      return false;
+
+	  std::string statement = "select * from "+tableName+" order by trajectory_id, trajectory_id_matched;";
+
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectPrototypeMatches(matches, statement.c_str());
+	  return success;
+	}
+
+	/// Reads trajectory with specific number
+	bool read(std::shared_ptr<Trajectory<cv::Point2f> >& trajectory, const int& trajectoryId, const std::string& tableName = "trajectories") {
+	  if (!TrajectoryDBAccess<cv::Point2f>::db->isConnected())
+	      return false;
+
+	  std::string statement = "select * from "+tableName+" where trajectory_id = " +TrajectoryDBAccess<T>::toString(trajectoryId)+ " order by frame_number;";
+	  std::map<int, std::vector<TrajectoryElement<cv::Point2f> > > trajectoryElements;
+	  bool success = TrajectoryDBAccess<T>::db->executeStatementSelectTrajectoryElements(trajectoryElements, statement.c_str());
+	  if (success) {
+	    assert(trajectoryElements.count(trajectoryId) == 1);
+	    assert(trajectoryElements.size() == 1);
+	    trajectory = std::shared_ptr<Trajectory<cv::Point2f> >(new Trajectory<cv::Point2f>(trajectoryId, trajectoryElements[trajectoryId]));
+	  }
+	  
+	  return success;
+	}
+
+	/// Reads trajectory with specific number
+	bool read(std::vector<std::shared_ptr<Trajectory<cv::Point2f> > >& trajectories, const std::vector<int>& trajectoryIds, const std::string& tableName = "trajectories") {
+	  if (!TrajectoryDBAccess<cv::Point2f>::db->isConnected())
+	      return false;
+	  bool success = false;
+	  if (!trajectoryIds.empty()) {
+	    std::stringstream trajectoryIdsSS;
+	    BOOST_FOREACH(int id, trajectoryIds)
+	      trajectoryIdsSS << id << ", ";
+	    std::string statement = "select * from "+tableName+" where trajectory_id in (" +trajectoryIdsSS.str()+ ") order by frame_number;";
+	    std::map<int, std::vector<TrajectoryElement<cv::Point2f> > > trajectoryElements;
+	    success = TrajectoryDBAccess<T>::db->executeStatementSelectTrajectoryElements(trajectoryElements, statement.c_str());
+	    if (success) {
+	      BOOST_FOREACH(int id, trajectoryIds)
+		trajectories.push_back(std::shared_ptr<Trajectory<cv::Point2f> >(new Trajectory<cv::Point2f>(id, trajectoryElements[id])));
+	    }
+	  }
+	  return success;
+	}
+
+	/** Write the trajectory to the database */
+	bool write(const Trajectory<T> &trajectory, const std::string& tableName = "trajectories")
+	{
+		std::string sid = TrajectoryDBAccess<T>::toString(trajectory.getId());
+
+		for (unsigned int i = 0; i < trajectory.size(); ++i)
+		{
+		  //std::string stmt = "insert into trajectories (trajectory_id, frame_number, x_coordinate, y_coordinate, z_coordinate) values (";
+			std::string stmt = "insert into "+tableName+" (trajectory_id, frame_number, x_coordinate, y_coordinate) values (";
+			stmt += sid + ", ";
+			std::stringstream ss;
+			T p = trajectory[i];
+			ss << trajectory.getFrameNumber(i) << ", " << p.x << ", " << p.y;
+			stmt += ss.str();
+
+			/* if (dim(trajectory.getPoint(i)) == 2) //for z_coordinate */
+			/* { */
+			/* 	stmt += ",0"; */
+			/* } */
+
+			stmt += ");";
+
+			bool success = TrajectoryDBAccess<T>::db->executeStatement(stmt.c_str());
+			if (!success)
+			{
+			  std::cout << "rollback" << std::endl;
+			  success = TrajectoryDBAccess<T>::db->rollback();
+			  if (!success)
+			    {
+			      return false;
+			    }
+			}
+		}
+		return true;
+	}
+
+private:
+	/**
+	 * Convert string to variable with a type of \a Tc.
+	 *
+	 * @param s input parameter
+	 * @return output variable
+	 */
+	template<typename Tc> Tc convertString(std::string s)
+	{
+	  std::istringstream is(s);
+	  Tc x;
+	  is >> x;
+	  return x;
+	}
+
+	/// Returns the name of the view
+	static std::string getViewName(const std::string& firstOrLast) { return "trajectory_"+firstOrLast+"_instants";}
+};
+
+#endif /* TRAJECTORYDBACCESSLIST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryElement.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,122 @@
+#ifndef TRAJECTORYELEMENT_H_
+#define TRAJECTORYELEMENT_H_
+
+#include <istream>
+#include <ostream>
+
+#include "PointOperations.h"
+
+/**
+ * TrajectoryElement class.
+ *
+ * The Trajectory class is composed of components called TrajectoryElement.
+ */
+template<typename T>
+class TrajectoryElement {
+ public:
+  /**
+   * Constructor.
+   */
+  TrajectoryElement() {}
+  
+  /**
+   * Constructor.
+   *
+   * @param[in] frameNumber number of a frame
+   * @param[in] position position
+   */
+  TrajectoryElement(unsigned int frameNumber, const T& point) {
+    setFrameNumber(frameNumber);
+    setPoint(point);
+  }
+  
+  /**
+   * Constructor.
+   *
+   * @param[in] trajectoryElement element of the trajectory
+   */
+  TrajectoryElement(const TrajectoryElement& trajectoryElement) {
+    setFrameNumber(trajectoryElement.getFrameNumber());
+    setPoint(trajectoryElement.getPoint());
+  }
+  
+  /**
+   * Get number of a frame.
+   *
+   * @return number of a frame
+   */
+  unsigned int getFrameNumber() const {
+    return frameNumber;
+  }
+  
+  /**
+   * Set number of a frame.
+   *
+   * @param[in] frameNumber number of a frame
+   */
+  void setFrameNumber(unsigned int iframeNumber) {
+    frameNumber = iframeNumber;
+  }
+  
+  /**
+   * Get position.
+   *
+   * @return position
+   */
+  const T &getPoint() const {
+    return point;
+  }
+  
+  /**
+   * Set position.
+   *
+   * @param[in] position position
+   */
+  void setPoint(const T& ipoint) {
+    point = ipoint;
+  }
+  
+  /**
+   * Shift position.
+   *
+   * @param[in] t vector by which the position of the element should be shifted.
+   */
+  void shift(const T& t) {
+    point += t;
+  }
+
+ private:
+  /**
+   * Frame number.
+   */
+  unsigned int frameNumber;
+  
+  /**
+   * Position of the element.
+   */
+  T point;
+};
+
+template<typename T>
+static inline bool operator==(const TrajectoryElement<T>& a, const TrajectoryElement<T>& b) {
+  return (a.getFrameNumber() == b.getFrameNumber()) && (a.getPoint() == b.getPoint());
+}
+
+template<typename Ti, typename Tr>
+  std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, TrajectoryElement<Tr>& trajectoryElement) {
+  unsigned int frameNumber;
+  Tr point;
+  if (in >> frameNumber >> point) {
+    trajectoryElement.setFrameNumber(frameNumber);
+    trajectoryElement.setPoint(point);
+  }
+  return in;
+}
+
+template<typename Tr>
+std::ostream& operator<<(std::ostream& out, const TrajectoryElement<Tr>& trajectoryElement) {
+  out << trajectoryElement.getFrameNumber() << " " << trajectoryElement.getPoint();
+  return out;
+}
+
+#endif /* TRAJECTORYELEMENT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryExceptions.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,63 @@
+#ifndef TRAJECTORY_EXCEPTIONS_H
+#define TRAJECTORY_EXCEPTIONS_H
+
+#include <exception>
+#include <sstream>
+
+/**
+ * TrajectoryFrameNumberErrorException class.
+ */
+class TrajectoryFrameNumberErrorException: public std::exception {
+	/**
+	 * Return the name of the exception.
+	 *
+	 * @return The name of the exception
+	 */
+	virtual const char* what() const throw ()
+	{
+		return "TrajectoryFrameNumberErrorException";
+	}
+};
+
+/**
+ * TrajectoryLengthErrorException class.
+ *
+ * The TrajectoryLengthError exception should be invoked when a length of a trajectory is incorrect.
+ */
+class TrajectoryLengthErrorException: public std::exception {
+	/**
+	 * Return the name of the exception.
+	 *
+	 * @return The name of the exception
+	 */
+	virtual const char* what() const throw ()
+	{
+		return "TrajectoryLengthErrorException";
+	}
+};
+
+/**
+ * TrajectoryOutOfRangeErrorException class.
+ */
+class TrajectoryOutOfRangeErrorException: public std::exception {
+ public:
+ TrajectoryOutOfRangeErrorException(const unsigned int& _i = -1)
+   : i(_i) {}
+  
+ protected:
+  int i;
+  
+  /**
+   * Return the name of the exception.
+   *
+   * @return The name of the exception
+   */
+  virtual const char* what() const throw ()
+  {
+    std::stringstream ss;
+    ss << "TrajectoryOutOfRangeErrorException: " << i;
+    return  ss.str().c_str();
+  }
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryWriter.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,190 @@
+#ifndef TRAJECTORYWRITER_H_
+#define TRAJECTORYWRITER_H_
+
+#include <fstream>
+
+#include "Trajectory.h"
+
+/**
+ * TrajectoryWriter class.
+ *
+ * The TrajectoryWriter class allows to save trajectories in different formats like image files, Matlab, Scilab or FreeMat files.
+ */
+class TrajectoryWriter
+{
+public:
+	/**
+	 * Save the trajectory in the image.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @param[in] color color of the trajectory
+	 * @param[in] img image on which the trajectory should be saved
+	 * @return image with the saved trajectory
+	 */
+	template<typename T>
+	  void write(const Trajectory<T> &trajectory, CvScalar color, cv::Mat& img = cv::Mat::Mat())
+	{
+	  if (img.empty())
+	    {
+	      img = createImg(trajectory);
+	    }
+	  
+	  writeOnNotNullImg(trajectory, color, img);
+	}
+
+	/**
+	 * Save trajectories in the image.
+	 *
+	 * @param[in] img image on which the trajectory should be saved
+	 * @param[in] trajectories trajectories
+	 * @param[in] colors colors of trajectories
+	 * @return image with saved trajectories
+	 */
+	template<typename T>
+	  void saveInIplImage(cv::Mat& img, std::vector<Trajectory<T> > *trajectories, std::vector<CvScalar> *colors)
+	{
+	  assert( !img.empty());
+	  assert( trajectories != NULL );
+	  assert( trajectories->size() > 0 );
+	  assert( colors != NULL );
+	  assert( colors->size() > 0 );
+
+	  unsigned nbOfColors = colors->size();
+	  
+	  for (unsigned i = 0; i < trajectories->size(); ++i)
+	    {
+	      Trajectory<T> trajectory = (*trajectories)[i];
+	      CvScalar color = (*colors)[i % nbOfColors];
+	      writeOnNotNullImg(trajectory, color, img);
+	    }
+	}
+
+	/**
+	 * Save trajectories in the Matlab format file.
+	 *
+	 * @param[in] file name of the file
+	 * @param[in] trajectories trajectories
+	 * @param[in] writeWithVisualization information if functions to visualize data should be written into the file
+	 * @param[in] plotCommand2D command to plot in 2D
+	 * @param[in] plotCommand3D command to plot in 3D
+	 */
+	template<typename T>
+	void saveInMatlabFormat(const char *file, std::vector<Trajectory<T> > *trajectories, bool writeWithVisualization = true, const char *plotCommand2D = "plot", const char *plotCommand3D = "plot3d")
+	{
+		saveInMatlabScilabFormat(file, trajectories, writeWithVisualization, plotCommand2D, plotCommand3D, true);
+	}
+
+	/**
+	 * Save trajectories in the Scilab format file.
+	 *
+	 * @param[in] file name of the file
+	 * @param[in] trajectories trajectories
+	 * @param[in] writeWithVisualization information if functions to visualize data should be written into the file
+	 * @param[in] plotCommand2D command to plot in 2D
+	 * @param[in] plotCommand3D command to plot in 3D
+	 */
+	template<typename T>
+	void saveInScilabFormat(const char *file, std::vector<Trajectory<T> > *trajectories, bool writeWithVisualization = true, const char *plotCommand2D = "plot", const char *plotCommand3D = "plot3d")
+	{
+		saveInMatlabScilabFormat(file, trajectories, writeWithVisualization, plotCommand2D, plotCommand3D, false);
+	}
+
+private:
+	/**
+	 * Create image on which the trajectory can be saved.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @return image
+	 */
+	template<typename T>
+	  cv::Mat createImg(const Trajectory<cv::Point_<T> > &trajectory)
+	{
+		cv::Point_<T> _min = min(trajectory);
+		cv::Point_<T> _max = max(trajectory);
+		CvSize imgSize = cvSize(_max.x + 1, _max.y + 1);
+		cv::Mat img = cv::Mat::zeros(imgSize, CV_8UC3);
+		return img;
+	}
+
+	/**
+	 * Save the trajectory in the image.
+	 *
+	 * @param[in] trajectory trajectory
+	 * @param[in] color color of the trajectory
+	 * @param[in] img image on which the trajectory should be saved
+	 * @return image with the saved trajectory
+	 */
+	template<typename T>
+	  void writeOnNotNullImg(const Trajectory<T> &trajectory, CvScalar color, cv::Mat& img)
+	{
+	  assert( !img.empty() );
+		for (unsigned int i = 1; i < trajectory.size(); ++i)
+		{
+			const T p1 = trajectory.getPoint(i - 1);
+			const T p2 = trajectory.getPoint(i);
+			cv::line(img, p1, p2, color);
+		}
+	}
+
+	/**
+	 * Save trajectories in the Matlab or Scilab format file.
+	 *
+	 * @param[in] file name of the file
+	 * @param[in] trajectories trajectories
+	 * @param[in] writeWithVisualization information if functions to visualize data should be written into the file
+	 * @param[in] plotCommand2D command to plot in 2D
+	 * @param[in] plotCommand3D command to plot in 3D
+	 * @param[in] matlab information whether trajectories should be saved in Matlab or Scilab format
+	 */
+	template<typename T>
+	void saveInMatlabScilabFormat(const char *file, std::vector<Trajectory<T> > *trajectories, bool writeWithVisualization, const char *plotCommand2D, const char *plotCommand3D, bool matlab)
+	{
+		if (trajectories == NULL)
+		{
+			assert( false );
+		}
+
+		std::stringstream matlabFileSS;
+
+		if (matlab)
+		{
+			matlabFileSS << "hold on;\n";
+		}
+
+		for (unsigned i = 0; i < trajectories->size(); ++i)
+		{
+			matlabFileSS << "T";
+			matlabFileSS << i << "=[";
+
+			for (unsigned j = 0; j < (*trajectories)[i].size(); ++j)
+			{
+				matlabFileSS << (*trajectories)[i].getPoint(j);
+
+				if (j < (*trajectories)[i].size() - 1)
+				{
+					matlabFileSS << ";";
+				}
+			}
+
+			matlabFileSS << "];\n";
+
+			if (writeWithVisualization)
+			{
+				matlabFileSS << "if size(T" << i << ",2) == 2\n";
+				matlabFileSS << "\t\t" << plotCommand2D << "( T" << i << "(:,1), T" << i << "(:,2) );\n";
+				matlabFileSS << "end;\n";
+				matlabFileSS << "if size(T" << i << ",2) == 3\n";
+				matlabFileSS << "\t\t" << plotCommand3D << "( T" << i << "(:,1), T" << i << "(:,2), T" << i << "(:,3) );\n";
+				matlabFileSS << "end;\n";
+			}
+		}
+
+		std::ofstream matlabFile;
+		matlabFile.open(file, std::ios::out);
+		matlabFile << matlabFileSS.str();
+		matlabFile.flush();
+		matlabFile.close();
+	}
+};
+
+#endif /* TRAJECTORYWRITER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/doxygen.config	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,1551 @@
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = Trajectory Management And Analysis
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = ../doc/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+#  plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/CanberraMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,83 @@
+#include "CanberraMetricTest.h"
+
+void CanberraMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new CanberraMetric<CvPoint> ();
+}
+
+void CanberraMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void CanberraMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result),
+			TrajectoryLengthErrorException);
+}
+
+void CanberraMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void CanberraMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(2));
+}
+
+void CanberraMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(2));
+}
+
+void CanberraMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(4));
+}
+
+void CanberraMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	unsigned maxRand = 10000;
+	srand(time(NULL));
+	double correctResult = double(0);
+	for (unsigned i = 0; i < n; ++i)
+	{
+		unsigned rand1 = rand() % maxRand;
+		unsigned rand2 = rand() % maxRand;
+		trajectoryA->add(cvPoint(rand1, rand2));
+		trajectoryB->add(cvPoint(rand1 + 3, rand2 + 4));
+		correctResult += double(3) / double(rand1 * 2 + 3) + double(4) / double(rand2 * 2 + 4);
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_DOUBLES_EQUAL(result, correctResult, 1e-10);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/CanberraMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef CANBERRAMETRICTEST_H_
+#define CANBERRAMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/CanberraMetric.h"
+using namespace std;
+
+class CanberraMetricTest: public CPPUNIT_NS::TestCase
+{
+CPPUNIT_TEST_SUITE( CanberraMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* CANBERRAMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/ChebyshevMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,76 @@
+#include "ChebyshevMetricTest.h"
+
+void ChebyshevMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new ChebyshevMetric<CvPoint, int> ();
+}
+
+void ChebyshevMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void ChebyshevMetricTest::testMetric1(void)
+{
+	int result = 0;
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void ChebyshevMetricTest::testMetric2(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 0);
+}
+
+void ChebyshevMetricTest::testMetric3(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 1);
+}
+
+void ChebyshevMetricTest::testMetric4(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 4);
+}
+
+void ChebyshevMetricTest::testMetric5(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 4);
+}
+
+void ChebyshevMetricTest::testMetric6(void)
+{
+	int result = 0;
+	unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+		trajectoryB ->add(cvPoint(i * 2, i * 3));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, int((n - 1) * 2));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/ChebyshevMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef CHEBYSHEVMETRICTEST_H_
+#define CHEBYSHEVMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/ChebyshevMetric.h"
+using namespace std;
+
+class ChebyshevMetricTest: public CPPUNIT_NS::TestCase
+{
+CPPUNIT_TEST_SUITE( ChebyshevMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, int> *metric;
+};
+
+#endif /* CHEBYSHEVMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/DBSQLiteAccessTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,301 @@
+#include "DBSQLiteAccessTest.h"
+
+void DBSQLiteAccessTest::setUp(void)
+{
+	db = new DBSQLiteAccess();
+
+	dbName = "XXXXXX.sqlite";
+	int res = mkstemps((char*) dbName.c_str(), 7);
+	CPPUNIT_ASSERT(res != -1);
+}
+
+void DBSQLiteAccessTest::tearDown(void)
+{
+	delete db;
+	remove(dbName.c_str());
+}
+
+void DBSQLiteAccessTest::testConnect1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+}
+
+void DBSQLiteAccessTest::testConnect2(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+
+	string dbName2 = "XXXXXX.sqlite";
+	int res = mkstemps((char*) dbName2.c_str(), 7);
+	CPPUNIT_ASSERT(res != -1);
+
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName2.c_str()), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+
+	remove(dbName2.c_str());
+}
+
+void DBSQLiteAccessTest::testConnect3(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect("TestRunner/"), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), false);
+	CPPUNIT_ASSERT_EQUAL(db->connect("TestRunner/"), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), false);
+}
+
+void DBSQLiteAccessTest::testConnect4(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+	CPPUNIT_ASSERT_EQUAL(db->connect("TestRunner/"), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+}
+
+void DBSQLiteAccessTest::testConnect5(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect("TestRunner/"), false);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), false);
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+}
+
+void DBSQLiteAccessTest::testDisconnect1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(false, db->isConnected());
+	CPPUNIT_ASSERT_EQUAL(true, db->disconnect());
+	CPPUNIT_ASSERT_EQUAL(false, db->isConnected());
+}
+
+void DBSQLiteAccessTest::testDisconnect2(void)
+{
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+	CPPUNIT_ASSERT_EQUAL(db->disconnect(), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), false);
+	CPPUNIT_ASSERT_EQUAL(db->connect(dbName.c_str()), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), true);
+	CPPUNIT_ASSERT_EQUAL(db->disconnect(), true);
+	CPPUNIT_ASSERT_EQUAL(db->isConnected(), false);
+}
+
+void DBSQLiteAccessTest::testDisconnect3(void)
+{
+	string dbName2 = "XXXXXX.sqlite";
+	int res = mkstemps((char*) dbName2.c_str(), 7);
+	CPPUNIT_ASSERT(res != -1);
+
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->isConnected());
+
+	CPPUNIT_ASSERT_EQUAL(false, db->connect(dbName2.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->isConnected());
+
+	CPPUNIT_ASSERT_EQUAL(true, db->disconnect());
+	CPPUNIT_ASSERT_EQUAL(false, db->isConnected());
+
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName2.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->isConnected());
+	CPPUNIT_ASSERT_EQUAL(true, db->disconnect());
+	CPPUNIT_ASSERT_EQUAL(false, db->isConnected());
+
+	remove(dbName2.c_str());
+}
+
+void DBSQLiteAccessTest::testSqliteErrCodeMsg1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(false, db->connect("TestRunner/"));
+	CPPUNIT_ASSERT_EQUAL(SQLITE_MISUSE, db->sqliteErrCode());
+	CPPUNIT_ASSERT_EQUAL(*"library routine called out of sequence", *db->sqliteErrMsg());
+}
+
+void DBSQLiteAccessTest::testSqliteErrCodeMsg2(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(false, db->executeStatement("create table A ();"));
+	CPPUNIT_ASSERT_EQUAL(SQLITE_ERROR, db->sqliteErrCode());
+	CPPUNIT_ASSERT_EQUAL(*"near \")\": syntax error", *db->sqliteErrMsg());
+}
+
+void DBSQLiteAccessTest::testSqliteErrCodeMsg3(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( A INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(false, db->executeStatement("create table A ( A INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(SQLITE_ERROR, db->sqliteErrCode());
+	CPPUNIT_ASSERT_EQUAL(*"table A already exists", *db->sqliteErrMsg());
+}
+
+void DBSQLiteAccessTest::testSqliteErrCodeMsg4(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(false, db->executeStatement("select * from A;"));
+	CPPUNIT_ASSERT_EQUAL(SQLITE_ERROR, db->sqliteErrCode());
+	CPPUNIT_ASSERT_EQUAL(*"no such table: A", *db->sqliteErrMsg());
+}
+
+void DBSQLiteAccessTest::testExecuteStatement1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+
+	int size;
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( a INTEGER, b INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(0, size);
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(1, size);
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(2, size);
+}
+
+void DBSQLiteAccessTest::testExecuteStatement2(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+
+	string size;
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( a INTEGER, b INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(*"0", *size.c_str());
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(*"1", *size.c_str());
+
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(*"2", *size.c_str());
+}
+
+void DBSQLiteAccessTest::testExecuteStatementGetMatrix(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( a INTEGER, b INTEGER, c INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2, 3);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(4, 5, 6);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(7, 8, 9);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(10, 11, 12);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(13, 14, 15);"));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(16, 17, 18);"));
+
+	const string correctResult[6][3] =
+	{
+	{ "1", "2", "3" },
+	{ "4", "5", "6" },
+	{ "7", "8", "9" },
+	{ "10", "11", "12" },
+	{ "13", "14", "15" },
+	{ "16", "17", "18" } };
+
+	vector<vector<string> > returnedData;
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetMatrix("select * from A;", returnedData));
+
+	for (unsigned int row = 0; row < 6; ++row)
+	{
+		for (unsigned int col = 0; col < 3; ++col)
+		{
+			CPPUNIT_ASSERT_EQUAL(correctResult[row][col], returnedData[row][col]);
+		}
+	}
+}
+
+void DBSQLiteAccessTest::testTransaction1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(false, db->begin());
+	CPPUNIT_ASSERT_EQUAL(false, db->begin());
+}
+
+void DBSQLiteAccessTest::testTransaction2(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(false, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(false, db->rollback());
+}
+
+void DBSQLiteAccessTest::testTransaction3(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->rollback());
+}
+
+void DBSQLiteAccessTest::testTransaction4(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->commit());
+	CPPUNIT_ASSERT_EQUAL(false, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->commit());
+	CPPUNIT_ASSERT_EQUAL(false, db->rollback());
+}
+
+void DBSQLiteAccessTest::testTransaction5(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(false, db->commit());
+	CPPUNIT_ASSERT_EQUAL(false, db->commit());
+}
+
+void DBSQLiteAccessTest::testTransaction6(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->commit());
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->commit());
+}
+
+void DBSQLiteAccessTest::testTransaction7(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(false, db->commit());
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(false, db->commit());
+}
+
+void DBSQLiteAccessTest::testTransaction8(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( a INTEGER, b INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	int size;
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(1, size);
+	CPPUNIT_ASSERT_EQUAL(true, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(false, db->commit());
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(0, size);
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+}
+
+void DBSQLiteAccessTest::testTransaction9(void)
+{
+	CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("create table A ( a INTEGER, b INTEGER );"));
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatement("insert into A values(1, 2);"));
+	int size;
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(1, size);
+	CPPUNIT_ASSERT_EQUAL(true, db->commit());
+	CPPUNIT_ASSERT_EQUAL(false, db->rollback());
+	CPPUNIT_ASSERT_EQUAL(true, db->executeStatementGetSingleValue("select count(*) from A;", size));
+	CPPUNIT_ASSERT_EQUAL(1, size);
+	CPPUNIT_ASSERT_EQUAL(true, db->begin());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/DBSQLiteAccessTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,72 @@
+#ifndef DBSQLITEACCESSTEST_H_
+#define DBSQLITEACCESSTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include <stdlib.h>
+#include "../src/DBSQLiteAccess.h"
+using namespace std;
+
+class DBSQLiteAccessTest: public CPPUNIT_NS::TestCase
+{
+CPPUNIT_TEST_SUITE(DBSQLiteAccessTest);
+		CPPUNIT_TEST(testConnect1);
+		CPPUNIT_TEST(testConnect2);
+		CPPUNIT_TEST(testConnect3);
+		CPPUNIT_TEST(testConnect4);
+		CPPUNIT_TEST(testConnect5);
+		CPPUNIT_TEST(testDisconnect1);
+		CPPUNIT_TEST(testDisconnect2);
+		CPPUNIT_TEST(testDisconnect3);
+		CPPUNIT_TEST(testSqliteErrCodeMsg1);
+		CPPUNIT_TEST(testSqliteErrCodeMsg2);
+		CPPUNIT_TEST(testSqliteErrCodeMsg3);
+		CPPUNIT_TEST(testSqliteErrCodeMsg4);
+		CPPUNIT_TEST(testExecuteStatement1);
+		CPPUNIT_TEST(testExecuteStatement2);
+		CPPUNIT_TEST(testExecuteStatementGetMatrix);
+		CPPUNIT_TEST(testTransaction1);
+		CPPUNIT_TEST(testTransaction2);
+		CPPUNIT_TEST(testTransaction3);
+		CPPUNIT_TEST(testTransaction4);
+		CPPUNIT_TEST(testTransaction5);
+		CPPUNIT_TEST(testTransaction6);
+		CPPUNIT_TEST(testTransaction7);
+		CPPUNIT_TEST(testTransaction8);
+		CPPUNIT_TEST(testTransaction9);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+
+protected:
+	void testConnect1(void);
+	void testConnect2(void);
+	void testConnect3(void);
+	void testConnect4(void);
+	void testConnect5(void);
+	void testDisconnect1(void);
+	void testDisconnect2(void);
+	void testDisconnect3(void);
+	void testSqliteErrCodeMsg1(void);
+	void testSqliteErrCodeMsg2(void);
+	void testSqliteErrCodeMsg3(void);
+	void testSqliteErrCodeMsg4(void);
+	void testExecuteStatement1(void);
+	void testExecuteStatement2(void);
+	void testExecuteStatementGetMatrix(void);
+	void testTransaction1(void);
+	void testTransaction2(void);
+	void testTransaction3(void);
+	void testTransaction4(void);
+	void testTransaction5(void);
+	void testTransaction6(void);
+	void testTransaction7(void);
+	void testTransaction8(void);
+	void testTransaction9(void);
+
+private:
+	DBSQLiteAccess *db;
+	string dbName;
+};
+
+#endif /* DBSQLITEACCESSTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/DTWMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,79 @@
+#include "DTWMetricTest.h"
+
+void DTWMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new DTWMetric<CvPoint, double> ();
+}
+
+void DTWMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void DTWMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void DTWMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void DTWMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(2)));
+}
+
+void DTWMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(5));
+}
+
+void DTWMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	for (unsigned i = 1; i <= n; ++i)
+	{
+		trajectoryA->add(cvPoint(i * 100, i * 100));
+		trajectoryB ->add(cvPoint(i * 100 + 3, i * 100 + 4));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(n * 5));
+}
+
+void DTWMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	for (unsigned i = 1; i <= n; ++i)
+	{
+		trajectoryA->add(cvPoint(i * 100, i * 100));
+		trajectoryB ->add(cvPoint(i * 100 + 6, i * 100 + 8));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(n * sqrt(double(100))));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/DTWMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef DTWMETRICTEST_H_
+#define DTWMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/DTWMetric.h"
+using namespace std;
+
+class DTWMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( DTWMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* DTWMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/EuclideanMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,80 @@
+#include "EuclideanMetricTest.h"
+
+void EuclideanMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new EuclideanMetric<CvPoint, double> ();
+}
+
+void EuclideanMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void EuclideanMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void EuclideanMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void EuclideanMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(sqrt(2)));
+}
+
+void EuclideanMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(5));
+}
+
+void EuclideanMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(50)));
+}
+
+void EuclideanMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	unsigned maxRand = 10000;
+	srand(time(NULL));
+	for (unsigned i = 0; i < n; ++i)
+	{
+		unsigned rand1 = rand() % maxRand;
+		unsigned rand2 = rand() % maxRand;
+		trajectoryA->add(cvPoint(rand1, rand2));
+		trajectoryB ->add(cvPoint(rand1 + 3, rand2 + 4));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(n * 9 + n * 16)));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/EuclideanMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef EUCLIDIANMETRICTEST_H_
+#define EUCLIDIANMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/EuclideanMetric.h"
+using namespace std;
+
+class EuclideanMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( EuclideanMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* EUCLIDIANMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/HausdorffMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,98 @@
+#include "HausdorffMetricTest.h"
+
+void HausdorffMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new HausdorffMetric<CvPoint, double> ();
+}
+
+void HausdorffMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void HausdorffMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void HausdorffMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void HausdorffMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void HausdorffMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(2)));
+}
+
+void HausdorffMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(5));
+}
+
+void HausdorffMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		trajectoryA->add(cvPoint(0, i));
+		trajectoryB ->add(cvPoint(1, i));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(1));
+}
+
+void HausdorffMetricTest::testMetric7(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+		trajectoryB ->add(cvPoint(n + i, n - 2 + i));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, norm(cv::Point_<int>(n, n - 2)));
+}
+
+void HausdorffMetricTest::testMetric8(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+	}
+	trajectoryB ->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, norm(cv::Point_<int>(n - 1, n - 1)));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/HausdorffMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,38 @@
+#ifndef HAUSDORFFMETRICTEST_H_
+#define HAUSDORFFMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/HausdorffMetric.h"
+using namespace std;
+
+class HausdorffMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( HausdorffMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+		CPPUNIT_TEST( testMetric7);
+		CPPUNIT_TEST( testMetric8);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+	void testMetric7(void);
+	void testMetric8(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* HAUSDORFFMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/HuMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,80 @@
+#include "HuMetricTest.h"
+
+void HuMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new HuMetric<CvPoint,double> ();
+}
+
+void HuMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void HuMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void HuMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void HuMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(2)) / double(2));
+}
+
+void HuMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(5)/double(2));
+}
+
+void HuMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(50))/double(4));
+}
+
+void HuMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	unsigned maxRand = 10000;
+	srand(time(NULL));
+	for (unsigned i = 0; i < n; ++i)
+	{
+		unsigned rand1 = rand() % maxRand;
+		unsigned rand2 = rand() % maxRand;
+		trajectoryA->add(cvPoint(rand1, rand2));
+		trajectoryB ->add(cvPoint(rand1 + 3, rand2 + 4));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, sqrt(double(n * 9 + n * 16))/double(n * 2));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/HuMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef HUMETRICTEST_H_
+#define HUMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/HuMetric.h"
+using namespace std;
+
+class HuMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( HuMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* HUMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/LCSMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,84 @@
+#include "LCSMetricTest.h"
+
+void LCSMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new LCSMetric<CvPoint, unsigned int> ();
+}
+
+void LCSMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void LCSMetricTest::testMetric1(void)
+{
+	unsigned int result = 0;
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, (unsigned int)(0));
+}
+
+void LCSMetricTest::testMetric2(void)
+{
+	unsigned int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, (unsigned int)(1));
+}
+
+void LCSMetricTest::testMetric3(void)
+{
+	unsigned int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, (unsigned int)(0));
+}
+
+void LCSMetricTest::testMetric4(void)
+{
+	unsigned int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, (unsigned int)(0));
+}
+
+void LCSMetricTest::testMetric5(void)
+{
+	unsigned int result = 0;
+	unsigned n = 50;
+	for (unsigned i = 1; i <= n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+		trajectoryB ->add(cvPoint(n - i + 1, n - 1 + 1));
+	}
+	for (unsigned i = 1; i <= n; ++i)
+	{
+		trajectoryA ->add(cvPoint(n - i + 1, n - 1 + 1));
+		trajectoryB->add(cvPoint(i, i));
+	}
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, (unsigned int)(50));
+}
+
+void LCSMetricTest::testMetric6(void)
+{
+	unsigned int result = 0;
+	unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+		trajectoryB ->add(cvPoint(i + 3, i + 3));
+	}
+	metric->similarity(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, n - 3);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/LCSMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef LCSMETRICTEST_H_
+#define LCSMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/LCSMetric.h"
+using namespace std;
+
+class LCSMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( LCSMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, unsigned int> *metric;
+};
+
+#endif /* LCSMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/ManhattanMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,81 @@
+#include "ManhattanMetricTest.h"
+
+void ManhattanMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new ManhattanMetric<CvPoint, int> ();
+}
+
+void ManhattanMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void ManhattanMetricTest::testMetric1(void)
+{
+	int result = 0;
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result),
+			TrajectoryLengthErrorException);
+}
+
+void ManhattanMetricTest::testMetric2(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 0);
+}
+
+void ManhattanMetricTest::testMetric3(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 2);
+}
+
+void ManhattanMetricTest::testMetric4(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 7);
+}
+
+void ManhattanMetricTest::testMetric5(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 14);
+}
+
+void ManhattanMetricTest::testMetric6(void)
+{
+	int result = 0;
+	unsigned n = 100;
+	unsigned maxRand = 10000;
+	srand(time(NULL));
+	for (unsigned i = 0; i < n; ++i)
+	{
+		unsigned rand1 = rand() % maxRand;
+		unsigned rand2 = rand() % maxRand;
+		trajectoryA->add(cvPoint(rand1, rand2));
+		trajectoryB ->add(cvPoint(rand1 + 3, rand2 + 4));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, int(n * 3 + n * 4));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/ManhattanMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef MANHATTANMETRICTEST_H_
+#define MANHATTANMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/ManhattanMetric.h"
+using namespace std;
+
+class ManhattanMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( ManhattanMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, int> *metric;
+};
+
+#endif /* MANHATTANMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/MinimumMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,76 @@
+#include "MinimumMetricTest.h"
+
+void MinimumMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new MinimumMetric<CvPoint, int> ();
+}
+
+void MinimumMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void MinimumMetricTest::testMetric1(void)
+{
+	int result = 0;
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result), TrajectoryLengthErrorException);
+}
+
+void MinimumMetricTest::testMetric2(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 0);
+}
+
+void MinimumMetricTest::testMetric3(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 1);
+}
+
+void MinimumMetricTest::testMetric4(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 3);
+}
+
+void MinimumMetricTest::testMetric5(void)
+{
+	int result = 0;
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(6, 8));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 3);
+}
+
+void MinimumMetricTest::testMetric6(void)
+{
+	int result = 0;
+	unsigned n = 100;
+	for (unsigned i = 1; i <= n; ++i)
+	{
+		trajectoryA->add(cvPoint(i, i));
+		trajectoryB ->add(cvPoint(i * 2 + 10, i * 3 + 10));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, 11);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/MinimumMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef MINIMUMMETRICTEST_H_
+#define MINIMUMMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/MinimumMetric.h"
+using namespace std;
+
+class MinimumMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( MinimumMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, int> *metric;
+};
+
+#endif /* MINIMUMMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/PointOperationsTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,152 @@
+#include "PointOperationsTest.h"
+
+void PointOperationsTest::testInitPoint(void)
+{
+	testInitPoint2D(cv::Point_<ushort>(10, 20), 10, 20, 30);
+	testInitPoint2D(cv::Point_<short int>(10, 20), 10, 20, 30);
+	testInitPoint2D(cv::Point_<unsigned int>(10, 20), 10, 20, 30);
+	testInitPoint2D(cv::Point_<int>(10, 20), 10, 20, 30);
+	testInitPoint2D(cv::Point_<float>(10.1, 20.1), 10.1, 20.1, 30.1);
+	testInitPoint2D(cv::Point_<double>(10.1, 20.1), 10.1, 20.1, 30.1);
+
+	testInitPoint3D(cv::Point3_<ushort>(10, 20, 30), 10, 20, 30);
+	testInitPoint3D(cv::Point3_<short int>(10, 20, 30), 10, 20, 30);
+	testInitPoint3D(cv::Point3_<unsigned int>(10, 20, 30), 10, 20, 30);
+	testInitPoint3D(cv::Point3_<int>(10, 20, 30), 10, 20, 30);
+	testInitPoint3D(cv::Point3_<float>(10.1, 20.1, 30.1), 10.1, 20.1, 30.1);
+	testInitPoint3D(cv::Point3_<double>(10.1, 20.1, 30.1), 10.1, 20.1, 30.1);
+
+	testInitPoint2D(cvPoint(10, 20), 10, 20, 30);
+	testInitPoint2D(cvPoint2D32f(10.1, 20.2), 10.1, 20.2, 30.3);
+	testInitPoint3D(cvPoint3D32f(10.1, 20.2, 30.3), 10.1, 20.2, 30.3);
+	testInitPoint2D(cvPoint2D64f(10.1, 20.2), 10.1, 20.2, 30.3);
+	testInitPoint3D(cvPoint3D64f(10.1, 20.2, 30.3), 10.1, 20.2, 30.3);
+}
+
+void PointOperationsTest::testNorm(void)
+{
+	CPPUNIT_ASSERT_EQUAL(norm(cvPoint(10, 20)), norm(cv::Point_<int>(10, 20)));
+	CPPUNIT_ASSERT_EQUAL(norm(cvPoint2D32f(10.1, 20.2)), norm(cv::Point_<float>(10.1, 20.2)));
+	CPPUNIT_ASSERT_EQUAL(norm(cvPoint3D32f(10.1, 20.2, 30.3)), norm(cv::Point3_<float>(10.1, 20.2, 30.3)));
+	CPPUNIT_ASSERT_EQUAL(norm(cvPoint2D64f(10.1, 20.2)), norm(cv::Point_<double>(10.1, 20.2)));
+	CPPUNIT_ASSERT_EQUAL(norm(cvPoint3D64f(10.1, 20.2, 30.3)), norm(cv::Point3_<double>(10.1, 20.2, 30.3)));
+}
+
+void PointOperationsTest::testDim(void)
+{
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<ushort>()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<short int>()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<unsigned int>()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<int>()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<float>()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point_<double>()), (unsigned int) 2);
+
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<ushort>()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<short int>()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<unsigned int>()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<int>()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<float>()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(cv::Point3_<double>()), (unsigned int) 3);
+
+	CPPUNIT_ASSERT_EQUAL(dim(CvPoint()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(CvPoint2D32f()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(CvPoint3D32f()), (unsigned int) 3);
+	CPPUNIT_ASSERT_EQUAL(dim(CvPoint2D64f()), (unsigned int) 2);
+	CPPUNIT_ASSERT_EQUAL(dim(CvPoint3D64f()), (unsigned int) 3);
+}
+
+void PointOperationsTest::testMinMax(void)
+{
+	testMinMax<cv::Point_<ushort>, ushort> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point_<short int>, short int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point_<unsigned int>, unsigned int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point_<int>, int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point_<float>, float> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+	testMinMax<cv::Point_<double>, double> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+
+	testMinMax<cv::Point3_<ushort>, ushort> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point3_<short int>, short int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point3_<unsigned int>, unsigned int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point3_<int>, int> (10, 20, 30, 20, 10, 20);
+	testMinMax<cv::Point3_<float>, float> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+	testMinMax<cv::Point3_<double>, double> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+
+	testMinMax<CvPoint, int> (10, 20, 30, 20, 10, 20);
+	testMinMax<CvPoint2D32f, float> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+	testMinMax<CvPoint3D32f, float> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+	testMinMax<CvPoint2D64f, double> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+	testMinMax<CvPoint3D64f, double> (10.1, 20.2, 30.3, 20.4, 10.5, 20.6);
+}
+
+void PointOperationsTest::testOperatorEqNotEq(void)
+{
+	testOperatorEqNotEq<cv::Point_<ushort>, ushort> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point_<short int>, short int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point_<unsigned int>, unsigned int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point_<int>, int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point_<float>, float> (10.1, 20.2, 30.3, 0.1);
+	testOperatorEqNotEq<cv::Point_<double>, double> (10.1, 20.2, 30.3, 0.1);
+
+	testOperatorEqNotEq<cv::Point3_<ushort>, ushort> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point3_<short int>, short int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point3_<unsigned int>, unsigned int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point3_<int>, int> (10, 20, 30, 1);
+	testOperatorEqNotEq<cv::Point3_<float>, float> (10.1, 20.2, 30.3, 0.1);
+	testOperatorEqNotEq<cv::Point3_<double>, double> (10.1, 20.2, 30.3, 0.1);
+
+	testOperatorEqNotEq<CvPoint, int> (10, 20, 30, 1);
+	testOperatorEqNotEq<CvPoint2D32f, float> (10.1, 20.2, 30.3, 0.1);
+	testOperatorEqNotEq<CvPoint3D32f, float> (10.1, 20.2, 30.3, 0.1);
+	testOperatorEqNotEq<CvPoint2D64f, double> (10.1, 20.2, 30.3, 0.1);
+	testOperatorEqNotEq<CvPoint3D64f, double> (10.1, 20.2, 30.3, 0.1);
+}
+
+void PointOperationsTest::testOperatorMi1(void)
+{
+	CPPUNIT_ASSERT_EQUAL(-cvPoint(10, -20), cvPoint(-10.1, 20.2));
+	CPPUNIT_ASSERT_EQUAL(-cvPoint2D32f(10.1, -20.2), cvPoint2D32f(-10.1, 20.2));
+	CPPUNIT_ASSERT_EQUAL(-cvPoint3D32f(10.1, -20.2, 30.3), cvPoint3D32f(-10.1, 20.2, -30.3));
+	CPPUNIT_ASSERT_EQUAL(-cvPoint2D64f(10.1, -20.2), cvPoint2D64f(-10.1, 20.2));
+	CPPUNIT_ASSERT_EQUAL(-cvPoint3D64f(10.1, -20.2, 30.3), cvPoint3D64f(-10.1, 20.2, -30.3));
+}
+
+void PointOperationsTest::testOperatorPl(void)
+{
+	testOperatorPl(cvPoint(10, 20), cvPoint(1, 2), cvPoint(11, 22));
+	testOperatorPl(cvPoint2D32f(10.1, 20.2), cvPoint2D32f(1.1, 2.2), cvPoint2D32f(11.2, 22.4));
+	testOperatorPl(cvPoint3D32f(10.1, 20.2, 30.3), cvPoint3D32f(1.1, 2.2, 3.3), cvPoint3D32f(11.2, 22.4, 33.6));
+	testOperatorPl(cvPoint2D64f(10.1, 20.2), cvPoint2D64f(1.1, 2.2), cvPoint2D64f(11.2, 22.4));
+	testOperatorPl(cvPoint3D64f(10.1, 20.2, 30.3), cvPoint3D64f(1.1, 2.2, 3.3), cvPoint3D64f(11.2, 22.4, 33.6));
+}
+
+void PointOperationsTest::testOperatorMi2(void)
+{
+	testOperatorMi(cvPoint(10, 20), cvPoint(1, 2), cvPoint(11, 22));
+	testOperatorMi(cvPoint2D32f(10.1, 20.2), cvPoint2D32f(1.1, 2.2), cvPoint2D32f(11.2, 22.4));
+	testOperatorMi(cvPoint3D32f(10.1, 20.2, 30.3), cvPoint3D32f(1.1, 2.2, 3.3), cvPoint3D32f(11.2, 22.4, 33.6));
+	testOperatorMi(cvPoint2D64f(10.1, 20.2), cvPoint2D64f(1.1, 2.2), cvPoint2D64f(11.2, 22.4));
+	testOperatorMi(cvPoint3D64f(10.1, 20.2, 30.3), cvPoint3D64f(1.1, 2.2, 3.3), cvPoint3D64f(11.2, 22.4, 33.6));
+}
+
+void PointOperationsTest::testOperatorInOut(void)
+{
+	testOperatorInOut(cv::Point_<ushort>(10, 20), "10 20");
+	testOperatorInOut(cv::Point_<short int>(10, 20), "10 20");
+	testOperatorInOut(cv::Point_<unsigned int>(10, 20), "10 20");
+	testOperatorInOut(cv::Point_<int>(10, 20), "10 20");
+	testOperatorInOut(cv::Point_<float>(10.1, 20.2), "10.1 20.2");
+	testOperatorInOut(cv::Point_<double>(10.1, 20.2), "10.1 20.2");
+
+	testOperatorInOut(cv::Point3_<ushort>(10, 20, 30), "10 20 30");
+	testOperatorInOut(cv::Point3_<short int>(10, 20, 30), "10 20 30");
+	testOperatorInOut(cv::Point3_<unsigned int>(10, 20, 30), "10 20 30");
+	testOperatorInOut(cv::Point3_<int>(10, 20, 30), "10 20 30");
+	testOperatorInOut(cv::Point3_<float>(10.1, 20.2, 30.3), "10.1 20.2 30.3");
+	testOperatorInOut(cv::Point3_<double>(10.1, 20.2, 30.3), "10.1 20.2 30.3");
+
+	testOperatorInOut(cvPoint(10, 20), "10 20");
+	testOperatorInOut(cvPoint2D32f(10.1, 20.2), "10.1 20.2");
+	testOperatorInOut(cvPoint3D32f(10.1, 20.2, 30.3), "10.1 20.2 30.3");
+	testOperatorInOut(cvPoint2D64f(10.1, 20.2), "10.1 20.2");
+	testOperatorInOut(cvPoint3D64f(10.1, 20.2, 30.3), "10.1 20.2 30.3");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/PointOperationsTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,160 @@
+#ifndef POINTOPERATIONSTEST_H_
+#define POINTOPERATIONSTEST_H_
+
+#include "../src/Trajectory.h"
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace std;
+
+class PointOperationsTest: public CPPUNIT_NS::TestCase
+{
+  CPPUNIT_TEST_SUITE(PointOperationsTest);
+  CPPUNIT_TEST(testInitPoint);
+  CPPUNIT_TEST(testNorm);
+  CPPUNIT_TEST(testDim);
+  CPPUNIT_TEST(testMinMax);
+  CPPUNIT_TEST(testOperatorEqNotEq);
+  CPPUNIT_TEST(testOperatorMi1);
+  CPPUNIT_TEST(testOperatorPl);
+  CPPUNIT_TEST(testOperatorMi2);
+  //CPPUNIT_TEST(testOperatorInOut);
+  CPPUNIT_TEST_SUITE_END();
+
+protected:
+	void testInitPoint(void);
+	void testNorm(void);
+	void testDim(void);
+	void testMinMax(void);
+	void testOperatorEqNotEq(void);
+	void testOperatorMi1(void);
+	void testOperatorPl(void);
+	void testOperatorMi2(void);
+	void testOperatorInOut(void);
+
+private:
+	template<typename Tclass, typename Tparam>
+	void testInitPoint2D(const Tclass &correctPoint, const Tparam x, const Tparam y, const Tparam z)
+	{
+		Tclass point;
+		initPoint(point, x, y);
+		CPPUNIT_ASSERT_EQUAL(point, correctPoint);
+
+		testInitPoint3D(correctPoint, x, y, z);
+	}
+
+	template<typename Tclass, typename Tparam>
+	void testInitPoint3D(const Tclass &correctPoint, const Tparam x, const Tparam y, const Tparam z)
+	{
+		Tclass point;
+		initPoint(point, x, y, z);
+		CPPUNIT_ASSERT_EQUAL(point, correctPoint);
+	}
+
+	template<typename Tclass, typename Tparam>
+	void testMinMax(Tparam x1, Tparam y1, Tparam z1, Tparam x2, Tparam y2, Tparam z2)
+	{
+		Tclass point1, point2, pointMin, pointMax;
+		initPoint(point1, x1, y1, z1);
+		initPoint(point2, x2, y2, z2);
+		initPoint(pointMin, min(x1, x2), min(y1, y2), min(z1, z2));
+		initPoint(pointMax, max(x1, x2), max(y1, y2), max(z1, z2));
+		CPPUNIT_ASSERT_EQUAL(min(point1, point2), pointMin);
+		CPPUNIT_ASSERT_EQUAL(min(point2, point1), pointMin);
+		CPPUNIT_ASSERT_EQUAL(max(point1, point2), pointMax);
+		CPPUNIT_ASSERT_EQUAL(max(point2, point1), pointMax);
+	}
+
+	template<typename Tclass, typename Tparam>
+	void testOperatorEqNotEq(const Tparam x1, const Tparam y1, const Tparam z1, const Tparam delta)
+	{
+		Tclass point1;
+		initPoint(point1, x1, y1, z1);
+
+		const Tclass point2 = point1;
+
+		initPoint(point1, x1, y1, z1);
+		CPPUNIT_ASSERT(point2 == point1);
+		CPPUNIT_ASSERT(!(point2 != point1));
+
+		initPoint(point1, (Tparam) (x1 + delta), y1, z1);
+		CPPUNIT_ASSERT(point2 != point1);
+		CPPUNIT_ASSERT(!(point2 == point1));
+
+		initPoint(point1, (Tparam) (x1 - delta), y1, z1);
+		CPPUNIT_ASSERT(point2 != point1);
+		CPPUNIT_ASSERT(!(point2 == point1));
+
+		initPoint(point1, x1, (Tparam) (y1 + delta), z1);
+		CPPUNIT_ASSERT(point2 != point1);
+		CPPUNIT_ASSERT(!(point2 == point1));
+
+		initPoint(point1, x1, (Tparam) (y1 - delta), z1);
+		CPPUNIT_ASSERT(point2 != point1);
+		CPPUNIT_ASSERT(!(point2 == point1));
+
+		initPoint(point1, x1, y1, (Tparam) (z1 + delta));
+		if (dim(point1) == 2)
+		{
+			CPPUNIT_ASSERT(point2 == point1);
+			CPPUNIT_ASSERT(!(point2 != point1));
+		}
+		else if (dim(point1) == 3)
+		{
+			CPPUNIT_ASSERT(point2 != point1);
+			CPPUNIT_ASSERT(!(point2 == point1));
+		}
+
+		initPoint(point1, x1, y1, (Tparam) (z1 - delta));
+		if (dim(point1) == 2)
+		{
+			CPPUNIT_ASSERT(point2 == point1);
+			CPPUNIT_ASSERT(!(point2 != point1));
+		}
+		else if (dim(point1) == 3)
+		{
+			CPPUNIT_ASSERT(point2 != point1);
+			CPPUNIT_ASSERT(!(point2 == point1));
+		}
+	}
+
+	template<typename T>
+	void testOperatorPl(const T point1, const T point2, const T point3)
+	{
+		const T point4 = point1 + point2;
+		CPPUNIT_ASSERT_EQUAL(point3, point4);
+
+		T point5 = point1;
+		point5 += point2;
+
+		CPPUNIT_ASSERT_EQUAL(point3, point5);
+	}
+
+	template<typename T>
+	void testOperatorMi(const T point3, const T point2, const T point1)
+	{
+		const T point4 = point1 - point2;
+		CPPUNIT_ASSERT_EQUAL(point3, point4);
+
+		T point5 = point1;
+		point5 -= point2;
+
+		CPPUNIT_ASSERT_EQUAL(point3, point5);
+	}
+
+	// problem: different format using the opencv Point to string with the proposed one for CvPoint
+	template<typename T>
+	void testOperatorInOut(const T point1, string s)
+	{
+		stringstream ss;
+		ss << point1;
+		CPPUNIT_ASSERT_EQUAL(ss.str(), s);
+
+		T point2;
+		istringstream is(s);
+		is >> point2;
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+};
+
+#endif /* POINTOPERATIONSTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/SquaredEuclideanMetricTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,81 @@
+#include "SquaredEuclideanMetricTest.h"
+
+void SquaredEuclideanMetricTest::setUp(void)
+{
+	trajectoryA = new Trajectory<CvPoint> ();
+	trajectoryB = new Trajectory<CvPoint> ();
+	metric = new SquaredEuclideanMetric<CvPoint, double> ();
+}
+
+void SquaredEuclideanMetricTest::tearDown(void)
+{
+	delete trajectoryA;
+	delete trajectoryB;
+	delete metric;
+
+	trajectoryA = NULL;
+	trajectoryB = NULL;
+	metric = NULL;
+}
+
+void SquaredEuclideanMetricTest::testMetric1(void)
+{
+	double result = double(0);
+	CPPUNIT_ASSERT_THROW(metric->distance(trajectoryA, trajectoryB, result),
+			TrajectoryLengthErrorException);
+}
+
+void SquaredEuclideanMetricTest::testMetric2(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(0));
+}
+
+void SquaredEuclideanMetricTest::testMetric3(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(1, 1));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(2));
+}
+
+void SquaredEuclideanMetricTest::testMetric4(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryB->add(cvPoint(3, 4));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(25));
+}
+
+void SquaredEuclideanMetricTest::testMetric5(void)
+{
+	double result = double(0);
+	trajectoryA->add(cvPoint(0, 0));
+	trajectoryA->add(cvPoint(-4, -3));
+	trajectoryB->add(cvPoint(3, 4));
+	trajectoryB->add(cvPoint(0, 0));
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(50));
+}
+
+void SquaredEuclideanMetricTest::testMetric6(void)
+{
+	double result = double(0);
+	unsigned n = 100;
+	unsigned maxRand = 10000;
+	srand(time(NULL));
+	for (unsigned int i = 0; i < n; ++i)
+	{
+		unsigned int rand1 = rand() % maxRand;
+		unsigned int rand2 = rand() % maxRand;
+		trajectoryA->add(cvPoint(rand1, rand2));
+		trajectoryB ->add(cvPoint(rand1 + 3, rand2 + 4));
+	}
+	metric->distance(trajectoryA, trajectoryB, result);
+	CPPUNIT_ASSERT_EQUAL(result, double(n * 9 + n * 16));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/SquaredEuclideanMetricTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,34 @@
+#ifndef SQUAREDEUCLIDIANMETRICTEST_H_
+#define SQUAREDEUCLIDIANMETRICTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/SquaredEuclideanMetric.h"
+using namespace std;
+
+class SquaredEuclideanMetricTest: public CPPUNIT_NS::TestCase
+{
+	CPPUNIT_TEST_SUITE( SquaredEuclideanMetricTest);
+		CPPUNIT_TEST( testMetric1);
+		CPPUNIT_TEST( testMetric2);
+		CPPUNIT_TEST( testMetric3);
+		CPPUNIT_TEST( testMetric4);
+		CPPUNIT_TEST( testMetric5);
+		CPPUNIT_TEST( testMetric6);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void);
+	void tearDown(void);
+protected:
+	void testMetric1(void);
+	void testMetric2(void);
+	void testMetric3(void);
+	void testMetric4(void);
+	void testMetric5(void);
+	void testMetric6(void);
+private:
+	Trajectory<CvPoint> *trajectoryA;
+	Trajectory<CvPoint> *trajectoryB;
+	Metric<CvPoint, double> *metric;
+};
+
+#endif /* SQUAREDEUCLIDIANMETRICTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TestRunner.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,80 @@
+#include "TrajectoryTest.h"
+#include "TrajectoryElementTest.h"
+#include "PointOperationsTest.h"
+#include "DBSQLiteAccessTest.h"
+#include "TrajectoryDBAccessBlobTest.h"
+#include "TrajectoryDBAccessListTest.h"
+#include "EuclideanMetricTest.h"
+#include "HausdorffMetricTest.h"
+#include "HuMetricTest.h"
+#include "ChebyshevMetricTest.h"
+#include "MinimumMetricTest.h"
+#include "SquaredEuclideanMetricTest.h"
+#include "ManhattanMetricTest.h"
+#include "CanberraMetricTest.h"
+#include "LCSMetricTest.h"
+#include "DTWMetricTest.h"
+
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "opencv2/core/core.hpp"
+
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<ushort> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<short int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<unsigned int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<float> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point_<double> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<ushort> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<short int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<unsigned int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<float> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<cv::Point3_<double> >);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<CvPoint>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<CvPoint2D32f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<CvPoint3D32f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<CvPoint2D64f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryElementTest<CvPoint3D64f>);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<ushort> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<short int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<unsigned int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<float> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point_<double> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<ushort> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<short int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<unsigned int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<int> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<float> >);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<cv::Point3_<double> >);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<CvPoint>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<CvPoint2D32f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<CvPoint3D32f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<CvPoint2D64f>);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryTest<CvPoint3D64f>);
+CPPUNIT_TEST_SUITE_REGISTRATION(PointOperationsTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(DBSQLiteAccessTest);
+// CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryDBAccessBlobTest<CvPoint>);
+CPPUNIT_TEST_SUITE_REGISTRATION(TrajectoryDBAccessListTest<cv::Point3_<float> > );
+CPPUNIT_TEST_SUITE_REGISTRATION(EuclideanMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(HausdorffMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(HuMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(ChebyshevMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(MinimumMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(SquaredEuclideanMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(ManhattanMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(CanberraMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(LCSMetricTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(DTWMetricTest);
+
+int main(int ac, char **av)
+{
+	CPPUNIT_NS::TextUi::TestRunner runner;
+	CPPUNIT_NS::TestFactoryRegistry &registry = CPPUNIT_NS::TestFactoryRegistry::getRegistry();
+	runner.addTest(registry.makeTest());
+	bool wasSuccessful = runner.run("", false);
+	return wasSuccessful;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryDBAccessBlobTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,25 @@
+#ifndef TRAJECTORYDBACCESSBLOBTEST_H_
+#define TRAJECTORYDBACCESSBLOBTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "TrajectoryDBAccessTest.h"
+#include "../src/TrajectoryDBAccessBlob.h"
+using namespace std;
+
+template<typename T>
+class TrajectoryDBAccessBlobTest: public TrajectoryDBAccessTest<T>
+{
+CPPUNIT_TEST_SUITE(TrajectoryDBAccessBlobTest);
+		CPPUNIT_TEST(testSize);
+		CPPUNIT_TEST(testMinTrajectoryId);
+		CPPUNIT_TEST(testMaxTrajectoryId);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void)
+	{
+		TrajectoryDBAccessTest<T>::db = new TrajectoryDBAccessBlob<T> ();
+		TrajectoryDBAccessTest<T>::setUp();
+	}
+};
+
+#endif /* TRAJECTORYDBACCESSBLOBTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryDBAccessListTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,26 @@
+#ifndef TRAJECTORYDBACCESSLISTTEST_H_
+#define TRAJECTORYDBACCESSLISTTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "TrajectoryDBAccessTest.h"
+#include "../src/TrajectoryDBAccessList.h"
+using namespace std;
+
+template<typename T>
+class TrajectoryDBAccessListTest: public TrajectoryDBAccessTest<T>
+{
+  CPPUNIT_TEST_SUITE(TrajectoryDBAccessListTest);
+  CPPUNIT_TEST(testSize);
+  CPPUNIT_TEST(testMinTrajectoryId);
+  CPPUNIT_TEST(testMaxTrajectoryId);
+  CPPUNIT_TEST(testPrototypeMatchStructure);
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp(void)
+  {
+    TrajectoryDBAccessTest<T>::db = new TrajectoryDBAccessList<T> ();
+    TrajectoryDBAccessTest<T>::setUp();
+  }
+};
+
+#endif /* TRAJECTORYDBACCESSLISTTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryDBAccessTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,150 @@
+#ifndef TRAJECTORYDBACCESSTEST_H_
+#define TRAJECTORYDBACCESSTEST_H_
+#include <cppunit/extensions/HelperMacros.h>
+#include "../src/TrajectoryDBAccess.h"
+using namespace std;
+
+template<typename T>
+class TrajectoryDBAccessTest: public CPPUNIT_NS::TestCase
+{
+public:
+	virtual void setUp(void)
+	{
+		dbName = "XXXXXX.sqlite";
+		int res = mkstemps((char*) dbName.c_str(), 7);
+		CPPUNIT_ASSERT(res != -1);
+	}
+
+	void tearDown(void)
+	{
+		delete db;
+		unlink(dbName.c_str());
+	}
+
+protected:
+	void testSize(void)
+	{
+		T point;
+		initPoint(point, 1, 2, 3);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+		CPPUNIT_ASSERT_EQUAL(true, db->createTable());
+
+		unsigned int size;
+
+		for (unsigned int i = 0; i < 100; ++i)
+		{
+			CPPUNIT_ASSERT_EQUAL(true, db->size(size));
+			CPPUNIT_ASSERT_EQUAL(i, size);
+
+			Trajectory<T> trajectory;
+			trajectory.setId(i);
+			trajectory.add(i, point);
+			CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory));
+			trajectory.pop_back();
+		}
+
+		CPPUNIT_ASSERT_EQUAL(true, db->size(size));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 100, size);
+	}
+
+	void testMinTrajectoryId(void)
+	{
+		T point;
+		initPoint(point, 1, 2, 3);
+
+		Trajectory<T> trajectory[4];
+		for (unsigned int i = 0; i < 4; ++i)
+		{
+			trajectory[i].setId(i + 1);
+ 			trajectory[i].add(i, point);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+		CPPUNIT_ASSERT_EQUAL(true, db->createTable());
+
+		unsigned int id;
+
+		CPPUNIT_ASSERT_EQUAL(false, db->minTrajectoryId(id));
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[1]));
+		CPPUNIT_ASSERT_EQUAL(true, db->minTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 2, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[2]));
+		CPPUNIT_ASSERT_EQUAL(true, db->minTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 2, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[0]));
+		CPPUNIT_ASSERT_EQUAL(true, db->minTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 1, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[3]));
+		CPPUNIT_ASSERT_EQUAL(true, db->minTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 1, id);
+	}
+
+	void testMaxTrajectoryId(void)
+	{
+		T point;
+		initPoint(point, 1, 2, 3);
+
+		Trajectory<T> trajectory[4];
+		for (unsigned int i = 0; i < 4; ++i)
+		{
+			trajectory[i].setId(i + 1);
+			trajectory[i].add(i, point);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+		CPPUNIT_ASSERT_EQUAL(true, db->createTable());
+
+		unsigned int id;
+
+		CPPUNIT_ASSERT_EQUAL(false, db->maxTrajectoryId(id));
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[1]));
+		CPPUNIT_ASSERT_EQUAL(true, db->maxTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 2, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[2]));
+		CPPUNIT_ASSERT_EQUAL(true, db->maxTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 3, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[0]));
+		CPPUNIT_ASSERT_EQUAL(true, db->maxTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 3, id);
+
+		CPPUNIT_ASSERT_EQUAL(true, db->write(trajectory[3]));
+		CPPUNIT_ASSERT_EQUAL(true, db->maxTrajectoryId(id));
+		CPPUNIT_ASSERT_EQUAL((unsigned int) 4, id);
+	}
+
+	void testPrototypeMatchStructure(void){
+
+	  CPPUNIT_ASSERT_EQUAL(true, db->connect(dbName.c_str()));
+	  CPPUNIT_ASSERT_EQUAL(true, db->createPrototypeTable());
+	  multimap<int,int> matches;
+	  for (int i = 0 ; i < 5 ; i++)
+	    matches.insert(pair<int,int>(i,i));
+
+	  CPPUNIT_ASSERT_EQUAL(true, db->write(matches));
+	  
+	  multimap<int,int> rematches;
+	  CPPUNIT_ASSERT_EQUAL(true, db->read(rematches));
+	  multimap<int,int>::iterator it_rematches;
+	  multimap<int,int>::iterator it_matches (matches.begin());
+	  for (it_rematches = rematches.begin() ; it_rematches != rematches.end() ; it_rematches++){
+	    CPPUNIT_ASSERT_EQUAL(it_rematches->first, it_matches->first);
+	    CPPUNIT_ASSERT_EQUAL(it_rematches->second,it_matches->second);
+	    advance(it_matches, 1);
+	  } // for iterator
+	  				      	  
+	} // testPrototypeMatchStructure
+
+	TrajectoryDBAccess<T> *db;
+
+	string dbName;
+};
+
+#endif /* TRAJECTORYDBACCESSTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryElementTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,233 @@
+#ifndef TRAJECTORYELEMENTTEST_H_
+#define TRAJECTORYELEMENTTEST_H_
+
+#include "../src/TrajectoryElement.h"
+#include "../src/PointOperations.h"
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace std;
+
+template<typename T>
+class TrajectoryElementTest: public CPPUNIT_NS::TestCase
+{
+CPPUNIT_TEST_SUITE(TrajectoryElementTest);
+		CPPUNIT_TEST(testTrajectoryElement1);
+		CPPUNIT_TEST(testTrajectoryElement2);
+		CPPUNIT_TEST(testSetFrameNumber);
+		CPPUNIT_TEST(testSetPoint);
+		CPPUNIT_TEST(testShift1);
+		CPPUNIT_TEST(testShift2);
+		CPPUNIT_TEST(testOperatorEq1);
+		CPPUNIT_TEST(testOperatorEq2);
+		CPPUNIT_TEST(testOperatorEq3);
+		CPPUNIT_TEST(testOperatorEq4);
+		CPPUNIT_TEST(testOperatorEq5);
+//		CPPUNIT_TEST(testOperatorIn1);
+//		CPPUNIT_TEST(testOperatorIn2);
+//		CPPUNIT_TEST(testOperatorOut1);
+//		CPPUNIT_TEST(testOperatorOut2);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void)
+	{
+		trajectoryElement.setFrameNumber(2);
+
+		T point;
+		initPoint(point, int(4), int(8), int(16));
+		trajectoryElement.setPoint(point);
+	}
+
+	void tearDown(void)
+	{
+	}
+
+protected:
+	void testTrajectoryElement1(void)
+	{
+		T point;
+		initPoint(point, int(4), int(8), int(16));
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement.getFrameNumber(), (unsigned int) 2);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement.getPoint(), point);
+	}
+
+	void testTrajectoryElement2(void)
+	{
+		TrajectoryElement<T> trajectoryElement2(trajectoryElement);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement, trajectoryElement2);
+	}
+
+	void testSetFrameNumber(void)
+	{
+		for (unsigned int i = 0; i < 20; ++i)
+		{
+			trajectoryElement.setFrameNumber(i);
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement.getFrameNumber(), i);
+		}
+	}
+
+	void testSetPoint(void)
+	{
+		T point1, point2;
+		for (unsigned int i = 0; i < 20; ++i)
+		{
+			initPoint(point1, int(4), int(8), int(16));
+			initPoint(point2, int(4), int(8), int(16));
+			trajectoryElement.setPoint(point1);
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement.getPoint(), point2);
+		}
+	}
+
+	void testShift1(void)
+	{
+		T shiftPoint, endPoint;
+		initPoint(shiftPoint, int(32), int(16), int(4));
+		initPoint(endPoint, int(36), int(24), int(20));
+		trajectoryElement.shift(shiftPoint);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement.getPoint(), endPoint);
+	}
+
+	void testShift2(void)
+	{
+		T shiftPoint1, shiftPoint2, endPoint;
+		initPoint(shiftPoint1, int(32), int(16), int(4));
+		initPoint(shiftPoint2, int(2), int(4), int(28));
+		initPoint(endPoint, int(38), int(28), int(48));
+		trajectoryElement.shift(shiftPoint1);
+		trajectoryElement.shift(shiftPoint2);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement.getPoint(), endPoint);
+	}
+
+	void testOperatorEq1(void)
+	{
+		CPPUNIT_ASSERT(trajectoryElement == trajectoryElement);
+
+		trajectoryElement.setFrameNumber(2);
+		CPPUNIT_ASSERT(trajectoryElement == trajectoryElement);
+
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		trajectoryElement.setPoint(point);
+		CPPUNIT_ASSERT(trajectoryElement == trajectoryElement);
+	}
+
+	void testOperatorEq2(void)
+	{
+		TrajectoryElement<T> trajectoryElement2(trajectoryElement);
+		CPPUNIT_ASSERT(trajectoryElement2 == trajectoryElement);
+	}
+
+	void testOperatorEq3(void)
+	{
+		TrajectoryElement<T> trajectoryElement2;
+		trajectoryElement2 = trajectoryElement;
+		CPPUNIT_ASSERT(trajectoryElement2 == trajectoryElement);
+	}
+
+	void testOperatorEq4(void)
+	{
+		const TrajectoryElement<T> trajectoryElement2(trajectoryElement);
+		trajectoryElement.setFrameNumber(16);
+		CPPUNIT_ASSERT(trajectoryElement != trajectoryElement2);
+	}
+
+	void testOperatorEq5(void)
+	{
+		const TrajectoryElement<T> trajectoryElement2(trajectoryElement);
+
+		T point;
+
+		initPoint(point, int(4), int(8), int(16));
+		trajectoryElement.setPoint(point);
+		CPPUNIT_ASSERT(trajectoryElement == trajectoryElement2);
+
+		initPoint(point, int(4 + 10), int(8), int(16));
+		trajectoryElement.setPoint(point);
+		CPPUNIT_ASSERT(trajectoryElement != trajectoryElement2);
+
+		initPoint(point, int(4), int(8 + 10), int(16));
+		trajectoryElement.setPoint(point);
+		CPPUNIT_ASSERT(trajectoryElement != trajectoryElement2);
+
+		initPoint(point, int(4), int(8), int(16 + 10));
+		trajectoryElement.setPoint(point);
+		if (dim(point) == 2)
+		{
+			CPPUNIT_ASSERT(trajectoryElement == trajectoryElement2);
+		}
+		else if (dim(point) == 3)
+		{
+			CPPUNIT_ASSERT(trajectoryElement != trajectoryElement2);
+		}
+	}
+
+	void testOperatorIn1(void)
+	{
+		stringstream ss;
+		ss << trajectoryElement;
+
+		string s("2 4 8");
+		if (dim(trajectoryElement.getPoint()) == 3)
+		{
+			s += string(" 16");
+		}
+
+		CPPUNIT_ASSERT_EQUAL(ss.str(), s);
+	}
+
+	void testOperatorIn2(void)
+	{
+		trajectoryElement.setFrameNumber(4);
+
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		trajectoryElement.setPoint(point);
+
+		stringstream ss;
+		ss << trajectoryElement;
+
+		string s("4 10 20");
+		if (dim(trajectoryElement.getPoint()) == 3)
+		{
+			s += string(" 30");
+		}
+
+		CPPUNIT_ASSERT_EQUAL(ss.str(), s);
+	}
+
+	void testOperatorOut1(void)
+	{
+		stringstream ss;
+		ss << trajectoryElement;
+
+		TrajectoryElement<T> trajectoryElement2;
+		istringstream is(ss.str());
+		is >> trajectoryElement2;
+
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement, trajectoryElement2);
+	}
+
+	void testOperatorOut2(void)
+	{
+		trajectoryElement.setFrameNumber(4);
+
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		trajectoryElement.setPoint(point);
+
+		stringstream ss;
+		ss << trajectoryElement;
+
+		TrajectoryElement<T> trajectoryElement2;
+		istringstream is(ss.str());
+		is >> trajectoryElement2;
+
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement, trajectoryElement2);
+	}
+
+private:
+	TrajectoryElement<T> trajectoryElement;
+};
+
+#endif /* TRAJECTORYELEMENTTEST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryTest.cpp	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,203 @@
+#include "TrajectoryTest.h"
+
+void TrajectoryTest::setUp(void)
+{
+	sampleTrajectory = new Trajectory<CvPoint> ();
+
+	const unsigned n = 100;
+	for (unsigned i = 0; i < n; ++i)
+	{
+		CvPoint point = cvPoint(int(i), int(i + 100));
+		sampleTrajectory->add(i + 1, point);
+	}
+}
+
+void TrajectoryTest::tearDown(void)
+{
+	delete sampleTrajectory;
+	sampleTrajectory = NULL;
+}
+
+void TrajectoryTest::testTrajectory(void)
+{
+	Trajectory<CvPoint> trajectory(*sampleTrajectory);
+	CPPUNIT_ASSERT(equal(trajectory, *sampleTrajectory));
+}
+
+void TrajectoryTest::testAdd1(void)
+{
+	Trajectory<CvPoint> trajectory;
+
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		CvPoint p1 = sampleTrajectory->getPosition(i);
+		trajectory.add(p1);
+
+		const CvPoint p2 = trajectory.getPosition(i);
+		CPPUNIT_ASSERT (equal(p1,p2));
+
+		const unsigned frameNumber = trajectory.getFrameNumber(i);
+		CPPUNIT_ASSERT_EQUAL(frameNumber, i + 1);
+	}
+
+	CPPUNIT_ASSERT(equal(trajectory, *sampleTrajectory));
+}
+
+void TrajectoryTest::testAdd2(void)
+{
+	Trajectory<CvPoint> trajectory;
+
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		CvPoint p1 = sampleTrajectory->getPosition(i);
+		trajectory.add(i + 1, p1);
+
+		const CvPoint p2 = trajectory.getPosition(i);
+		CPPUNIT_ASSERT (equal(p1,p2));
+
+		const unsigned frameNumber = trajectory.getFrameNumber(i);
+		CPPUNIT_ASSERT_EQUAL(frameNumber, i + 1);
+	}
+
+	CPPUNIT_ASSERT(equal(trajectory, *sampleTrajectory));
+}
+
+void TrajectoryTest::testGet(void)
+{
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		CvPoint p1 = sampleTrajectory->getPosition(i);
+		CvPoint p2 = cvPoint(int(i), int(i + 100));
+		CPPUNIT_ASSERT (equal(p1,p2));
+	}
+}
+
+void TrajectoryTest::testGetFrameNumber(void)
+{
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		unsigned frameNumber = sampleTrajectory->getFrameNumber(i);
+		CPPUNIT_ASSERT_EQUAL(frameNumber, i + 1);
+	}
+}
+
+void TrajectoryTest::testGetTrajectoryElement(void)
+{
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		TrajectoryElement<CvPoint> e1 = sampleTrajectory->getTrajectoryElement(i);
+
+		CvPoint p1 = e1.getPosition();
+		CvPoint p2 = cvPoint(int(i), int(i + 100));
+		CPPUNIT_ASSERT (equal(p1,p2));
+
+		unsigned frameNumber = e1.getFrameNumber();
+		CPPUNIT_ASSERT_EQUAL(frameNumber, i + 1);
+	}
+}
+
+void TrajectoryTest::testSetAndGetId(void)
+{
+	CPPUNIT_ASSERT_EQUAL(sampleTrajectory->getId(), unsigned(0));
+
+	unsigned newTrajectoryId = 10;
+	sampleTrajectory->setId(newTrajectoryId);
+	CPPUNIT_ASSERT_EQUAL(sampleTrajectory->getId(), newTrajectoryId);
+}
+
+void TrajectoryTest::testSizeInc(void)
+{
+	Trajectory<CvPoint> *t = new Trajectory<CvPoint> ();
+
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		CPPUNIT_ASSERT_EQUAL(t->size(), (unsigned int)i);
+
+		CvPoint point = (*sampleTrajectory)[i];
+		t->add(point);
+	}
+
+	CPPUNIT_ASSERT_EQUAL(t->size(), sampleTrajectory->size());
+}
+
+void TrajectoryTest::testSizeDec(void)
+{
+	unsigned size = sampleTrajectory->size();
+
+	for (unsigned i = 0; i < size; ++i)
+	{
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory->size(), (unsigned int)(size - i));
+
+		sampleTrajectory->pop_back();
+	}
+
+	CPPUNIT_ASSERT_EQUAL(sampleTrajectory->size(), (unsigned int)0);
+}
+
+void TrajectoryTest::testSizeConstSize(void)
+{
+	CPPUNIT_ASSERT_EQUAL(sampleTrajectory->size(), (unsigned int)100);
+}
+
+void TrajectoryTest::testSizeClear(void)
+{
+	sampleTrajectory->clear();
+	CPPUNIT_ASSERT_EQUAL(sampleTrajectory->size(), (unsigned int)0);
+}
+
+void TrajectoryTest::testShift(void)
+{
+	const int shiftX = 1000;
+	const int shiftY = 2000;
+
+	const CvPoint shiftPoint = cvPoint(shiftX, shiftY);
+	sampleTrajectory->shift(shiftPoint);
+
+	for (unsigned i = 0; i < sampleTrajectory->size(); ++i)
+	{
+		CvPoint p1 = sampleTrajectory->getPosition(i);
+		CvPoint p2 = cvPoint(int(i) + shiftX, int(i + 100) + shiftY);
+		CPPUNIT_ASSERT (equal(p1,p2));
+	}
+}
+
+bool TrajectoryTest::equal(const Trajectory<CvPoint>& t1, const Trajectory<CvPoint>& t2) const
+{
+	if (t1.getId() != t2.getId())
+	{
+		CPPUNIT_ASSERT (t1.getId() == t2.getId());
+		return false;
+	}
+
+	if (t1.size() != t2.size())
+	{
+		return false;
+	}
+
+	for (unsigned i = 0; i < t1.size(); ++i)
+	{
+		const TrajectoryElement<CvPoint> e1 = t1.getTrajectoryElement(i);
+		const TrajectoryElement<CvPoint> e2 = t2.getTrajectoryElement(i);
+		if (e1 != e2)
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+bool TrajectoryTest::equal(const CvPoint& p1, const CvPoint& p2) const
+{
+	if (p1.x != p2.x)
+	{
+		return false;
+	}
+
+	if (p1.y != p2.y)
+	{
+		return false;
+	}
+
+	return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/test/TrajectoryTest.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,1604 @@
+#ifndef TRAJECTORYTEST_H_
+#define TRAJECTORYTEST_H_
+
+#include "../src/Trajectory.h"
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace std;
+
+template<class T>
+class TrajectoryTest: public CPPUNIT_NS::TestCase
+{
+CPPUNIT_TEST_SUITE(TrajectoryTest);
+		CPPUNIT_TEST(testTrajectory1);
+		CPPUNIT_TEST(testTrajectory2);
+		CPPUNIT_TEST(testTrajectory3);
+		CPPUNIT_TEST(testSetId);
+		CPPUNIT_TEST(testGetTrajectoryElement);
+		CPPUNIT_TEST(testAdd1);
+		CPPUNIT_TEST(testAdd2);
+		CPPUNIT_TEST(testAdd3);
+		CPPUNIT_TEST(testAdd4);
+		CPPUNIT_TEST(testAdd5);
+		CPPUNIT_TEST(testAdd6);
+		CPPUNIT_TEST(testAdd7);
+		CPPUNIT_TEST(testAdd8);
+		CPPUNIT_TEST(testAdd9);
+		CPPUNIT_TEST(testAdd10);
+		CPPUNIT_TEST(testAdd11);
+		CPPUNIT_TEST(testAdd12);
+		CPPUNIT_TEST(testAdd13);
+		CPPUNIT_TEST(testAdd14);
+		CPPUNIT_TEST(testAdd15);
+		CPPUNIT_TEST(testAdd16);
+		CPPUNIT_TEST(testAdd17);
+		CPPUNIT_TEST(testAdd18);
+		CPPUNIT_TEST(testAdd19);
+		CPPUNIT_TEST(testAdd20);
+		CPPUNIT_TEST(testAdd21);
+		CPPUNIT_TEST(testAdd22);
+		CPPUNIT_TEST(testAdd23);
+		CPPUNIT_TEST(testAdd24);
+		CPPUNIT_TEST(testAdd25);
+		CPPUNIT_TEST(testAdd26);
+		CPPUNIT_TEST(testAdd27);
+		CPPUNIT_TEST(testAdd28);
+		CPPUNIT_TEST(testAdd29);
+		CPPUNIT_TEST(testAdd30);
+		CPPUNIT_TEST(testAdd31);
+		CPPUNIT_TEST(testAdd32);
+		CPPUNIT_TEST(testAdd33);
+		CPPUNIT_TEST(testAdd34);
+		CPPUNIT_TEST(testAdd35);
+		CPPUNIT_TEST(testAdd36);
+		CPPUNIT_TEST(testAdd37);
+		CPPUNIT_TEST(testAdd38);
+		CPPUNIT_TEST(testAdd39);
+		CPPUNIT_TEST(testGetFrameNumber);
+		CPPUNIT_TEST(testGetPoint);
+		CPPUNIT_TEST(testGetCheckAscFrameNumber1);
+		CPPUNIT_TEST(testGetCheckAscFrameNumber2);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber1);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber2);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber3);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber4);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber5);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber6);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber7);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber8);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber9);
+		CPPUNIT_TEST(testSetCheckAscFrameNumber10);
+		CPPUNIT_TEST(testSize1);
+		CPPUNIT_TEST(testSize2);
+		CPPUNIT_TEST(testSizeInc);
+		CPPUNIT_TEST(testSizeDec);
+		CPPUNIT_TEST(testSizeClear);
+		CPPUNIT_TEST(testEmptySizeInc);
+		CPPUNIT_TEST(testEmptySizeDec);
+		CPPUNIT_TEST(testInsert1);
+		CPPUNIT_TEST(testInsert2);
+		CPPUNIT_TEST(testInsert3);
+		CPPUNIT_TEST(testInsert4);
+		CPPUNIT_TEST(testInsert5);
+		CPPUNIT_TEST(testInsert6);
+		CPPUNIT_TEST(testInsert7);
+		CPPUNIT_TEST(testInsert8);
+		CPPUNIT_TEST(testInsert9);
+		CPPUNIT_TEST(testErase1);
+		CPPUNIT_TEST(testErase2);
+		CPPUNIT_TEST(testErase3);
+		CPPUNIT_TEST(testErase4);
+		CPPUNIT_TEST(testErase5);
+		CPPUNIT_TEST(testErase6);
+		CPPUNIT_TEST(testErase7);
+		CPPUNIT_TEST(testErase8);
+		CPPUNIT_TEST(testErase9);
+		CPPUNIT_TEST(testErase10);
+		CPPUNIT_TEST(testErase11);
+		CPPUNIT_TEST(testErase12);
+		CPPUNIT_TEST(testErase13);
+		CPPUNIT_TEST(testErase14);
+		CPPUNIT_TEST(testPop_back1);
+		CPPUNIT_TEST(testPop_back2);
+		CPPUNIT_TEST(testPop_back3);
+		CPPUNIT_TEST(testPop_back4);
+		CPPUNIT_TEST(testOperatorGet);
+		CPPUNIT_TEST(testAt1);
+		CPPUNIT_TEST(testAt2);
+		CPPUNIT_TEST(testAt3);
+		CPPUNIT_TEST(testAt4);
+		CPPUNIT_TEST(testAt5);
+		CPPUNIT_TEST(testAt6);
+		CPPUNIT_TEST(testAt7);
+		CPPUNIT_TEST(testShift1);
+		CPPUNIT_TEST(testShift2);
+		CPPUNIT_TEST(testOperatorEq1);
+		CPPUNIT_TEST(testOperatorEq2);
+		CPPUNIT_TEST(testOperatorEq3);
+		CPPUNIT_TEST(testOperatorEq4);
+		CPPUNIT_TEST(testOperatorEq5);
+		CPPUNIT_TEST(testOperatorEq6);
+		CPPUNIT_TEST(testOperatorEq7);
+		CPPUNIT_TEST(testOperatorEq8);
+		CPPUNIT_TEST(testOperatorAdd1);
+		CPPUNIT_TEST(testOperatorAdd2);
+//		CPPUNIT_TEST(testOperatorIn1);
+//		CPPUNIT_TEST(testOperatorIn2);
+//		CPPUNIT_TEST(testOperatorIn3);
+//		CPPUNIT_TEST(testOperatorOut1);
+//		CPPUNIT_TEST(testOperatorOut2);
+//		CPPUNIT_TEST(testOperatorOut3);
+		CPPUNIT_TEST(testMin1);
+		CPPUNIT_TEST(testMin2);
+		CPPUNIT_TEST(testMin3);
+		CPPUNIT_TEST(testMin4);
+		CPPUNIT_TEST(testMax1);
+		CPPUNIT_TEST(testMax2);
+		CPPUNIT_TEST(testMax3);
+		CPPUNIT_TEST(testMax4);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	void setUp(void)
+	{
+		sampleTrajectory.setId(1);
+
+		const unsigned int n = 100;
+		for (unsigned int i = 0; i < n; ++i)
+		{
+			T point;
+			initPoint(point, int(i), int(i + 10), int(i + 20));
+			sampleTrajectory.add(i + 1, point);
+		}
+	}
+
+	void tearDown(void)
+	{
+		sampleTrajectory.clear();
+	}
+
+protected:
+	void testTrajectory1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.getId(), (unsigned int) 0);
+	}
+
+	void testTrajectory2(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.getCheckAscFrameNumber(), false);
+	}
+
+	void testTrajectory3(void)
+	{
+		Trajectory<T> trajectory(sampleTrajectory);
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testSetId(void)
+	{
+		const unsigned int id = 123;
+		sampleTrajectory.setId(id);
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.getId(), id);
+	}
+
+	void testGetTrajectoryElement(void)
+	{
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			TrajectoryElement<T> trajectoryElement1 = sampleTrajectory.getTrajectoryElement(i);
+			T point;
+			initPoint(point, int(i), int(i + 10), int(i + 20));
+			TrajectoryElement<T> trajectoryElement2(i + 1, point);
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+	}
+
+	void testAdd1(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory.setId(1);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			const T point = sampleTrajectory.getPoint(i);
+
+			trajectory.add(frameNumber, point);
+
+			TrajectoryElement<T> trajectoryElement1 = trajectory.getTrajectoryElement(i);
+			TrajectoryElement<T> trajectoryElement2(frameNumber, point);
+
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testAdd2(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory.setId(1);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			const T point = sampleTrajectory.getPoint(i);
+
+			//trajectory.add(point);
+			trajectory.add(frameNumber, point);
+
+			const TrajectoryElement<T> trajectoryElement1(frameNumber, point);
+			const TrajectoryElement<T> trajectoryElement2 = trajectory.getTrajectoryElement(i);
+
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testAdd3(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory.setId(1);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			const T point = sampleTrajectory.getPoint(i);
+
+			const TrajectoryElement<T> trajectoryElement1(frameNumber, point);
+
+			trajectory.add(trajectoryElement1);
+
+			const TrajectoryElement<T> trajectoryElement2 = trajectory.getTrajectoryElement(i);
+
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testAdd4(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+	}
+
+	void testAdd5(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+	}
+
+	void testAdd6(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+		CPPUNIT_ASSERT_THROW(trajectory.add(0, point), TrajectoryFrameNumberErrorException);
+	}
+
+	void testAdd7(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+	}
+
+	void testAdd8(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(1, point));
+	}
+
+	void testAdd9(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(0, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(1, point));
+	}
+
+	void testAdd10(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+	}
+
+	void testAdd11(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+	}
+
+	void testAdd12(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_THROW(trajectory.add(2, point), TrajectoryFrameNumberErrorException);
+	}
+
+	void testAdd13(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+	}
+
+	void testAdd14(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(3, point));
+	}
+
+	void testAdd15(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(3, point));
+	}
+
+	void testAdd16(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(4, point));
+	}
+
+	void testAdd17(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(2, point));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(4, point));
+	}
+
+	void testAdd18(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		trajectory.add(10, point);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			CPPUNIT_ASSERT_THROW(trajectory.add(10 + i - 1, point), TrajectoryFrameNumberErrorException);
+			CPPUNIT_ASSERT_THROW(trajectory.add(10 + i, point), TrajectoryFrameNumberErrorException);
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(10 + i + 1, point));
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) (sampleTrajectory.size() + 1));
+	}
+
+	void testAdd19(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		trajectory.add(10, point);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(10 + i - 1, point));
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(10 + i, point));
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(10 + i + 1, point));
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) (3 * sampleTrajectory.size() + 1));
+	}
+
+	void testAdd20(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(true);
+		const unsigned int frameNumber = sampleTrajectory.getFrameNumber(sampleTrajectory.size() - 1);
+		const T point = sampleTrajectory.getPoint(sampleTrajectory.size() - 1);
+
+		for (unsigned int i = 0; i <= frameNumber; ++i)
+		{
+			CPPUNIT_ASSERT_THROW(sampleTrajectory.add(i, point), TrajectoryFrameNumberErrorException);
+		}
+
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(frameNumber + 1, point));
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 101);
+	}
+
+	void testAdd21(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(false);
+		const unsigned int frameNumber = sampleTrajectory.getFrameNumber(sampleTrajectory.size() - 1);
+		const T point = sampleTrajectory.getPoint(sampleTrajectory.size() - 1);
+
+		for (unsigned int i = 0; i <= frameNumber; ++i)
+		{
+			CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(i, point));
+		}
+
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(frameNumber + 1, point));
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 202);
+	}
+
+	void testAdd22(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement(0, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd23(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement(0, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd24(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement(0, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+		CPPUNIT_ASSERT_THROW(trajectory.add(trajectoryElement), TrajectoryFrameNumberErrorException);
+	}
+
+	void testAdd25(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement(0, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd26(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement1(0, point);
+		const TrajectoryElement<T> trajectoryElement2(1, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd27(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement1(0, point);
+		const TrajectoryElement<T> trajectoryElement2(1, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd28(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement(2, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd29(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement(2, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd30(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement(2, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+		CPPUNIT_ASSERT_THROW(trajectory.add(trajectoryElement), TrajectoryFrameNumberErrorException);
+	}
+
+	void testAdd31(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement(2, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement));
+	}
+
+	void testAdd32(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement1(2, point);
+		const TrajectoryElement<T> trajectoryElement2(3, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1) );
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd33(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement1(2, point);
+		const TrajectoryElement<T> trajectoryElement2(3, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd34(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement1(2, point);
+		const TrajectoryElement<T> trajectoryElement2(4, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd35(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement1(2, point);
+		const TrajectoryElement<T> trajectoryElement2(4, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+	}
+
+	void testAdd36(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		const TrajectoryElement<T> trajectoryElement1(10, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const TrajectoryElement<T> trajectoryElement2(10 + i - 1, point);
+			const TrajectoryElement<T> trajectoryElement3(10 + i, point);
+			const TrajectoryElement<T> trajectoryElement4(10 + i + 1, point);
+			CPPUNIT_ASSERT_THROW(trajectory.add(trajectoryElement2), TrajectoryFrameNumberErrorException);
+			CPPUNIT_ASSERT_THROW(trajectory.add(trajectoryElement3), TrajectoryFrameNumberErrorException);
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement4));
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) (sampleTrajectory.size() + 1));
+	}
+
+	void testAdd37(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+
+		Trajectory<T> trajectory;
+		trajectory.setCheckAscFrameNumber(false);
+		const TrajectoryElement<T> trajectoryElement1(10, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement1));
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const TrajectoryElement<T> trajectoryElement2(10 + i - 1, point);
+			const TrajectoryElement<T> trajectoryElement3(10 + i, point);
+			const TrajectoryElement<T> trajectoryElement4(10 + i + 1, point);
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement2));
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement3));
+			CPPUNIT_ASSERT_NO_THROW(trajectory.add(trajectoryElement4));
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) (3 * sampleTrajectory.size() + 1));
+	}
+
+	void testAdd38(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(true);
+		const unsigned int frameNumber = sampleTrajectory.getFrameNumber(sampleTrajectory.size() - 1);
+		const T point = sampleTrajectory.getPoint(sampleTrajectory.size() - 1);
+
+		for (unsigned int i = 0; i <= frameNumber; ++i)
+		{
+			const TrajectoryElement<T> trajectoryElement(i, point);
+			CPPUNIT_ASSERT_THROW(sampleTrajectory.add(trajectoryElement), TrajectoryFrameNumberErrorException);
+		}
+
+		const TrajectoryElement<T> trajectoryElement(frameNumber + 1, point);
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(trajectoryElement));
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 101);
+	}
+
+	void testAdd39(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(false);
+		const unsigned int frameNumber = sampleTrajectory.getFrameNumber(sampleTrajectory.size() - 1);
+		const T point = sampleTrajectory.getPoint(sampleTrajectory.size() - 1);
+
+		for (unsigned int i = 0; i <= frameNumber; ++i)
+		{
+			const TrajectoryElement<T> trajectoryElement(i, point);
+			CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(trajectoryElement));
+		}
+
+		const TrajectoryElement<T> trajectoryElement(frameNumber + 1, point);
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.add(trajectoryElement));
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 202);
+	}
+
+	void testGetFrameNumber(void)
+	{
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			CPPUNIT_ASSERT_EQUAL(frameNumber, i + 1);
+		}
+	}
+
+	void testGetPoint(void)
+	{
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			T point1 = sampleTrajectory.getPoint(i);
+			T point2;
+			initPoint(point2, int(i), int(i + 10), int(i + 20));
+			CPPUNIT_ASSERT_EQUAL(point1, point2);
+		}
+	}
+
+	void testGetCheckAscFrameNumber1(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(false);
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.getCheckAscFrameNumber(), false);
+	}
+
+	void testGetCheckAscFrameNumber2(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.getCheckAscFrameNumber(), true);
+	}
+
+	void testSetCheckAscFrameNumber1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSetCheckAscFrameNumber2(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(0, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSetCheckAscFrameNumber3(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(1, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSetCheckAscFrameNumber4(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(1, point);
+		trajectory.add(2, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSetCheckAscFrameNumber5(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(1, point);
+		trajectory.add(1, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_THROW(trajectory.setCheckAscFrameNumber(true), TrajectoryFrameNumberErrorException);
+	}
+
+	void testSetCheckAscFrameNumber6(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(2, point);
+		trajectory.add(1, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_THROW(trajectory.setCheckAscFrameNumber(true), TrajectoryFrameNumberErrorException);
+	}
+
+	void testSetCheckAscFrameNumber7(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		Trajectory<T> trajectory;
+		trajectory.add(1, point);
+		trajectory.add(2, point);
+		trajectory.add(2, point);
+		trajectory.add(3, point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_THROW(trajectory.setCheckAscFrameNumber(true), TrajectoryFrameNumberErrorException);
+	}
+
+	void testSetCheckAscFrameNumber8(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSetCheckAscFrameNumber9(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		sampleTrajectory.add(100, point);
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.setCheckAscFrameNumber(true), TrajectoryFrameNumberErrorException);
+	}
+
+	void testSetCheckAscFrameNumber10(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+		sampleTrajectory.add(101, point);
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.setCheckAscFrameNumber(false));
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.setCheckAscFrameNumber(true));
+	}
+
+	void testSize1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) 0);
+	}
+
+	void testSize2(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) 100);
+	}
+
+	void testSizeInc(void)
+	{
+		Trajectory<T> trajectory;
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) i);
+
+			T point = (sampleTrajectory)[i];
+			trajectory.add(point);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), sampleTrajectory.size());
+	}
+
+	void testSizeDec(void)
+	{
+		unsigned int size = sampleTrajectory.size();
+
+		for (unsigned int i = 0; i < size; ++i)
+		{
+			CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int)(size - i));
+
+			sampleTrajectory.pop_back();
+		}
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 0);
+	}
+
+	void testSizeClear(void)
+	{
+		sampleTrajectory.clear();
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 0);
+	}
+
+	void testEmptySizeInc(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.empty(), true);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const TrajectoryElement<T> trajectoryElement = sampleTrajectory.getTrajectoryElement(i);
+			trajectory.add(trajectoryElement);
+			CPPUNIT_ASSERT_EQUAL(trajectory.empty(), false);
+		}
+	}
+
+	void testEmptySizeDec(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory.empty(), true);
+
+		trajectory = sampleTrajectory;
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			CPPUNIT_ASSERT_EQUAL(trajectory.empty(), false);
+			trajectory.pop_back();
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.empty(), true);
+	}
+
+	void testInsert1(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(trajectory.insert(1, 4, point), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testInsert2(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_NO_THROW(trajectory.insert(0, 4, point));
+
+		CPPUNIT_ASSERT_EQUAL(trajectory.size(), (unsigned int) 1);
+
+		const TrajectoryElement<T> trajectoryElement1 = trajectory.getTrajectoryElement(0);
+		const TrajectoryElement<T> trajectoryElement2(4, point);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+	}
+
+	void testInsert3(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.insert(sampleTrajectory.size(), 4, point));
+	}
+
+	void testInsert4(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.insert(sampleTrajectory.size() + 1, 4, point), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testInsert5(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.insert(sampleTrajectory.size() - 1, 20, point));
+
+		const TrajectoryElement<T> trajectoryElement1 = sampleTrajectory.getTrajectoryElement(sampleTrajectory.size() - 1);
+		const TrajectoryElement<T> trajectoryElement2(20, point);
+		CPPUNIT_ASSERT (trajectoryElement1 != trajectoryElement2);
+	}
+
+	void testInsert6(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.insert(sampleTrajectory.size(), 20, point));
+
+		const TrajectoryElement<T> trajectoryElement1 = sampleTrajectory.getTrajectoryElement(sampleTrajectory.size());
+		const TrajectoryElement<T> trajectoryElement2(20, point);
+		CPPUNIT_ASSERT(trajectoryElement1 != trajectoryElement2);
+	}
+
+	void testInsert7(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.insert(10, 20, point));
+
+		const TrajectoryElement<T> trajectoryElement1 = sampleTrajectory.getTrajectoryElement(10);
+		const TrajectoryElement<T> trajectoryElement2(20, point);
+		CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+	}
+
+	void testInsert8(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(true);
+
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.insert(sampleTrajectory.size() + 1, 100, point), TrajectoryOutOfRangeErrorException);
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.insert(sampleTrajectory.size(), 100, point), TrajectoryFrameNumberErrorException);
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.insert(sampleTrajectory.size(), 101, point));
+	}
+
+	void testInsert9(void)
+	{
+		sampleTrajectory.setCheckAscFrameNumber(true);
+
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		for (unsigned int i = 0; i < sampleTrajectory.size() - 1; ++i)
+		{
+			CPPUNIT_ASSERT_THROW(sampleTrajectory.insert(i, 20, point), TrajectoryFrameNumberErrorException);
+			CPPUNIT_ASSERT_THROW(sampleTrajectory.insert(i, 200, point), TrajectoryFrameNumberErrorException);
+		}
+	}
+
+	void testErase1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(trajectory.erase(0), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase2(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(trajectory.erase(1), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase3(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.add(point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.erase(0));
+
+		Trajectory<T> emptyTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory, emptyTrajectory);
+	}
+
+	void testErase4(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.add(point);
+		CPPUNIT_ASSERT_THROW(trajectory.erase(1), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase5(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(0));
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 99);
+	}
+
+	void testErase6(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(1));
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 99);
+	}
+
+	void testErase7(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(0));
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(0));
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 98);
+	}
+
+	void testErase8(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(sampleTrajectory.size() - 1));
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(sampleTrajectory.size() - 1));
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 98);
+	}
+
+	void testErase9(void)
+	{
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.erase(sampleTrajectory.size()), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase10(void)
+	{
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.erase(sampleTrajectory.size() + 1), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase11(void)
+	{
+		for (unsigned int i = 0; i < 100; ++i)
+		{
+			CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(0));
+			CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), 100 - i - 1);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 0);
+
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.erase(0), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase12(void)
+	{
+		for (unsigned int i = 0; i < 100; ++i)
+		{
+			CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.erase(sampleTrajectory.size() - 1));
+		}
+
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 0);
+
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.erase(0), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testErase13(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+
+		trajectory.insert(20, 20, point);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+
+		trajectory.erase(20);
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testErase14(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+
+		trajectory.insert(20, 20, point);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+
+		trajectory.erase(10);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+	}
+
+	void testPop_back1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(trajectory.pop_back(), TrajectoryLengthErrorException);
+	}
+
+	void testPop_back2(void)
+	{
+		CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int) 100);
+
+		for (int i = 100; i > 0; --i)
+		{
+			CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.pop_back());
+			CPPUNIT_ASSERT_EQUAL(sampleTrajectory.size(), (unsigned int)(i - 1));
+		}
+
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.pop_back(), TrajectoryLengthErrorException);
+	}
+
+	void testPop_back3(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+
+		trajectory.add(point);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+
+		trajectory.pop_back();
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testPop_back4(void)
+	{
+		T point;
+		initPoint(point, int(10), int(40), int(80));
+
+		Trajectory<T> trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+
+		trajectory.insert(trajectory.size(), 20, point);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+
+		trajectory.pop_back();
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testOperatorGet(void)
+	{
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			T point1 = sampleTrajectory[i];
+			T point2;
+			initPoint(point2, int(i), int(i + 10), int(i + 20));
+			CPPUNIT_ASSERT_EQUAL(point1, point2);
+		}
+	}
+
+	void testAt1(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(trajectory.at(0), TrajectoryOutOfRangeErrorException);
+		CPPUNIT_ASSERT_THROW(trajectory.at(1), TrajectoryOutOfRangeErrorException);
+		CPPUNIT_ASSERT_THROW(trajectory.at(2), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testAt2(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.add(point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.at(0));
+		CPPUNIT_ASSERT_THROW(trajectory.at(1), TrajectoryOutOfRangeErrorException);
+		CPPUNIT_ASSERT_THROW(trajectory.at(2), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testAt3(void)
+	{
+		const T point = sampleTrajectory.getPoint(0);
+		Trajectory<T> trajectory;
+		trajectory.add(point);
+		trajectory.add(point);
+		CPPUNIT_ASSERT_NO_THROW(trajectory.at(0));
+		CPPUNIT_ASSERT_NO_THROW(trajectory.at(1));
+		CPPUNIT_ASSERT_THROW(trajectory.at(2), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testAt4(void)
+	{
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			T point1;
+			CPPUNIT_ASSERT_NO_THROW(point1 = sampleTrajectory.at(i));
+			T point2;
+			initPoint(point2, int(i), int(i + 10), int(i + 20));
+			CPPUNIT_ASSERT_EQUAL(point1, point2);
+		}
+	}
+
+	void testAt5(void)
+	{
+		CPPUNIT_ASSERT_NO_THROW(sampleTrajectory.at(sampleTrajectory.size() - 1));
+	}
+
+	void testAt6(void)
+	{
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.at(sampleTrajectory.size()), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testAt7(void)
+	{
+		CPPUNIT_ASSERT_THROW(sampleTrajectory.at(sampleTrajectory.size() + 1), TrajectoryOutOfRangeErrorException);
+	}
+
+	void testShift1(void)
+	{
+		const int shiftX = 8;
+		const int shiftY = 4;
+		const int shiftZ = 2;
+
+		T shiftPoint;
+		initPoint(shiftPoint, shiftX, shiftY, shiftZ);
+		sampleTrajectory.shift(shiftPoint);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const T p1 = sampleTrajectory.getPoint(i);
+			T p2;
+			initPoint(p2, int(i) + shiftX, int(i + 10) + shiftY, int(i + 20) + shiftZ);
+			CPPUNIT_ASSERT_EQUAL(p1, p2);
+		}
+	}
+
+	void testShift2(void)
+	{
+		const int shiftX1 = 1;
+		const int shiftX2 = 10;
+		const int shiftY1 = 2;
+		const int shiftY2 = 20;
+		const int shiftZ1 = 3;
+		const int shiftZ2 = 30;
+
+		T shiftPoint1;
+		T shiftPoint2;
+		T shiftPoint3;
+		initPoint(shiftPoint1, shiftX1, shiftY1, shiftZ1);
+		initPoint(shiftPoint2, shiftX2, shiftY2, shiftZ2);
+		initPoint(shiftPoint3, shiftX1 + shiftX2, shiftY1 + shiftY2, shiftZ1 + shiftZ2);
+
+		Trajectory<T> trajectory = sampleTrajectory;
+
+		trajectory.shift(shiftPoint1);
+		trajectory.shift(shiftPoint2);
+
+		sampleTrajectory.shift(shiftPoint3);
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testOperatorEq1(void)
+	{
+		CPPUNIT_ASSERT(sampleTrajectory == sampleTrajectory);
+	}
+
+	void testOperatorEq2(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		CPPUNIT_ASSERT(trajectory == sampleTrajectory);
+	}
+
+	void testOperatorEq3(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		trajectory.pop_back();
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+	}
+
+	void testOperatorEq4(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		trajectory.setId(2);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+	}
+
+	void testOperatorEq5(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		trajectory.setCheckAscFrameNumber(true);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+	}
+
+	void testOperatorEq6(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		trajectory.pop_back();
+		const TrajectoryElement<T> trajectoryElement = sampleTrajectory.getTrajectoryElement(sampleTrajectory.size() - 1);
+		trajectory.add(trajectoryElement);
+		CPPUNIT_ASSERT(trajectory == sampleTrajectory);
+	}
+
+	void testOperatorEq7(void)
+	{
+		Trajectory<T> trajectory = sampleTrajectory;
+		trajectory.pop_back();
+		TrajectoryElement<T> trajectoryElement = sampleTrajectory.getTrajectoryElement(sampleTrajectory.size() - 1);
+		trajectoryElement.setFrameNumber(2);
+		trajectory.add(trajectoryElement);
+		CPPUNIT_ASSERT(trajectory != sampleTrajectory);
+	}
+
+	void testOperatorEq8(void)
+	{
+		const Trajectory<T> trajectory = sampleTrajectory;
+
+		T point;
+
+		initPoint(point, int(99), int(99 + 10), int(99 + 20));
+		sampleTrajectory.pop_back();
+		sampleTrajectory.add(100, point);
+		CPPUNIT_ASSERT(sampleTrajectory == trajectory);
+
+		initPoint(point, int(99 + 1), int(99 + 10), int(99 + 20));
+		sampleTrajectory.pop_back();
+		sampleTrajectory.add(100, point);
+		CPPUNIT_ASSERT(sampleTrajectory != trajectory);
+
+		initPoint(point, int(99), int(99 + 10 + 1), int(99 + 20));
+		sampleTrajectory.pop_back();
+		sampleTrajectory.add(100, point);
+		CPPUNIT_ASSERT(sampleTrajectory != trajectory);
+
+		initPoint(point, int(99), int(99 + 10), int(99 + 20 + 1));
+		sampleTrajectory.pop_back();
+		sampleTrajectory.add(100, point);
+		if (dim(point) == 2)
+		{
+			CPPUNIT_ASSERT(sampleTrajectory == trajectory);
+		}
+		else if (dim(point) == 3)
+		{
+			CPPUNIT_ASSERT(sampleTrajectory != trajectory);
+		}
+	}
+
+	void testOperatorAdd1(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory.setId(1);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			const T point = sampleTrajectory.getPoint(i);
+
+			trajectory += point;
+
+			const TrajectoryElement<T> trajectoryElement1(frameNumber, point);
+			const TrajectoryElement<T> trajectoryElement2 = trajectory.getTrajectoryElement(i);
+
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testOperatorAdd2(void)
+	{
+		Trajectory<T> trajectory;
+		trajectory.setId(1);
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			const unsigned int frameNumber = sampleTrajectory.getFrameNumber(i);
+			const T point = sampleTrajectory.getPoint(i);
+
+			const TrajectoryElement<T> trajectoryElement1(frameNumber, point);
+
+			trajectory += trajectoryElement1;
+
+			const TrajectoryElement<T> trajectoryElement2 = trajectory.getTrajectoryElement(i);
+
+			CPPUNIT_ASSERT_EQUAL(trajectoryElement1, trajectoryElement2);
+		}
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testOperatorIn1(void)
+	{
+		Trajectory<T> trajectory;
+		stringstream ss;
+		ss << trajectory;
+		CPPUNIT_ASSERT_EQUAL(ss.str(), string("0"));
+	}
+
+	void testOperatorIn2(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+
+		Trajectory<T> trajectory;
+		trajectory.setId(2);
+		trajectory.add(4, point);
+
+		string s("2 4 10 20");
+		if (dim(point) == 3)
+		{
+			s += string(" 30");
+		}
+
+		stringstream ss;
+		ss << trajectory;
+
+		CPPUNIT_ASSERT_EQUAL(ss.str(), s);
+	}
+
+	void testOperatorIn3(void)
+	{
+		sampleTrajectory.setId(20);
+
+		string s("20");
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			stringstream ss;
+			ss << string(" ") << i + 1 << string(" ") << i << string(" ") << i + 10;
+			if (dim(sampleTrajectory.getPoint(0)) == 3)
+			{
+				ss << string(" ") << i + 20;
+			}
+			s += ss.str();
+		}
+
+		stringstream ss;
+		ss << sampleTrajectory;
+
+		CPPUNIT_ASSERT_EQUAL(ss.str(), s);
+	}
+
+	void testOperatorOut1(void)
+	{
+		Trajectory<T> trajectory1;
+		stringstream ss;
+		ss << trajectory1;
+
+		Trajectory<T> trajectory2;
+		istringstream is(ss.str());
+		is >> trajectory2;
+
+		CPPUNIT_ASSERT_EQUAL(trajectory1, trajectory2);
+	}
+
+	void testOperatorOut2(void)
+	{
+		T point;
+		initPoint(point, int(10), int(20), int(30));
+
+		Trajectory<T> trajectory1;
+		trajectory1.setId(2);
+		trajectory1.add(4, point);
+
+		string s("2 4 10 20");
+		if (dim(point) == 3)
+		{
+			s += " 30";
+		}
+
+		stringstream ss;
+		ss << trajectory1;
+
+		Trajectory<T> trajectory2;
+		istringstream is(ss.str());
+		is >> trajectory2;
+
+		CPPUNIT_ASSERT_EQUAL(trajectory1, trajectory2);
+	}
+
+	void testOperatorOut3(void)
+	{
+		sampleTrajectory.setId(20);
+
+		string s("20");
+
+		for (unsigned int i = 0; i < sampleTrajectory.size(); ++i)
+		{
+			stringstream ss;
+			ss << " " << i + 1 << " " << i << " " << i + 10;
+			if (dim(sampleTrajectory.getPoint(0)) == 3)
+			{
+				ss << " " << i + 20;
+			}
+			s += ss.str();
+		}
+
+		stringstream ss;
+		ss << sampleTrajectory;
+
+		Trajectory<T> trajectory;
+		istringstream is(ss.str());
+		is >> trajectory;
+
+		CPPUNIT_ASSERT_EQUAL(trajectory, sampleTrajectory);
+	}
+
+	void testMin1(void)
+	{
+		T point1;
+		initPoint(point1, 0, 10, 20);
+		T point2;
+		CPPUNIT_ASSERT_NO_THROW(point2 = min(sampleTrajectory));
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+	void testMin2(void)
+	{
+		Trajectory<T> trajectory;
+		T point1;
+		for (unsigned int i = 0; i < 100; ++i)
+		{
+			initPoint(point1, i + 4, 104 - i, i % 24 + 1);
+			trajectory += point1;
+		}
+
+		initPoint(point1, 4, 5, 1);
+
+		T point2;
+		CPPUNIT_ASSERT_NO_THROW(point2 = min(trajectory));
+
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+	void testMin3(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(min(trajectory), TrajectoryLengthErrorException);
+	}
+
+	void testMin4(void)
+	{
+		Trajectory<T> trajectory;
+		T point1, point2;
+		initPoint(point1, 8, 4, 2);
+		trajectory.add(point1);
+		CPPUNIT_ASSERT_NO_THROW(point2 = min(trajectory));
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+	void testMax1(void)
+	{
+		T point1;
+		initPoint(point1, int(99), int(109), int(119));
+		T point2;
+		CPPUNIT_ASSERT_NO_THROW(point2 = max(sampleTrajectory));
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+	void testMax2(void)
+	{
+		Trajectory<T> trajectory;
+		T point1;
+		for (unsigned int i = 0; i < 100; ++i)
+		{
+			initPoint(point1, int(i + 4), int(104 - i), int(i % 24 + 1));
+			trajectory += point1;
+		}
+
+		initPoint(point1, 103, 104, 24);
+
+		T point2;
+		CPPUNIT_ASSERT_NO_THROW(point2 = max(trajectory));
+
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+	void testMax3(void)
+	{
+		Trajectory<T> trajectory;
+		CPPUNIT_ASSERT_THROW(max(trajectory), TrajectoryLengthErrorException);
+	}
+
+	void testMax4(void)
+	{
+		Trajectory<T> trajectory;
+		T point1, point2;
+		initPoint(point1, 8, 4, 2);
+		trajectory.add(point1);
+		CPPUNIT_ASSERT_NO_THROW(point2 = max(trajectory));
+		CPPUNIT_ASSERT_EQUAL(point1, point2);
+	}
+
+private:
+	Trajectory<T> sampleTrajectory;
+};
+
+#endif /* TRAJECTORYTEST_H_ */