#pragma once

class CFlannMatch
{
public:
	CFlannMatch(void);
	virtual ~CFlannMatch(void);
 	CFlannMatch(int maxLeafs  , int knn );
 

	void ReleaseAll();

	//第一种用法
	int  Do(const RvPoint* pPattArr, int nPattSize, const RvPoint* pSceneArr, int nSceneSize);
	int  Do(const RvPoint_f64* pPattArr, int nPattSize, const RvPoint_f64* pSceneArr, int nSceneSize);
	int  Do(const RvPoint_f * pPattArr, int nPattSize, const RvPoint_f * pSceneArr, int nSceneSize);

	//第二种用法，效率高
	BOOL Build(const RvPoint* pSceneArr, int nSceneSize);
	BOOL Build(const RvPoint_f* pSceneArr, int nSceneSize);
	BOOL Build(const RvPoint_f64* pSceneArr, int nSceneSize);

	int  Do(const RvPoint  * pPattArr, int nPattSize);
	int  Do(const RvPoint_f * pPattArr, int nPattSize);
	int  Do(const RvPoint_f64 * pPattArr, int nPattSize);


 
	int     GetPairCount(){ return m_nArrSize;};
	int*    GetIndexArray() { return m_pIndexArr; };
	double* GetDistArray() { return m_pDistArr; };

public:
	int     m_nMaxLeafs ;
	int     m_nKnn ;

private:
	void*  m_pCxt;

	

	int*    m_pIndexArr;
    double* m_pDistArr;
	int     m_nArrSize;
};

