亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? matrix.h

?? 克里金、反距離插值算法_柵格圖等值線填充等
?? H
字號:
// Matrix.h: interface for the Matrix class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MATRIX_H__3461DABF_4919_4B31_81EA_AC9397ABBAE1__INCLUDED_)
#define AFX_MATRIX_H__3461DABF_4919_4B31_81EA_AC9397ABBAE1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>

class MatrixException
{
public:
	MatrixException(std::string message) throw() {}
};

template<class T>
class TMatrix
{
public:
	TMatrix() throw() : m_nWidth(0), m_nHeight(0), m_arByte(NULL) {}
	TMatrix(int nWidth, int nHeight) throw();
	TMatrix(int nWidth, int nHeight, T* pByte) throw();
	TMatrix(const TMatrix& rhs) throw();
	virtual ~TMatrix();
	void SetDimension(int nWidth, int nHeight) throw();
	void ZeroAll() throw();
	void Clean() throw();
	TMatrix& operator=(const TMatrix& rhs) throw();
	void operator+=(const TMatrix& rhs) throw(MatrixException);
	void operator-=(const TMatrix& rhs) throw(MatrixException);
	void PriorityAdd(const TMatrix& rhs) throw(MatrixException);
	// inline access functions
	T& operator[](int nIndex) throw(MatrixException);
	T operator[](int nIndex) const throw(MatrixException);
	T& operator()(int nRow, int nCol) throw(MatrixException);
	T operator()(int nRow, int nCol) const throw(MatrixException);
	// getter
	int GetWidth() const throw() { return m_nWidth; }
	int GetHeight() const throw() { return m_nHeight; }
	// uitilies
	T* GetRow(int nIndex) throw(MatrixException);
	T* GetArray() throw();
	bool IsSameDimension(const TMatrix& rhs) const throw();
	void MakeSameDimension(TMatrix& output) const throw(MatrixException);
	// virtual functions
	virtual void Load(std::string filename) throw(MatrixException) { throw MatrixException(_T("Not Implemented")); }
	virtual void Save(std::string filename) const throw(MatrixException) { throw MatrixException(_T("Not Implemented")); }
#ifdef _DEBUG
	virtual void Dump(std::ostream& os) const throw();
#endif
protected:
	T* m_arByte;
	int m_nWidth;
	int m_nHeight;
};

template<class T>
inline T& TMatrix<T>::operator[](int nIndex) throw(MatrixException)
{
#ifdef _DEBUG
	if(nIndex < 0 || nIndex >= m_nWidth * m_nHeight) {
		TCHAR buffer[MAX_PATH];
		::sprintf(buffer, _T("Index out of bound : %d"), nIndex);
		throw MatrixException(buffer);
	}
#endif
	return m_arByte[nIndex];
}

template<class T>
inline T TMatrix<T>::operator[](int nIndex) const throw(MatrixException)
{
#ifdef _DEBUG
	if(nIndex < 0 || nIndex >= m_nWidth * m_nHeight)
		throw MatrixException(_T("Index out of bound const []"));
#endif
	return m_arByte[nIndex];
}

template<class T>
inline T& TMatrix<T>::operator()(int nRow, int nCol) throw(MatrixException)
{
#ifdef _DEBUG
	if(nCol <0 || nCol >= m_nWidth || nRow < 0 || nRow >= m_nHeight) {
		TCHAR buffer[MAX_PATH];
		::sprintf(buffer, _T("Index out of bound : row %d, col %d"), nRow, nCol);
		throw MatrixException(buffer);
	}
#endif
	return m_arByte[nCol + nRow * m_nWidth];
}

template<class T>
inline T TMatrix<T>::operator()(int nRow, int nCol) const throw(MatrixException)
{
#ifdef _DEBUG
	if(nCol <0 || nCol >= m_nWidth || nRow < 0 || nRow >= m_nHeight) {
		TCHAR buffer[MAX_PATH];
		::sprintf(buffer, _T("Index out of bound : row %d, col %d"), nRow, nCol);
		throw MatrixException(buffer);
	}
#endif
	return m_arByte[nCol + nRow * m_nWidth];
}

