EULER.H 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /Commando/Code/Tools/max2w3d/EULER.H 3 10/28/97 6:08p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G 3D Engine *
  24. * *
  25. * $Archive:: /Commando/Code/Tools/max2w3d/EULER.H $*
  26. * *
  27. * $Author:: Greg_h $*
  28. * *
  29. * $Modtime:: 10/14/97 3:08p $*
  30. * *
  31. * $Revision:: 3 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef EULER_H
  37. #define EULER_H
  38. #include <Max.h>
  39. /*********************************************************************
  40. Euler Order Types
  41. When creating an EulerAngles object, use one of the below
  42. constants to describe the axis convention.
  43. XYZ - order of the axes
  44. s/r - whether the rotations are applied to the static or
  45. rotating frame.
  46. *********************************************************************/
  47. /* static axes */
  48. extern int EulerOrderXYZs;
  49. extern int EulerOrderXYXs;
  50. extern int EulerOrderXZYs;
  51. extern int EulerOrderXZXs;
  52. extern int EulerOrderYZXs;
  53. extern int EulerOrderYZYs;
  54. extern int EulerOrderYXZs;
  55. extern int EulerOrderYXYs;
  56. extern int EulerOrderZXYs;
  57. extern int EulerOrderZXZs;
  58. extern int EulerOrderZYXs;
  59. extern int EulerOrderZYZs;
  60. /* rotating axes */
  61. extern int EulerOrderXYZr;
  62. extern int EulerOrderXYXr;
  63. extern int EulerOrderXZYr;
  64. extern int EulerOrderXZXr;
  65. extern int EulerOrderYZXr;
  66. extern int EulerOrderYZYr;
  67. extern int EulerOrderYXZr;
  68. extern int EulerOrderYXYr;
  69. extern int EulerOrderZXYr;
  70. extern int EulerOrderZXZr;
  71. extern int EulerOrderZYXr;
  72. extern int EulerOrderZYZr;
  73. /*********************************************************************
  74. EulerAnglesClass
  75. The purpose for this class is mainly for conversion. You can
  76. choose a convention for the order of your rotations and then
  77. convert matrices into a set of euler angles.
  78. This implementation is based on the code in Graphics Gems IV
  79. by Ken Shoemake. The original article is on page 222.
  80. *********************************************************************/
  81. class EulerAnglesClass
  82. {
  83. public:
  84. EulerAnglesClass(void) : Order(0) { Angle[0] = 0.0; Angle[1] = 0.0; Angle[2] = 0.0; };
  85. EulerAnglesClass(const Matrix3 & from,int order);
  86. void From_Matrix(const Matrix3 & from,int order);
  87. void To_Matrix(Matrix3 & M);
  88. double Get_Angle(int i);
  89. private:
  90. double Angle[3];
  91. int Order;
  92. };
  93. #endif /*EULER_H*/