#pragma once

#include "cvcls.h"


#define SM_MTX_SZE    9
//#define SM_CTCP_SZE   3


class CVCLS_API CRobotSpaceMap
{
public:
	CRobotSpaceMap(void);
	virtual ~CRobotSpaceMap(void);

	 
	BOOL Learn(RvPoint_f64* pCtcpImage, RvPoint_f64* pCtcpMach,int count );

	BOOL Learn(RvPoint_f* pCtcpImage, RvPoint_f* pCtcpMach,int count);

	BOOL Learn(RvPoint * pCtcpImage, RvPoint * pCtcpMach,int count);



	//输入图像坐标，获得机械坐标
	RvPoint_f64 GetCoord(double x, double y  );
	RvPoint_f64 GetCoord(int x, int y   );
	RvPoint_f64 GetCoord(float x, float y  );

	RvPoint_f64 GetCoord(RvPoint_f64 pos   );
	RvPoint_f64 GetCoord(RvPoint_f  pos  );
	RvPoint_f64 GetCoord(RvPoint  pos   );
	  
	BOOL Serialze(HANDLE hFile, BOOL bIn);
	 
	//获得机械坐标
	//RvPoint_f64 GetRefpos(){ return m_refpos; }
	
	//设置像素坐标,
	//BOOL SetRefpos(RvPoint_f64 pos);
	 
	int GetCtrlCount(){  return m_nCtcpCount; };

	double GetMatrixElem(int index) ;

	BOOL IsValid();

protected:
//	RvPoint_f64 TransPos3P(RvPoint_f64 point);
	
	//机械坐标
	//RvPoint_f64 m_refpos;
	
private:
	double      m_mtx[SM_MTX_SZE];
//	RvPoint_f64 m_ctcpSrc[SM_CTCP_SZE];
//	RvPoint_f64 m_ctcpDst[SM_CTCP_SZE];
	int         m_nCtcpCount;

};