template<class T>
TMatrix<T>::TMatrix(int nWidth, int nHeight) throw() : m_nWidth(nWidth), m_nHeight(nHeight)
{
	int nTotalSize = nWidth * nHeight;
	m_arByte = new T[nTotalSize];
	::memset(m_arByte, 0, sizeof(T) * nTotalSize);
}

template<class T>
TMatrix<T>::TMatrix(int nWidth, int nHeight, T* pByte) throw() : m_nWidth(nWidth), m_nHeight(nHeight)
{
	int nTotalSize = nWidth * nHeight;
	m_arByte = new T[nTotalSize];
	::memcpy(m_arByte, pByte, sizeof(T) * nTotalSize);
}

template<class T>
TMatrix<T>::TMatrix(const TMatrix<T>& rhs) throw()
{
	m_nWidth = rhs.m_nWidth;
	m_nHeight = rhs.m_nHeight;
	int nTotalSize = m_nWidth * m_nHeight;
	m_arByte = new T[nTotalSize];
	::memcpy(m_arByte, rhs.m_arByte, sizeof(T) * nTotalSize);
}

template<class T>
TMatrix<T>::~TMatrix()
{
	Clean();
}

template<class T>
void TMatrix<T>::SetDimension(int nWidth, int nHeight) throw()
{
	Clean();
	m_nWidth = nWidth;
	m_nHeight = nHeight;
	int nTotalSize = m_nWidth * m_nHeight;
	m_arByte = new T[nTotalSize];
	::memset(m_arByte, 0, sizeof(T) * nTotalSize);
}

template<class T>
void TMatrix<T>::ZeroAll() throw()
{
	::memset(m_arByte, 0, sizeof(T) * m_nWidth * m_nHeight);
}

template<class T>
void TMatrix<T>::Clean() throw()
{
	m_nWidth = 0;
	m_nHeight = 0;
	if(m_arByte) {
		delete[] m_arByte;
		m_arByte = NULL;
	}
}

template<class T>
TMatrix<T>& TMatrix<T>::operator=(const TMatrix<T>& rhs) throw()
{
	if(&rhs == this)
		return *this;

	if(!IsSameDimension(rhs)) {
		m_nWidth = rhs.m_nWidth;
		m_nHeight = rhs.m_nHeight;
		if(m_arByte)
			delete[] m_arByte;

		int nTotalSize = m_nWidth * m_nHeight;
		m_arByte = new T[nTotalSize];
	}

	::memcpy(m_arByte, rhs.m_arByte, sizeof(T) * m_nWidth * m_nHeight);

	return *this;
}

template<class T>
void TMatrix<T>::operator+=(const TMatrix<T>& rhs) throw(MatrixException)
{
	if(m_nWidth != rhs.GetWidth() || m_nHeight != rhs.GetHeight())
		throw MatrixException(_T("Different dimension in argument") + LOCATION);

	int nTotalByte = m_nWidth * m_nHeight;
	for(int i=0; i<nTotalByte; i++) {
		m_arByte[i] += rhs[i];
		if(m_arByte[i] > 255)
			m_arByte[i] = 255;
	}
}

template<class T>
void TMatrix<T>::operator-=(const TMatrix<T>& rhs) throw(MatrixException)
{
	if(m_nWidth != rhs.GetWidth() || m_nHeight != rhs.GetHeight())
		throw MatrixException(_T("Different dimension in argument") + LOCATION);

	int nTotalByte = m_nWidth * m_nHeight;
	for(int i=0; i<nTotalByte; i++) {
		m_arByte[i] = abs(m_arByte[i] - rhs[i]);
		if(m_arByte[i] > 255)
			m_arByte[i] = 255;
	}
}

template<class T>
void TMatrix<T>::PriorityAdd(const TMatrix<T>& rhs) throw(MatrixException)
{
	if(m_nWidth != rhs.GetWidth() || m_nHeight != rhs.GetHeight())
		throw MatrixException(_T("Different dimension in argument") + LOCATION);

	int nTotalByte = m_nWidth * m_nHeight;
	for(int i=0; i<nTotalByte; i++)
		m_arByte[i] = max(m_arByte[i], rhs[i]);
}

