Shapes.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. //
  20. // shapes.h
  21. //
  22. //
  23. // History:
  24. // 12/08/95 BRH Started.
  25. //
  26. // 11/01/96 JMI Changed:
  27. // Old label: New label:
  28. // ========= =========
  29. // CPt RPt
  30. // C2DPoint R2DPoint
  31. // C3DPoint R3DPoint
  32. // CRay RRay
  33. // C2DRay R2DRay
  34. // C3DRay R3dRay
  35. // CRectangle RRectangle
  36. // CCube RCube
  37. // CCircle RCircle
  38. // CSphere RSphere
  39. //
  40. // 02/17/97 JMI Removed ~RSphere() proto (had no body).
  41. //
  42. // 02/18/97 JMI Added empty bodies to ~RRectangle(), ~RCube(), and
  43. // ~RCircle().
  44. // Also, added R2DLine and R3DLine.
  45. //
  46. //////////////////////////////////////////////////////////////////////////////
  47. //
  48. // These shape classes were initially created to be used with the
  49. // regions and in the games. For most of the shapes there are 2D and 3D
  50. // versions. The one you choose would be based on the type of game being
  51. // created.
  52. //
  53. //////////////////////////////////////////////////////////////////////////////
  54. #ifndef SHAPES_H
  55. #define SHAPES_H
  56. class RPt
  57. {
  58. public:
  59. long X;
  60. long Y;
  61. RPt()
  62. {X=Y=0;};
  63. RPt(long lX, long lY)
  64. { X = lX; Y = lY; }
  65. ~RPt() {};
  66. };
  67. class R2DPoint : public RPt
  68. {
  69. public:
  70. R2DPoint(long lX, long lY)
  71. {X = lX; Y = lY;};
  72. };
  73. class R3DPoint : public RPt
  74. {
  75. public:
  76. long Z;
  77. R3DPoint()
  78. {X=Y=Z=0;};
  79. R3DPoint(long lX, long lY, long lZ)
  80. {X = lX; Y = lY; Z = lZ;};
  81. };
  82. class RRay
  83. {
  84. public:
  85. long X; // X originating position
  86. long Y; // Y originating position
  87. float fXVect; // X element of unit vector
  88. float fYVect; // Y element of unit vector
  89. // Constructors
  90. RRay()
  91. {X=Y=0; fXVect=fYVect=(float) 0.0;};
  92. // Destructor
  93. ~RRay() {};
  94. };
  95. class R2DRay : public RRay
  96. {
  97. public:
  98. // Constructors
  99. R2DRay(long lX, long lY, float fXunit, float fYunit)
  100. {X=lX; Y=lY, fXVect=fXunit; fYVect=fYunit;};
  101. R2DRay(long lX1, long lY1, long lX2, long lY2);
  102. // Destructor
  103. ~R2DRay() {};
  104. };
  105. class R3DRay : public RRay
  106. {
  107. public:
  108. long Z; // Z originating position
  109. float fZVect; // Z element of unit vector
  110. // Constructors
  111. R3DRay()
  112. {X=Y=Z=0; fXVect=fYVect=fZVect=(float) 0.0;};
  113. R3DRay(long lX, long lY, long lZ, float fXunit, float fYunit, float fZunit)
  114. {X=lX; Y=lY; Z=lZ; fXVect=fXunit; fYVect=fYunit; fZVect=fZunit;};
  115. R3DRay(long lX1, long lY1, long lZ1, long lX2, long lY2, long lZ2);
  116. // Destructor
  117. ~R3DRay() {};
  118. };
  119. class R2DLine
  120. {
  121. public:
  122. long X1; // X originating position
  123. long Y1; // Y originating position
  124. long X2; // X ending position
  125. long Y2; // Y ending position
  126. // Constructors
  127. R2DLine()
  128. {X1=Y1=X2=Y2=0; }
  129. // Destructor
  130. ~R2DLine() {};
  131. };
  132. class R3DLine : public R2DLine
  133. {
  134. public:
  135. long Z1; // Z originating position
  136. long Z2; // Z ending position
  137. // Constructors
  138. R3DLine()
  139. {Z1=Z2=0; }
  140. // Destructor
  141. ~R3DLine() {};
  142. };
  143. class RRectangle
  144. {
  145. public:
  146. long lLeft; // Left side
  147. long lRight; // Right side
  148. long lTop; // Top side
  149. long lBottom; // Bottom side
  150. // Constructors
  151. RRectangle()
  152. {lLeft=lRight=lTop=lBottom=0;};
  153. RRectangle(long lL, long lR, long lT, long lB)
  154. {lLeft=lL; lRight=lR; lTop=lT; lBottom=lB;};
  155. // Destructor
  156. ~RRectangle() {};
  157. };
  158. class RCube
  159. {
  160. public:
  161. long lLeft; // Left side
  162. long lRight; // Right side
  163. long lTop; // Top side
  164. long lBottom; // Bottom side
  165. long lFront; // Front side
  166. long lBack; // Back side
  167. // Constructors
  168. RCube()
  169. {lLeft=lRight=lTop=lBottom=lFront=lBack=0;};
  170. RCube(long lL, long lR, long lT, long lB, long lF, long lBk)
  171. {lLeft=lL; lRight=lR; lTop=lT; lBottom=lB; lFront=lF; lBack=lBk;};
  172. // Destructor
  173. ~RCube() {};
  174. };
  175. class RCircle
  176. {
  177. public:
  178. long X; // X coordinate of center point
  179. long Y; // Y coordinate of center point
  180. long lRadius; // Radius of the circle
  181. // Constructors
  182. RCircle()
  183. {X=Y=lRadius=0;};
  184. RCircle(long lX, long lY, long lR)
  185. {X=lX; Y=lY; lRadius=lR;};
  186. // Destructor
  187. ~RCircle() {};
  188. };
  189. class RSphere
  190. {
  191. public:
  192. long X; // X coordinate of center point
  193. long Y; // Y coordinate of center point
  194. long Z; // Z coordinate of center point
  195. long lRadius; // Radius of the sphere
  196. // Constructors
  197. RSphere()
  198. {X=Y=Z=lRadius=0;};
  199. RSphere(long lX, long lY, long lZ, long lR)
  200. {X=lX; Y=lY; Z=lZ; lRadius=lR;};
  201. };
  202. #endif //SHAPES_H
  203. //////////////////////////////////////////////////////////////////////////////
  204. // EOF
  205. //////////////////////////////////////////////////////////////////////////////