// ***************************************************************
//  CornerTracker   version:  1.0   ·  date: 12/15/2006
//  -------------------------------------------------------------
//  Author: Pablo Carneiro Elias
//  -------------------------------------------------------------
//  
//  -------------------------------------------------------------
//  Copyright (C) 2006 - All Rights Reserved
// ***************************************************************
// 
// ***************************************************************

#ifndef __CORNER_TRACKER_H__
#define __CORNER_TRACKER_H__
#include "TrackedCorners.h"

namespace
{
	// Minimum squared distance in pixels (euclidian distance= sqrt(POINT_MINIMUM_SQ_DISTANCE) )
	const float POINT_MINIMUM_SQ_DISTANCE = 64;
	const float MINIMUM_TRUSTY_RATE = 0.25;
	const float TRUSTY_CHANGING_RATE = 0.01;
};

class CornerTracker
{
public:
	/* Select the nearest corners from userPoints to detectedPoints
	   If a point could not be selected among userPoints, because there is no close 
	   enough detectedCorner from it, it is classified as invalid and 
	   its trustyLevel is decreased. */
	inline void trackCorners( const int *usersPoints, const int *detectedPoints, int numUserPoints, int numDetectedPoints, TrackedCorners *trackedCorners )
	{
		trackCornersN2( usersPoints, detectedPoints, numUserPoints, numDetectedPoints, trackedCorners );
	}

private:

	void trackCornersN2( const int *usersPoints, const int *detectedPoints, int numUserPoints, int numDetectedPoints, TrackedCorners *trackedCorners );

};

#endif