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

📄 matrix.h

📁 C arm 3D traslate 模擬C手臂在三度空間移動
💻 H
字号:
#if !defined(AFX_Matrix_H__714E64E1_8570_11D5_A575_0000C55D1C1C__INCLUDED_)
#define AFX_Matrix_H__714E64E1_8570_11D5_A575_0000C55D1C1C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Matrix.h : header file
//



/////////////////////////////////////////////////////////////////////////////
// CMatrix command target

class TS_DLL_KERNEL CMatrix : public CObject
{
	DECLARE_SERIAL(CMatrix)

// Attributes
public:
   double m_elem[3][3];

public:
  //constructor
	CMatrix();
  CMatrix( double d );  //diagonal elements = d
  CMatrix( CVector&, CVector&, CVector& ); //column vectors
  CMatrix( double elem[3][3] );  //3x3 elements

  //copy constructor
  CMatrix( const CMatrix& m );

  //assignment operator, cleanup & copy
  CMatrix& operator= ( const CMatrix& m );

protected:
  void DoCopy( const CMatrix& m );

public:
	virtual ~CMatrix();

  //serialization support
	virtual void Serialize(CArchive& ar);
  void SerializeThisSchema(CArchive& ar);

  //access
  double  Element( int i, int j ) const;
  CVector Row( int i ) const;
  CVector Col( int j ) const;

  void SetElement( int i, int j, double elem );
  void SetRow( int i, CVector& v );
  void SetCol( int j, CVector& v );


  //operator
  //multiplication M = M1 * M2
  TS_DLL_KERNEL friend CMatrix operator* ( CMatrix& a, CMatrix& b );

  //rotate a vector by a matrix, V = M * V1
  TS_DLL_KERNEL friend CVector operator* ( CMatrix& m, CVector& v );

  //comparision, accuray M_EPS10
  BOOL operator==( CMatrix& ) const;
  BOOL operator!=( CMatrix& rhs ) const { return !(*this == rhs ); }

  //transpose
  CMatrix Transpose() const;

  //determinant
  double Determinant() const;
};

#endif // !defined(AFX_Matrix_H__714E64E1_8570_11D5_A575_0000C55D1C1C__INCLUDED_)

⌨️ 快捷键说明

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