template<class T>
T* TMatrix<T>::GetRow(int nIndex) throw(MatrixException)
{
	if(nIndex < 0 || nIndex >= m_nHeight)
		throw MatrixException(_T("Not existing row index") + LOCATION);

	T* pByte = m_arByte;
	pByte += m_nWidth * nIndex * sizeof(T);
	return pByte;
}

template<class T>
T* TMatrix<T>::GetArray() throw()
{
	return m_arByte;
}

template<class T>
bool TMatrix<T>::IsSameDimension(const TMatrix& rhs) const throw()
{
	if(m_nWidth == rhs.m_nWidth && m_nHeight == rhs.m_nHeight)
		return true;
	else
		return false;
}

template<class T>
void TMatrix<T>::MakeSameDimension(TMatrix<T>& output) const throw()
{
	if(output.m_nHeight != m_nHeight || output.m_nWidth != m_nWidth) {
		output.Clean();
		output.m_nHeight = m_nHeight;
		output.m_nWidth = m_nWidth;
		output.m_arByte = new T[m_nWidth * m_nHeight];
		::memset(output.m_arByte, 0, sizeof(T) * m_nHeight * m_nWidth);
	}
}

#ifdef _DEBUG
template<class T>
void TMatrix<T>::Dump(std::ostream& os) const throw()
{
	for(int i=0; i<m_nHeight; i++)
		for(int j=0; j<m_nWidth; j++)
			os << "(" << i << ", " << j << ") : " << (int)m_arByte[i * m_nWidth + j] << std::endl;
}
#endif

