⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2dmatrix.h

📁 用C++开发的一个人工神经网络小游戏
💻 H
字号:
// 2DMatrix.h: interface for the C2DMatrix class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_2DMATRIX_H__4A66FF06_4DE2_46BE_9519_B987BF683516__INCLUDED_)
#define AFX_2DMATRIX_H__4A66FF06_4DE2_46BE_9519_B987BF683516__INCLUDED_

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

#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
//#include "utils.h"
#include "SVector2D.h"

using namespace std;

class C2DMatrix
{
private:
  
  struct S2DMatrix
  {

	  double _11, _12, _13;
	  double _21, _22, _23;
	  double _31, _32, _33;

    S2DMatrix()
	  {
		  _11=0.0f; _12=0.0f; _13=0.0f;
		  _21=0.0f; _22=0.0f; _23=0.0f;
		  _31=0.0f; _32=0.0f; _33=0.0f;
	  }

    friend ostream &operator<<(ostream& os, const S2DMatrix &rhs)
	  {
		  os << "\n" << rhs._11 << "  " << rhs._12 << "  " << rhs._13;

		  os << "\n" << rhs._21 << "  " << rhs._22 << "  " << rhs._23;

		  os << "\n" << rhs._31 << "  " << rhs._32 << "  " << rhs._33;

		  return os;
	  }
  };

  S2DMatrix m_Matrix;

  //multiplies m_Matrix with the passed matrix
  void S2DMatrixMultiply(S2DMatrix &mIn);
public:

  C2DMatrix()
  {
    //initialize the matrix to an identity matrix
    Identity();
  }

  //create an identity matrix
  void Identity();
  
  //create a transformation matrix
  void	Translate(double x, double y);

  //create a scale matrix
  void	Scale(double xScale, double yScale);

  //create a rotation matrix
  void Rotate(double rotation);

   //applys a transformation matrix to a std::vector of points
  void TransformSPoints(SPoint vPoint[], SPoint vPoint2[]);

};

#endif // !defined(AFX_2DMATRIX_H__4A66FF06_4DE2_46BE_9519_B987BF683516__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -