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.

126 lines
3.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 5/04/2001
  5. // Last modification: 08/10/2003
  6. // Project Intruder Position Indicator
  7. // SUBSYSTEM: Receiver/Transmitter information from/to LGS
  8. // FILE: Transform.h
  9. // AUTHOR: Belkovsky Joseph
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of classes vector_3, matrix_3 and transform_3
  13. //----------------------------------------------------------------------------
  14. #if !defined(__transform_h_guard__)
  15. #define __transform_h_guard__
  16. struct ptz_params {
  17. float pan;
  18. float tilt;
  19. float dist;// Transformed to zoom
  20. };
  21. class vector_3 {
  22. public:
  23. vector_3(double a0 = 0, double a1 = 0, double a2 = 0);
  24. double& operator [] (__int8) const;
  25. vector_3 operator + (const vector_3&);
  26. vector_3 operator - (const vector_3&);
  27. double operator * (const vector_3&) const;
  28. friend vector_3 operator * (double, const vector_3&);
  29. private:
  30. double elem_[3];
  31. };
  32. inline
  33. double& vector_3::operator [] (__int8 idx) const
  34. {
  35. return const_cast<double&> (elem_[idx]);
  36. }
  37. inline
  38. vector_3 vector_3::operator + (const vector_3& vector)
  39. {
  40. return vector_3(elem_[0] + vector.elem_[0],
  41. elem_[1] + vector.elem_[1],
  42. elem_[2] + vector.elem_[2]);
  43. }
  44. inline
  45. vector_3 vector_3::operator - (const vector_3& vector)
  46. {
  47. return vector_3(elem_[0] - vector.elem_[0],
  48. elem_[1] - vector.elem_[1],
  49. elem_[2] - vector.elem_[2]);
  50. }
  51. inline
  52. double vector_3::operator * (const vector_3& vector) const
  53. {
  54. return elem_[0] * vector.elem_[0] +
  55. elem_[1] * vector.elem_[1] +
  56. elem_[2] * vector.elem_[2];
  57. }
  58. inline
  59. vector_3 operator * (double scalar, const vector_3& vector)
  60. {
  61. return vector_3(vector.elem_[0] * scalar,
  62. vector.elem_[1] * scalar,
  63. vector.elem_[2] * scalar);
  64. }
  65. class matrix_3 {
  66. public:
  67. matrix_3(double a00 = 0, double a01 = 0, double a02 = 0,
  68. double a10 = 0, double a11 = 0, double a12 = 0,
  69. double a20 = 0, double a21 = 0, double a22 = 0);
  70. matrix_3 operator * (const matrix_3&) const;
  71. vector_3 operator * (const vector_3&) const;
  72. matrix_3& operator *= (const matrix_3&);
  73. friend matrix_3 operator * (double, const matrix_3&);
  74. friend vector_3 operator * (const vector_3&, const matrix_3&);
  75. private:
  76. double elem_[3][3];
  77. };
  78. inline
  79. matrix_3& matrix_3::operator *= (const matrix_3& matrix)
  80. {
  81. return *this = *this * matrix;
  82. }
  83. class transform_3 {
  84. public:
  85. transform_3(double Xc, double Yc, double Zc, double Psicd, double Thetacd, double Phicd);
  86. void get_ptz_params(double angle, double range, ptz_params& params);
  87. private:
  88. static const double PI_M;
  89. static const double DTOR;
  90. static const double RTOD;
  91. private:
  92. matrix_3 core_matrix_; // Camera rotation matrix
  93. vector_3 core_vector_; // Camera translation vector
  94. };
  95. #endif // __transform_h_guard__