#endif // !defined(AFX_MATRIX_H__3461DABF_4919_4B31_81EA_AC9397ABBAE1__INCLUDED_)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩av亚洲一区二区图片| 奇米在线7777在线精品| 日韩欧美亚洲一区二区| 欧美性大战久久久久久久蜜臀| 成人网在线播放| 丁香一区二区三区| 成人白浆超碰人人人人| 国产v综合v亚洲欧| 成人sese在线| 91丨九色丨国产丨porny| 91污在线观看| 另类综合日韩欧美亚洲| 日韩精品中文字幕一区二区三区| 亚洲一线二线三线视频| 2020国产精品自拍| 欧美伦理影视网| 中文字幕精品一区二区三区精品| 亚洲精品一卡二卡| 精品国产髙清在线看国产毛片 | 日韩一级片网址| 久久av中文字幕片| 日韩二区三区四区| 石原莉奈在线亚洲二区| 亚洲成人在线免费| 精品国产亚洲一区二区三区在线观看| 亚洲精品中文字幕在线观看| 色综合久久久网| 中文字幕精品综合| 色悠悠亚洲一区二区| 亚洲综合成人在线视频| 欧美日免费三级在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 99r国产精品| 成人91在线观看| 欧美人与z0zoxxxx视频| 精品电影一区二区三区| 亚洲欧洲国产日韩| 日本亚洲天堂网| 99久久免费视频.com| 欧美一区二区精品在线| 国产精品色婷婷| 青青草国产精品亚洲专区无| 99久久精品一区二区| 欧美一区二区大片| 亚洲综合丝袜美腿| av在线播放成人| 26uuu国产日韩综合| 亚洲高清视频的网址| 成人国产在线观看| 欧美精品一区二区三区在线播放| 悠悠色在线精品| va亚洲va日韩不卡在线观看| 在线电影欧美成精品| 亚洲人123区| www.成人网.com| 国产视频亚洲色图| 精品在线一区二区| 69av一区二区三区| 一区2区3区在线看| av在线综合网| 欧美精品 国产精品| 欧美日韩在线播放一区| 国产亚洲制服色| 欧美视频一区二区在线观看| 中国av一区二区三区| 欧美一区二区三区免费大片| 欧美日韩一二三区| 欧美精品v国产精品v日韩精品 | 久久久久久久久久久久电影 | 一卡二卡欧美日韩| 日韩在线一二三区| 国内精品在线播放| 免费成人结看片| 日韩av电影天堂| 日本女优在线视频一区二区 | 国产亚洲欧美在线| 欧美日韩aaaaaa| 日韩你懂的在线观看| 色婷婷av一区二区三区软件 | 日本韩国视频一区二区| 久久久精品免费观看| 国产一区二区伦理| 久久女同精品一区二区| 国产毛片精品一区| 国产视频一区在线观看| 国产69精品久久777的优势| 国产日韩在线不卡| 91亚洲精品一区二区乱码| 国产精品视频你懂的| 99视频精品全部免费在线| 亚洲精品高清在线观看| 欧美日韩高清一区二区| 秋霞影院一区二区| 久久久精品人体av艺术| 91在线精品一区二区三区| 亚洲色欲色欲www| 欧美日韩一区二区三区四区五区 | 日韩一区欧美小说| 91久久精品网| 日韩精品福利网| 欧美日本国产一区| 日韩三级免费观看| 国产精品色在线观看| 日韩国产精品91| 91精品国产福利在线观看| 亚洲高清一区二区三区| 欧美日韩国产高清一区| 免费成人在线视频观看| 中文字幕不卡的av| 精品国产一区二区国模嫣然| 欧美视频中文字幕| 91亚洲精品久久久蜜桃网站| 国产一区二区三区免费播放| 毛片基地黄久久久久久天堂| 五月天一区二区| 国产亚洲综合性久久久影院| 日本女优在线视频一区二区| 日韩视频免费观看高清完整版在线观看| 亚洲三级在线观看| 91亚洲国产成人精品一区二三| 欧美一级爆毛片| 成人永久看片免费视频天堂| 日本一区二区在线不卡| 在线观看日产精品| 免费看欧美美女黄的网站| 久久九九国产精品| 天堂蜜桃91精品| 国产日韩欧美精品电影三级在线 | 91精品国产综合久久久久| 国产精品夜夜嗨| 日本欧美加勒比视频| 综合在线观看色| 久久久亚洲午夜电影| 欧美一区二区视频在线观看2020| 91老师片黄在线观看| 风间由美一区二区三区在线观看 | 色婷婷精品久久二区二区蜜臀av| 精品中文字幕一区二区| 日韩精品电影在线观看| 亚洲福利一区二区三区| 亚洲精品中文在线影院| 日韩一区欧美小说| 中文字幕av一区二区三区高| 日韩欧美一级特黄在线播放| 欧美亚洲日本国产| 91官网在线免费观看| 99久久99久久免费精品蜜臀| 国产成人精品亚洲日本在线桃色| 极品少妇xxxx偷拍精品少妇| 国产精品免费人成网站| 亚洲综合清纯丝袜自拍| 国产一区二区免费看| 欧美一区二区在线观看| 色999日韩国产欧美一区二区| www.日本不卡| 日韩精品久久理论片| 亚洲成a人片综合在线| 亚洲午夜激情网站| 极品少妇一区二区三区精品视频| 婷婷国产v国产偷v亚洲高清| 久久精品国产久精国产| 国产永久精品大片wwwapp| 国产乱人伦偷精品视频不卡| 国产·精品毛片| 99久久99久久免费精品蜜臀| 色婷婷久久久亚洲一区二区三区| 91美女蜜桃在线| 欧美日韩精品一区二区天天拍小说 | 亚洲日本护士毛茸茸| 精品国产百合女同互慰| 欧洲一区二区av| 欧美疯狂做受xxxx富婆| 91精品国产综合久久精品性色| 色综合一区二区| 精品成人一区二区三区| 欧美日韩不卡在线| 精品久久久久久综合日本欧美| 久久综合色8888| 久久综合色综合88| 丝袜美腿亚洲一区二区图片| 国产原创一区二区三区| 亚洲国产欧美另类丝袜| 99精品在线免费| 日韩精品中文字幕一区| 久久精品夜色噜噜亚洲aⅴ| 丝瓜av网站精品一区二区| 狠狠久久亚洲欧美| 91国偷自产一区二区三区观看 | 日本v片在线高清不卡在线观看| 亚洲品质自拍视频| 国产在线播精品第三| 91浏览器在线视频| 国产欧美日韩另类视频免费观看| 亚洲主播在线观看| 色婷婷av一区二区三区gif| 精品免费视频.| 日本视频在线一区| 精品国产91久久久久久久妲己| 亚洲美女淫视频| 欧美精品视频www在线观看|