Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: Transform.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of Transform.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __TRANSFORM__H__INCLUDED__
  15. #define __TRANSFORM__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. class CVector
  20. {
  21. public:
  22. CVector();
  23. CVector( double a0, double a1, double a2 ) { Set( a0, a1, a2 ); }
  24. ~CVector(){}
  25. public:
  26. void Set( double a0, double a1, double a2 );
  27. public:
  28. double& operator[] ( int i ) { return m_pElement[i]; }
  29. CVector& operator =( CVector& v );
  30. CVector& operator -=( CVector& v );
  31. CVector& operator +=( CVector& v );
  32. CVector& operator *=( double d );
  33. CVector& operator -();
  34. public:
  35. friend CVector operator *( CVector& v, double d ) { return CVector(v)*=d; }
  36. friend CVector operator -( CVector& v1, CVector& v2 ) { return CVector(v1)-=v2; }
  37. friend CVector operator +( CVector& v1, CVector& v2 ) { return CVector(v1)+=v2; }
  38. private:
  39. double m_pElement[3];
  40. };
  41. class CMatrix
  42. {
  43. public:
  44. CMatrix();
  45. CMatrix( double a00, double a01, double a02,
  46. double a10, double a11, double a12,
  47. double a20, double a21, double a22 ) { Set( a00, a01, a02, a10, a11, a12, a20, a21, a22 ); }
  48. ~CMatrix() {}
  49. public:
  50. void Set( double a00, double a01, double a02,
  51. double a10, double a11, double a12,
  52. double a20, double a21, double a22 );
  53. public:
  54. double* operator[] ( int i ) { return m_pElement[i]; }
  55. CMatrix& operator =( CMatrix& m );
  56. CMatrix& operator *=( CMatrix& m ) { return *this=CMatrix(*this)*m; }
  57. public:
  58. friend CMatrix operator *( CMatrix& m1, CMatrix& m2 );
  59. friend CVector operator *( CMatrix& m, CVector& v );
  60. friend CVector operator *( CVector& v, CMatrix& m ) { return m*v; }
  61. private:
  62. double m_pElement[3][3];
  63. };
  64. class CTransform
  65. {
  66. public:
  67. CTransform();
  68. ~CTransform();
  69. double* GetParameters() { return m_Values; }
  70. void Prepare( double Xc, double Yc, double Zc, double Psicd, double Thetacd, double Phicd );
  71. bool Evaluate( double angle, double range, double& pan, double& tilt, double& zoom );
  72. private:
  73. CMatrix m_Matrix;
  74. CVector m_Vector;
  75. bool m_bPrepared;
  76. double m_Values[6];
  77. };
  78. #endif