aabox.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*
  2. ** Command & Conquer Renegade(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. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WWMath *
  23. * *
  24. * $Archive:: /Commando/Code/wwmath/aabox.h $*
  25. * *
  26. * Author:: Greg_h *
  27. * *
  28. * $Modtime:: 5/08/01 6:35p $*
  29. * *
  30. * $Revision:: 30 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * AABoxClass::Transform -- transform an aabox *
  35. * AABoxClass::Translate -- transform an aabox *
  36. * AABoxClass::Init -- create a box which bounds the given points *
  37. * AABoxClass::Init -- initialize from a min-max form of a box *
  38. * AABoxClass::Init_Min_Max -- init the box from a min and max vector *
  39. * AABoxClass::Add_Point -- expand the box to contain the given point *
  40. * AABoxClass::Project_To_Axis -- compute projection onto the given axis *
  41. * AABoxClass::Intersects -- test for intersection with another static aabox *
  42. * AABoxClass::Add_Box -- expand this box to enclose the passed box *
  43. * AABoxClass::Add_Box -- Expand this box to enclose the passed box *
  44. * MinMaxAABoxClass::Init -- init the box from an array of points *
  45. * MinMaxAABoxClass::Init -- initializes this box from a center-extent box *
  46. * MinMaxAABoxClass::Add_Point -- updates this box so it encloses the given point *
  47. * MinMaxAABoxClass::Add_Box -- update this box to enclose the given box *
  48. * MinMaxAABoxClass::Add_Box -- Updates this box to enclose the specified box *
  49. * MinMaxAABoxClass::Transform -- Updates this box to enclose its transformed version *
  50. * MinMaxAABoxClass::Translate -- translates the box *
  51. * AABoxClass::Init -- Init from a line segment *
  52. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  53. #if defined(_MSC_VER)
  54. #pragma once
  55. #endif
  56. #ifndef AABOX_H
  57. #define AABOX_H
  58. #include "always.h"
  59. #include "matrix3d.h"
  60. #include "lineseg.h"
  61. #include "colmath.h"
  62. class AABoxClass;
  63. class MinMaxAABoxClass;
  64. class OBBoxClass;
  65. class TriClass;
  66. class PlaneClass;
  67. struct CastResultStruct;
  68. /*
  69. ** AABoxClass
  70. **
  71. ** Axis-Aligned Boxes. I've coded these similar to the OrientedBoxClass only
  72. ** without a rotation matrix. A similar algorithm is used to test the box
  73. ** for intersection.
  74. */
  75. class AABoxClass
  76. {
  77. public:
  78. WWINLINE AABoxClass(void) { }
  79. WWINLINE AABoxClass(const Vector3 & center,const Vector3 & extent) :
  80. Center(center),
  81. Extent(extent)
  82. { }
  83. AABoxClass(const MinMaxAABoxClass & minmaxbox) { Init(minmaxbox); }
  84. AABoxClass(Vector3 * points,int num) { Init(points,num); }
  85. bool operator== (const AABoxClass &src);
  86. bool operator!= (const AABoxClass &src);
  87. WWINLINE void Init(const Vector3& center,const Vector3 & extent) { Center = center; Extent = extent; }
  88. WWINLINE void Init(Vector3 * points,int num);
  89. WWINLINE void Init(const MinMaxAABoxClass & minmaxbox);
  90. void Init(const LineSegClass & line);
  91. void Init_Min_Max(const Vector3 & min,const Vector3 & max);
  92. void Init_Random(float min_center = -1.0f,float max_center = 1.0f,float min_extent = 0.5f,float max_extent = 1.0f);
  93. void Add_Point(const Vector3 & point);
  94. void Add_Box(const AABoxClass & b);
  95. void Add_Box(const MinMaxAABoxClass & b);
  96. float Project_To_Axis(const Vector3 & axis) const;
  97. void Transform(const Matrix3D & tm);
  98. void Translate(const Vector3 & pos);
  99. WWINLINE float Volume(void) const { return 2.0*Extent.X * 2.0*Extent.Y * 2.0*Extent.Z; }
  100. WWINLINE bool Contains(const Vector3 & point) const;
  101. WWINLINE bool Contains(const AABoxClass & other_box) const;
  102. WWINLINE bool Contains(const MinMaxAABoxClass & other_box) const;
  103. static void Transform(const Matrix3D & tm,const AABoxClass & in,AABoxClass * out);
  104. Vector3 Center; // world space center
  105. Vector3 Extent; // size of the box in the three directions
  106. };
  107. /*
  108. ** MinMaxAABoxClass
  109. ** This is another form of an AABox. It can be faster to build one of these
  110. ** and then convert it into a center-extent AABox in some cases. Its purpose
  111. ** is basically that.
  112. */
  113. class MinMaxAABoxClass
  114. {
  115. public:
  116. WWINLINE MinMaxAABoxClass(void) { }
  117. WWINLINE MinMaxAABoxClass(const Vector3 & min_corner,const Vector3 & max_corner) :
  118. MinCorner(min_corner),
  119. MaxCorner(max_corner)
  120. {
  121. }
  122. WWINLINE MinMaxAABoxClass(Vector3 * points,int num) { Init(points,num); }
  123. WWINLINE MinMaxAABoxClass(const AABoxClass & that) { Init(that); }
  124. WWINLINE void Init(Vector3 * points,int num);
  125. WWINLINE void Init(const AABoxClass & box);
  126. void Init_Empty(void);
  127. void Add_Point(const Vector3 & point);
  128. void Add_Box(const MinMaxAABoxClass & box);
  129. void Add_Box(const AABoxClass & box);
  130. void Add_Box(const Vector3 & min_corner,const Vector3 & max_corner);
  131. void Transform(const Matrix3D & tm);
  132. void Translate(const Vector3 & pos);
  133. WWINLINE float Volume(void) const { Vector3 size = MaxCorner - MinCorner; return size.X*size.Y*size.Z; }
  134. Vector3 MinCorner;
  135. Vector3 MaxCorner;
  136. };
  137. /***********************************************************************************************
  138. * AABoxClass::Transform -- transform an aabox *
  139. * *
  140. * Note that this function expands the box to enclose its transformed form. *
  141. * *
  142. * INPUT: *
  143. * *
  144. * OUTPUT: *
  145. * *
  146. * WARNINGS: *
  147. * *
  148. * HISTORY: *
  149. * 2/24/98 GTH : Created. *
  150. *=============================================================================================*/
  151. WWINLINE void AABoxClass::Transform(const Matrix3D & tm)
  152. {
  153. Vector3 oldcenter = Center;
  154. Vector3 oldextent = Extent;
  155. tm.Transform_Center_Extent_AABox(oldcenter,oldextent,&Center,&Extent);
  156. }
  157. /***********************************************************************************************
  158. * AABoxClass::Translate -- translate an aabox *
  159. * *
  160. * INPUT: *
  161. * *
  162. * OUTPUT: *
  163. * *
  164. * WARNINGS: *
  165. * *
  166. * HISTORY: *
  167. * 2/24/98 GTH : Created. *
  168. *=============================================================================================*/
  169. WWINLINE void AABoxClass::Translate(const Vector3 & trans)
  170. {
  171. Center += trans;
  172. }
  173. /***********************************************************************************************
  174. * AABoxClass::operator== -- Comparison operator *
  175. * *
  176. * INPUT: *
  177. * *
  178. * OUTPUT: *
  179. * *
  180. * WARNINGS: *
  181. * *
  182. * HISTORY: *
  183. * 6/21/00 PDS : Created. *
  184. *=============================================================================================*/
  185. WWINLINE bool AABoxClass::operator== (const AABoxClass &src)
  186. {
  187. return (Center == src.Center) && (Extent == src.Extent);
  188. }
  189. /***********************************************************************************************
  190. * AABoxClass::operator!= -- Comparison operator *
  191. * *
  192. * INPUT: *
  193. * *
  194. * OUTPUT: *
  195. * *
  196. * WARNINGS: *
  197. * *
  198. * HISTORY: *
  199. * 6/21/00 PDS : Created. *
  200. *=============================================================================================*/
  201. WWINLINE bool AABoxClass::operator!= (const AABoxClass &src)
  202. {
  203. return (Center != src.Center) || (Extent != src.Extent);
  204. }
  205. /***********************************************************************************************
  206. * AABoxClass::Init -- create a box which bounds the given points *
  207. * *
  208. * INPUT: *
  209. * *
  210. * OUTPUT: *
  211. * *
  212. * WARNINGS: *
  213. * *
  214. * HISTORY: *
  215. * 2/24/98 GTH : Created. *
  216. *=============================================================================================*/
  217. WWINLINE void AABoxClass::Init(Vector3 * points,int num)
  218. {
  219. Vector3 Min = points[0];
  220. Vector3 Max = points[0];
  221. for (int i=1; i<num; i++) {
  222. if (Min.X > points[i].X) Min.X = points[i].X;
  223. if (Min.Y > points[i].Y) Min.Y = points[i].Y;
  224. if (Min.Z > points[i].Z) Min.Z = points[i].Z;
  225. if (Max.X < points[i].X) Max.X = points[i].X;
  226. if (Max.Y < points[i].Y) Max.Y = points[i].Y;
  227. if (Max.Z < points[i].Z) Max.Z = points[i].Z;
  228. }
  229. Center = (Max + Min) * 0.5f;
  230. Extent = (Max - Min) * 0.5f;
  231. }
  232. /***********************************************************************************************
  233. * AABoxClass::Init -- initialize from a min-max form of a box *
  234. * *
  235. * INPUT: *
  236. * *
  237. * OUTPUT: *
  238. * *
  239. * WARNINGS: *
  240. * *
  241. * HISTORY: *
  242. * 7/31/98 GTH : Created. *
  243. *=============================================================================================*/
  244. WWINLINE void AABoxClass::Init(const MinMaxAABoxClass & mmbox)
  245. {
  246. Center = (mmbox.MaxCorner + mmbox.MinCorner) * 0.5f;
  247. Extent = (mmbox.MaxCorner - mmbox.MinCorner) * 0.5f;
  248. }
  249. /***********************************************************************************************
  250. * AABoxClass::Init -- Init from a line segment *
  251. * *
  252. * INPUT: *
  253. * *
  254. * OUTPUT: *
  255. * *
  256. * WARNINGS: *
  257. * *
  258. * HISTORY: *
  259. * 4/27/2000 gth : Created. *
  260. *=============================================================================================*/
  261. WWINLINE void AABoxClass::Init(const LineSegClass & line)
  262. {
  263. Vector3 min_corner = line.Get_P0();
  264. Vector3 max_corner = line.Get_P0();
  265. if (min_corner.X > line.Get_P1().X) min_corner.X = line.Get_P1().X;
  266. if (min_corner.Y > line.Get_P1().Y) min_corner.Y = line.Get_P1().Y;
  267. if (min_corner.Z > line.Get_P1().Z) min_corner.Z = line.Get_P1().Z;
  268. if (max_corner.X < line.Get_P1().X) max_corner.X = line.Get_P1().X;
  269. if (max_corner.Y < line.Get_P1().Y) max_corner.Y = line.Get_P1().Y;
  270. if (max_corner.Z < line.Get_P1().Z) max_corner.Z = line.Get_P1().Z;
  271. Center = (max_corner + min_corner) * 0.5f;
  272. Extent = (max_corner - min_corner) * 0.5f;
  273. }
  274. /***********************************************************************************************
  275. * AABoxClass::Init_Min_Max -- init the box from a min and max vector *
  276. * *
  277. * INPUT: *
  278. * *
  279. * OUTPUT: *
  280. * *
  281. * WARNINGS: *
  282. * *
  283. * HISTORY: *
  284. * 4/9/99 GTH : Created. *
  285. *=============================================================================================*/
  286. WWINLINE void AABoxClass::Init_Min_Max(const Vector3 & min,const Vector3 & max)
  287. {
  288. Center = (max + min) * 0.5f;
  289. Extent = (max - min) * 0.5f;
  290. }
  291. /***********************************************************************************************
  292. * AABoxClass::Add_Point -- expand the box to contain the given point *
  293. * *
  294. * INPUT: *
  295. * *
  296. * OUTPUT: *
  297. * *
  298. * WARNINGS: *
  299. * *
  300. * HISTORY: *
  301. * 2/24/98 GTH : Created. *
  302. *=============================================================================================*/
  303. WWINLINE void AABoxClass::Add_Point(const Vector3 & point)
  304. {
  305. Vector3 Min = Center - Extent;
  306. Vector3 Max = Center + Extent;
  307. if (Min.X > point.X) Min.X = point.X;
  308. if (Min.Y > point.Y) Min.Y = point.Y;
  309. if (Min.Z > point.Z) Min.Z = point.Z;
  310. if (Max.X < point.X) Max.X = point.X;
  311. if (Max.Y < point.Y) Max.Y = point.Y;
  312. if (Max.Z < point.Z) Max.Z = point.Z;
  313. Center = (Max + Min) / 2.0f;
  314. Extent = (Max - Min) / 2.0f;
  315. }
  316. /***********************************************************************************************
  317. * AABoxClass::Add_Box -- expand this box to enclose the passed box *
  318. * *
  319. * INPUT: *
  320. * *
  321. * OUTPUT: *
  322. * *
  323. * WARNINGS: *
  324. * *
  325. * HISTORY: *
  326. * 7/31/98 GTH : Created. *
  327. * 9/29/2000 gth : Ok to add boxes with zero extent *
  328. *=============================================================================================*/
  329. WWINLINE void AABoxClass::Add_Box(const AABoxClass & b)
  330. {
  331. Vector3 newmin = Center - Extent;
  332. Vector3 newmax = Center + Extent;
  333. newmin.Update_Min(b.Center - b.Extent);
  334. newmax.Update_Max(b.Center + b.Extent);
  335. Center = (newmax + newmin) * 0.5f;
  336. Extent = (newmax - newmin) * 0.5f;
  337. }
  338. /***********************************************************************************************
  339. * AABoxClass::Add_Box -- Expand this box to enclose the passed box *
  340. * *
  341. * INPUT: *
  342. * *
  343. * OUTPUT: *
  344. * *
  345. * WARNINGS: *
  346. * *
  347. * HISTORY: *
  348. * 7/31/98 GTH : Created. *
  349. * 9/29/2000 gth : Ok to add boxes with zero extent *
  350. *=============================================================================================*/
  351. WWINLINE void AABoxClass::Add_Box(const MinMaxAABoxClass & b)
  352. {
  353. Vector3 newmin = Center - Extent;
  354. Vector3 newmax = Center + Extent;
  355. newmin.Update_Min(b.MinCorner);
  356. newmax.Update_Max(b.MaxCorner);
  357. Center = (newmax + newmin) * 0.5f;
  358. Extent = (newmax - newmin) * 0.5f;
  359. }
  360. /***********************************************************************************************
  361. * AABoxClass::Project_To_Axis -- compute projection onto the given axis *
  362. * *
  363. * INPUT: *
  364. * *
  365. * OUTPUT: *
  366. * *
  367. * WARNINGS: *
  368. * *
  369. * HISTORY: *
  370. * 2/24/98 GTH : Created. *
  371. *=============================================================================================*/
  372. WWINLINE float AABoxClass::Project_To_Axis(const Vector3 & axis) const
  373. {
  374. float x = Extent[0] * axis[0];
  375. float y = Extent[1] * axis[1];
  376. float z = Extent[2] * axis[2];
  377. // projection is the sum of the absolute values of the projections of the three extents
  378. return (WWMath::Fabs(x) + WWMath::Fabs(y) + WWMath::Fabs(z));
  379. }
  380. /***********************************************************************************************
  381. * AABoxClass::Contains -- Test whether this box contains the given box *
  382. * *
  383. * INPUT: *
  384. * *
  385. * OUTPUT: *
  386. * *
  387. * WARNINGS: *
  388. * *
  389. * HISTORY: *
  390. * 9/2/98 GTH : Created. *
  391. *=============================================================================================*/
  392. WWINLINE bool AABoxClass::Contains(const AABoxClass & other_box) const
  393. {
  394. return CollisionMath::Overlap_Test(*this,other_box) == CollisionMath::INSIDE;
  395. }
  396. /***********************************************************************************************
  397. * AABoxClass::Contains -- Test whether this box contains the given box *
  398. * *
  399. * INPUT: *
  400. * *
  401. * OUTPUT: *
  402. * *
  403. * WARNINGS: *
  404. * *
  405. * HISTORY: *
  406. * 9/2/98 GTH : Created. *
  407. *=============================================================================================*/
  408. WWINLINE bool AABoxClass::Contains(const MinMaxAABoxClass & other_box) const
  409. {
  410. Vector3 bmin = Center - Extent;
  411. Vector3 bmax = Center + Extent;
  412. if (other_box.MinCorner.X < bmin.X) return false;
  413. if (other_box.MinCorner.Y < bmin.Y) return false;
  414. if (other_box.MinCorner.Z < bmin.Z) return false;
  415. if (other_box.MaxCorner.X > bmax.X) return false;
  416. if (other_box.MaxCorner.Y > bmax.Y) return false;
  417. if (other_box.MaxCorner.Z > bmax.Z) return false;
  418. return true;
  419. }
  420. /***********************************************************************************************
  421. * AABoxClass::Contains -- test whether this box contains the given point *
  422. * *
  423. * INPUT: *
  424. * *
  425. * OUTPUT: *
  426. * *
  427. * WARNINGS: *
  428. * *
  429. * HISTORY: *
  430. * 9/2/98 GTH : Created. *
  431. *=============================================================================================*/
  432. WWINLINE bool AABoxClass::Contains(const Vector3 & point) const
  433. {
  434. return CollisionMath::Overlap_Test(*this,point) == CollisionMath::INSIDE;
  435. }
  436. /***********************************************************************************************
  437. * MinMaxAABoxClass::Init -- init the box from an array of points *
  438. * *
  439. * Makes a box which encloses the given array of points *
  440. * *
  441. * INPUT: *
  442. * *
  443. * OUTPUT: *
  444. * *
  445. * WARNINGS: *
  446. * *
  447. * HISTORY: *
  448. * 7/31/98 GTH : Created. *
  449. *=============================================================================================*/
  450. WWINLINE void MinMaxAABoxClass::Init(Vector3 * points,int num)
  451. {
  452. assert(num > 0);
  453. assert(points != NULL);
  454. MinCorner = points[0];
  455. MaxCorner = points[0];
  456. for (int i=0; i<num; i++) {
  457. MinCorner.Update_Min(points[i]);
  458. MaxCorner.Update_Max(points[i]);
  459. }
  460. }
  461. /***********************************************************************************************
  462. * MinMaxAABoxClass::Init -- initializes this box from a center-extent box *
  463. * *
  464. * INPUT: *
  465. * *
  466. * OUTPUT: *
  467. * *
  468. * WARNINGS: *
  469. * *
  470. * HISTORY: *
  471. * 7/31/98 GTH : Created. *
  472. *=============================================================================================*/
  473. WWINLINE void MinMaxAABoxClass::Init(const AABoxClass & box)
  474. {
  475. MinCorner = box.Center - box.Extent;
  476. MaxCorner = box.Center + box.Extent;
  477. }
  478. /***********************************************************************************************
  479. * MinMaxAABoxClass::Add_Point -- updates this box so it encloses the given point *
  480. * *
  481. * INPUT: *
  482. * *
  483. * OUTPUT: *
  484. * *
  485. * WARNINGS: *
  486. * *
  487. * HISTORY: *
  488. * 7/31/98 GTH : Created. *
  489. *=============================================================================================*/
  490. WWINLINE void MinMaxAABoxClass::Add_Point(const Vector3 & point)
  491. {
  492. MinCorner.Update_Min(point);
  493. MaxCorner.Update_Max(point);
  494. }
  495. /***********************************************************************************************
  496. * MinMaxAABoxClass::Add_Box -- update this box to enclose the given box *
  497. * *
  498. * INPUT: *
  499. * *
  500. * OUTPUT: *
  501. * *
  502. * WARNINGS: *
  503. * *
  504. * HISTORY: *
  505. * 7/31/98 GTH : Created. *
  506. *=============================================================================================*/
  507. WWINLINE void MinMaxAABoxClass::Add_Box(const MinMaxAABoxClass & box)
  508. {
  509. if (box.MinCorner == box.MaxCorner) return;
  510. MinCorner.Update_Min(box.MinCorner);
  511. MaxCorner.Update_Max(box.MaxCorner);
  512. }
  513. /***********************************************************************************************
  514. * MinMaxAABoxClass::Add_Box -- update this box to enclose the given box *
  515. * *
  516. * INPUT: *
  517. * *
  518. * OUTPUT: *
  519. * *
  520. * WARNINGS: *
  521. * *
  522. * HISTORY: *
  523. * 7/31/98 GTH : Created. *
  524. *=============================================================================================*/
  525. WWINLINE void MinMaxAABoxClass::Add_Box(const AABoxClass & box)
  526. {
  527. if (box.Extent == Vector3(0.0f, 0.0f, 0.0f)) return;
  528. MinCorner.Update_Min(box.Center - box.Extent);
  529. MaxCorner.Update_Max(box.Center + box.Extent);
  530. }
  531. /***********************************************************************************************
  532. * MinMaxAABoxClass::Add_Box -- Updates this box to enclose the specified box *
  533. * *
  534. * INPUT: *
  535. * *
  536. * OUTPUT: *
  537. * *
  538. * WARNINGS: *
  539. * *
  540. * HISTORY: *
  541. * 7/31/98 GTH : Created. *
  542. *=============================================================================================*/
  543. WWINLINE void MinMaxAABoxClass::Add_Box(const Vector3 & min_corner,const Vector3 & max_corner)
  544. {
  545. assert(max_corner.X >= min_corner.X);
  546. assert(max_corner.Y >= min_corner.Y);
  547. assert(max_corner.Z >= min_corner.Z);
  548. if (min_corner == max_corner) return;
  549. MinCorner.Update_Min(min_corner);
  550. MaxCorner.Update_Max(max_corner);
  551. }
  552. /***********************************************************************************************
  553. * MinMaxAABoxClass::Transform -- Updates this box to enclose its transformed version *
  554. * *
  555. * INPUT: *
  556. * *
  557. * OUTPUT: *
  558. * *
  559. * WARNINGS: *
  560. * *
  561. * HISTORY: *
  562. * 7/31/98 GTH : Created. *
  563. *=============================================================================================*/
  564. WWINLINE void MinMaxAABoxClass::Transform(const Matrix3D & tm)
  565. {
  566. Vector3 oldmin = MinCorner;
  567. Vector3 oldmax = MaxCorner;
  568. tm.Transform_Min_Max_AABox(oldmin,oldmax,&MinCorner,&MaxCorner);
  569. }
  570. /***********************************************************************************************
  571. * MinMaxAABoxClass::Translate -- translates the box *
  572. * *
  573. * INPUT: *
  574. * *
  575. * OUTPUT: *
  576. * *
  577. * WARNINGS: *
  578. * *
  579. * HISTORY: *
  580. * 7/31/98 GTH : Created. *
  581. *=============================================================================================*/
  582. WWINLINE void MinMaxAABoxClass::Translate(const Vector3 & pos)
  583. {
  584. MinCorner+=pos;
  585. MaxCorner+=pos;
  586. }
  587. #endif