gim_box_set.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. #ifndef GIM_BOX_SET_H_INCLUDED
  2. #define GIM_BOX_SET_H_INCLUDED
  3. /*! \file gim_box_set.h
  4. \author Francisco Leon Najera
  5. */
  6. /*
  7. -----------------------------------------------------------------------------
  8. This source file is part of GIMPACT Library.
  9. For the latest info, see http://gimpact.sourceforge.net/
  10. Copyright (c) 2006 Francisco Leon Najera. C.C. 80087371.
  11. email: [email protected]
  12. This library is free software; you can redistribute it and/or
  13. modify it under the terms of EITHER:
  14. (1) The GNU Lesser General Public License as published by the Free
  15. Software Foundation; either version 2.1 of the License, or (at
  16. your option) any later version. The text of the GNU Lesser
  17. General Public License is included with this library in the
  18. file GIMPACT-LICENSE-LGPL.TXT.
  19. (2) The BSD-style license that is included with this library in
  20. the file GIMPACT-LICENSE-BSD.TXT.
  21. (3) The zlib/libpng license that is included with this library in
  22. the file GIMPACT-LICENSE-ZLIB.TXT.
  23. This library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
  26. GIMPACT-LICENSE-LGPL.TXT, GIMPACT-LICENSE-ZLIB.TXT and GIMPACT-LICENSE-BSD.TXT for more details.
  27. -----------------------------------------------------------------------------
  28. */
  29. #include "gim_array.h"
  30. #include "gim_radixsort.h"
  31. #include "gim_box_collision.h"
  32. #include "gim_tri_collision.h"
  33. //! Overlapping pair
  34. struct GIM_PAIR
  35. {
  36. GUINT m_index1;
  37. GUINT m_index2;
  38. GIM_PAIR()
  39. {
  40. }
  41. GIM_PAIR(const GIM_PAIR& p)
  42. {
  43. m_index1 = p.m_index1;
  44. m_index2 = p.m_index2;
  45. }
  46. GIM_PAIR(GUINT index1, GUINT index2)
  47. {
  48. m_index1 = index1;
  49. m_index2 = index2;
  50. }
  51. };
  52. //! A pairset array
  53. class gim_pair_set : public gim_array<GIM_PAIR>
  54. {
  55. public:
  56. gim_pair_set() : gim_array<GIM_PAIR>(32)
  57. {
  58. }
  59. inline void push_pair(GUINT index1, GUINT index2)
  60. {
  61. push_back(GIM_PAIR(index1, index2));
  62. }
  63. inline void push_pair_inv(GUINT index1, GUINT index2)
  64. {
  65. push_back(GIM_PAIR(index2, index1));
  66. }
  67. };
  68. //! Prototype Base class for primitive classification
  69. /*!
  70. This class is a wrapper for primitive collections.
  71. This tells relevant info for the Bounding Box set classes, which take care of space classification.
  72. This class can manage Compound shapes and trimeshes, and if it is managing trimesh then the Hierarchy Bounding Box classes will take advantage of primitive Vs Box overlapping tests for getting optimal results and less Per Box compairisons.
  73. */
  74. class GIM_PRIMITIVE_MANAGER_PROTOTYPE
  75. {
  76. public:
  77. virtual ~GIM_PRIMITIVE_MANAGER_PROTOTYPE() {}
  78. //! determines if this manager consist on only triangles, which special case will be optimized
  79. virtual bool is_trimesh() = 0;
  80. virtual GUINT get_primitive_count() = 0;
  81. virtual void get_primitive_box(GUINT prim_index, GIM_AABB& primbox) = 0;
  82. virtual void get_primitive_triangle(GUINT prim_index, GIM_TRIANGLE& triangle) = 0;
  83. };
  84. struct GIM_AABB_DATA
  85. {
  86. GIM_AABB m_bound;
  87. GUINT m_data;
  88. };
  89. //! Node Structure for trees
  90. struct GIM_BOX_TREE_NODE
  91. {
  92. GIM_AABB m_bound;
  93. GUINT m_left; //!< Left subtree
  94. GUINT m_right; //!< Right subtree
  95. GUINT m_escapeIndex; //!< Scape index for traversing
  96. GUINT m_data; //!< primitive index if apply
  97. GIM_BOX_TREE_NODE()
  98. {
  99. m_left = 0;
  100. m_right = 0;
  101. m_escapeIndex = 0;
  102. m_data = 0;
  103. }
  104. SIMD_FORCE_INLINE bool is_leaf_node() const
  105. {
  106. return (!m_left && !m_right);
  107. }
  108. };
  109. //! Basic Box tree structure
  110. class GIM_BOX_TREE
  111. {
  112. protected:
  113. GUINT m_num_nodes;
  114. gim_array<GIM_BOX_TREE_NODE> m_node_array;
  115. protected:
  116. GUINT _sort_and_calc_splitting_index(
  117. gim_array<GIM_AABB_DATA>& primitive_boxes,
  118. GUINT startIndex, GUINT endIndex, GUINT splitAxis);
  119. GUINT _calc_splitting_axis(gim_array<GIM_AABB_DATA>& primitive_boxes, GUINT startIndex, GUINT endIndex);
  120. void _build_sub_tree(gim_array<GIM_AABB_DATA>& primitive_boxes, GUINT startIndex, GUINT endIndex);
  121. public:
  122. GIM_BOX_TREE()
  123. {
  124. m_num_nodes = 0;
  125. }
  126. //! prototype functions for box tree management
  127. //!@{
  128. void build_tree(gim_array<GIM_AABB_DATA>& primitive_boxes);
  129. SIMD_FORCE_INLINE void clearNodes()
  130. {
  131. m_node_array.clear();
  132. m_num_nodes = 0;
  133. }
  134. //! node count
  135. SIMD_FORCE_INLINE GUINT getNodeCount() const
  136. {
  137. return m_num_nodes;
  138. }
  139. //! tells if the node is a leaf
  140. SIMD_FORCE_INLINE bool isLeafNode(GUINT nodeindex) const
  141. {
  142. return m_node_array[nodeindex].is_leaf_node();
  143. }
  144. SIMD_FORCE_INLINE GUINT getNodeData(GUINT nodeindex) const
  145. {
  146. return m_node_array[nodeindex].m_data;
  147. }
  148. SIMD_FORCE_INLINE void getNodeBound(GUINT nodeindex, GIM_AABB& bound) const
  149. {
  150. bound = m_node_array[nodeindex].m_bound;
  151. }
  152. SIMD_FORCE_INLINE void setNodeBound(GUINT nodeindex, const GIM_AABB& bound)
  153. {
  154. m_node_array[nodeindex].m_bound = bound;
  155. }
  156. SIMD_FORCE_INLINE GUINT getLeftNodeIndex(GUINT nodeindex) const
  157. {
  158. return m_node_array[nodeindex].m_left;
  159. }
  160. SIMD_FORCE_INLINE GUINT getRightNodeIndex(GUINT nodeindex) const
  161. {
  162. return m_node_array[nodeindex].m_right;
  163. }
  164. SIMD_FORCE_INLINE GUINT getScapeNodeIndex(GUINT nodeindex) const
  165. {
  166. return m_node_array[nodeindex].m_escapeIndex;
  167. }
  168. //!@}
  169. };
  170. //! Generic Box Tree Template
  171. /*!
  172. This class offers an structure for managing a box tree of primitives.
  173. Requires a Primitive prototype (like GIM_PRIMITIVE_MANAGER_PROTOTYPE ) and
  174. a Box tree structure ( like GIM_BOX_TREE).
  175. */
  176. template <typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE, typename _GIM_BOX_TREE_PROTOTYPE>
  177. class GIM_BOX_TREE_TEMPLATE_SET
  178. {
  179. protected:
  180. _GIM_PRIMITIVE_MANAGER_PROTOTYPE m_primitive_manager;
  181. _GIM_BOX_TREE_PROTOTYPE m_box_tree;
  182. protected:
  183. //stackless refit
  184. SIMD_FORCE_INLINE void refit()
  185. {
  186. GUINT nodecount = getNodeCount();
  187. while (nodecount--)
  188. {
  189. if (isLeafNode(nodecount))
  190. {
  191. GIM_AABB leafbox;
  192. m_primitive_manager.get_primitive_box(getNodeData(nodecount), leafbox);
  193. setNodeBound(nodecount, leafbox);
  194. }
  195. else
  196. {
  197. //get left bound
  198. GUINT childindex = getLeftNodeIndex(nodecount);
  199. GIM_AABB bound;
  200. getNodeBound(childindex, bound);
  201. //get right bound
  202. childindex = getRightNodeIndex(nodecount);
  203. GIM_AABB bound2;
  204. getNodeBound(childindex, bound2);
  205. bound.merge(bound2);
  206. setNodeBound(nodecount, bound);
  207. }
  208. }
  209. }
  210. public:
  211. GIM_BOX_TREE_TEMPLATE_SET()
  212. {
  213. }
  214. SIMD_FORCE_INLINE GIM_AABB getGlobalBox() const
  215. {
  216. GIM_AABB totalbox;
  217. getNodeBound(0, totalbox);
  218. return totalbox;
  219. }
  220. SIMD_FORCE_INLINE void setPrimitiveManager(const _GIM_PRIMITIVE_MANAGER_PROTOTYPE& primitive_manager)
  221. {
  222. m_primitive_manager = primitive_manager;
  223. }
  224. const _GIM_PRIMITIVE_MANAGER_PROTOTYPE& getPrimitiveManager() const
  225. {
  226. return m_primitive_manager;
  227. }
  228. _GIM_PRIMITIVE_MANAGER_PROTOTYPE& getPrimitiveManager()
  229. {
  230. return m_primitive_manager;
  231. }
  232. //! node manager prototype functions
  233. ///@{
  234. //! this attemps to refit the box set.
  235. SIMD_FORCE_INLINE void update()
  236. {
  237. refit();
  238. }
  239. //! this rebuild the entire set
  240. SIMD_FORCE_INLINE void buildSet()
  241. {
  242. //obtain primitive boxes
  243. gim_array<GIM_AABB_DATA> primitive_boxes;
  244. primitive_boxes.resize(m_primitive_manager.get_primitive_count(), false);
  245. for (GUINT i = 0; i < primitive_boxes.size(); i++)
  246. {
  247. m_primitive_manager.get_primitive_box(i, primitive_boxes[i].m_bound);
  248. primitive_boxes[i].m_data = i;
  249. }
  250. m_box_tree.build_tree(primitive_boxes);
  251. }
  252. //! returns the indices of the primitives in the m_primitive_manager
  253. SIMD_FORCE_INLINE bool boxQuery(const GIM_AABB& box, gim_array<GUINT>& collided_results) const
  254. {
  255. GUINT curIndex = 0;
  256. GUINT numNodes = getNodeCount();
  257. while (curIndex < numNodes)
  258. {
  259. GIM_AABB bound;
  260. getNodeBound(curIndex, bound);
  261. //catch bugs in tree data
  262. bool aabbOverlap = bound.has_collision(box);
  263. bool isleafnode = isLeafNode(curIndex);
  264. if (isleafnode && aabbOverlap)
  265. {
  266. collided_results.push_back(getNodeData(curIndex));
  267. }
  268. if (aabbOverlap || isleafnode)
  269. {
  270. //next subnode
  271. curIndex++;
  272. }
  273. else
  274. {
  275. //skip node
  276. curIndex += getScapeNodeIndex(curIndex);
  277. }
  278. }
  279. if (collided_results.size() > 0) return true;
  280. return false;
  281. }
  282. //! returns the indices of the primitives in the m_primitive_manager
  283. SIMD_FORCE_INLINE bool boxQueryTrans(const GIM_AABB& box,
  284. const btTransform& transform, gim_array<GUINT>& collided_results) const
  285. {
  286. GIM_AABB transbox = box;
  287. transbox.appy_transform(transform);
  288. return boxQuery(transbox, collided_results);
  289. }
  290. //! returns the indices of the primitives in the m_primitive_manager
  291. SIMD_FORCE_INLINE bool rayQuery(
  292. const btVector3& ray_dir, const btVector3& ray_origin,
  293. gim_array<GUINT>& collided_results) const
  294. {
  295. GUINT curIndex = 0;
  296. GUINT numNodes = getNodeCount();
  297. while (curIndex < numNodes)
  298. {
  299. GIM_AABB bound;
  300. getNodeBound(curIndex, bound);
  301. //catch bugs in tree data
  302. bool aabbOverlap = bound.collide_ray(ray_origin, ray_dir);
  303. bool isleafnode = isLeafNode(curIndex);
  304. if (isleafnode && aabbOverlap)
  305. {
  306. collided_results.push_back(getNodeData(curIndex));
  307. }
  308. if (aabbOverlap || isleafnode)
  309. {
  310. //next subnode
  311. curIndex++;
  312. }
  313. else
  314. {
  315. //skip node
  316. curIndex += getScapeNodeIndex(curIndex);
  317. }
  318. }
  319. if (collided_results.size() > 0) return true;
  320. return false;
  321. }
  322. //! tells if this set has hierarcht
  323. SIMD_FORCE_INLINE bool hasHierarchy() const
  324. {
  325. return true;
  326. }
  327. //! tells if this set is a trimesh
  328. SIMD_FORCE_INLINE bool isTrimesh() const
  329. {
  330. return m_primitive_manager.is_trimesh();
  331. }
  332. //! node count
  333. SIMD_FORCE_INLINE GUINT getNodeCount() const
  334. {
  335. return m_box_tree.getNodeCount();
  336. }
  337. //! tells if the node is a leaf
  338. SIMD_FORCE_INLINE bool isLeafNode(GUINT nodeindex) const
  339. {
  340. return m_box_tree.isLeafNode(nodeindex);
  341. }
  342. SIMD_FORCE_INLINE GUINT getNodeData(GUINT nodeindex) const
  343. {
  344. return m_box_tree.getNodeData(nodeindex);
  345. }
  346. SIMD_FORCE_INLINE void getNodeBound(GUINT nodeindex, GIM_AABB& bound) const
  347. {
  348. m_box_tree.getNodeBound(nodeindex, bound);
  349. }
  350. SIMD_FORCE_INLINE void setNodeBound(GUINT nodeindex, const GIM_AABB& bound)
  351. {
  352. m_box_tree.setNodeBound(nodeindex, bound);
  353. }
  354. SIMD_FORCE_INLINE GUINT getLeftNodeIndex(GUINT nodeindex) const
  355. {
  356. return m_box_tree.getLeftNodeIndex(nodeindex);
  357. }
  358. SIMD_FORCE_INLINE GUINT getRightNodeIndex(GUINT nodeindex) const
  359. {
  360. return m_box_tree.getRightNodeIndex(nodeindex);
  361. }
  362. SIMD_FORCE_INLINE GUINT getScapeNodeIndex(GUINT nodeindex) const
  363. {
  364. return m_box_tree.getScapeNodeIndex(nodeindex);
  365. }
  366. SIMD_FORCE_INLINE void getNodeTriangle(GUINT nodeindex, GIM_TRIANGLE& triangle) const
  367. {
  368. m_primitive_manager.get_primitive_triangle(getNodeData(nodeindex), triangle);
  369. }
  370. };
  371. //! Class for Box Tree Sets
  372. /*!
  373. this has the GIM_BOX_TREE implementation for bounding boxes.
  374. */
  375. template <typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE>
  376. class GIM_BOX_TREE_SET : public GIM_BOX_TREE_TEMPLATE_SET<_GIM_PRIMITIVE_MANAGER_PROTOTYPE, GIM_BOX_TREE>
  377. {
  378. public:
  379. };
  380. /// GIM_BOX_SET collision methods
  381. template <typename BOX_SET_CLASS0, typename BOX_SET_CLASS1>
  382. class GIM_TREE_TREE_COLLIDER
  383. {
  384. public:
  385. gim_pair_set* m_collision_pairs;
  386. BOX_SET_CLASS0* m_boxset0;
  387. BOX_SET_CLASS1* m_boxset1;
  388. GUINT current_node0;
  389. GUINT current_node1;
  390. bool node0_is_leaf;
  391. bool node1_is_leaf;
  392. bool t0_is_trimesh;
  393. bool t1_is_trimesh;
  394. bool node0_has_triangle;
  395. bool node1_has_triangle;
  396. GIM_AABB m_box0;
  397. GIM_AABB m_box1;
  398. GIM_BOX_BOX_TRANSFORM_CACHE trans_cache_1to0;
  399. btTransform trans_cache_0to1;
  400. GIM_TRIANGLE m_tri0;
  401. btVector4 m_tri0_plane;
  402. GIM_TRIANGLE m_tri1;
  403. btVector4 m_tri1_plane;
  404. public:
  405. GIM_TREE_TREE_COLLIDER()
  406. {
  407. current_node0 = G_UINT_INFINITY;
  408. current_node1 = G_UINT_INFINITY;
  409. }
  410. protected:
  411. SIMD_FORCE_INLINE void retrieve_node0_triangle(GUINT node0)
  412. {
  413. if (node0_has_triangle) return;
  414. m_boxset0->getNodeTriangle(node0, m_tri0);
  415. //transform triangle
  416. m_tri0.m_vertices[0] = trans_cache_0to1(m_tri0.m_vertices[0]);
  417. m_tri0.m_vertices[1] = trans_cache_0to1(m_tri0.m_vertices[1]);
  418. m_tri0.m_vertices[2] = trans_cache_0to1(m_tri0.m_vertices[2]);
  419. m_tri0.get_plane(m_tri0_plane);
  420. node0_has_triangle = true;
  421. }
  422. SIMD_FORCE_INLINE void retrieve_node1_triangle(GUINT node1)
  423. {
  424. if (node1_has_triangle) return;
  425. m_boxset1->getNodeTriangle(node1, m_tri1);
  426. //transform triangle
  427. m_tri1.m_vertices[0] = trans_cache_1to0.transform(m_tri1.m_vertices[0]);
  428. m_tri1.m_vertices[1] = trans_cache_1to0.transform(m_tri1.m_vertices[1]);
  429. m_tri1.m_vertices[2] = trans_cache_1to0.transform(m_tri1.m_vertices[2]);
  430. m_tri1.get_plane(m_tri1_plane);
  431. node1_has_triangle = true;
  432. }
  433. SIMD_FORCE_INLINE void retrieve_node0_info(GUINT node0)
  434. {
  435. if (node0 == current_node0) return;
  436. m_boxset0->getNodeBound(node0, m_box0);
  437. node0_is_leaf = m_boxset0->isLeafNode(node0);
  438. node0_has_triangle = false;
  439. current_node0 = node0;
  440. }
  441. SIMD_FORCE_INLINE void retrieve_node1_info(GUINT node1)
  442. {
  443. if (node1 == current_node1) return;
  444. m_boxset1->getNodeBound(node1, m_box1);
  445. node1_is_leaf = m_boxset1->isLeafNode(node1);
  446. node1_has_triangle = false;
  447. current_node1 = node1;
  448. }
  449. SIMD_FORCE_INLINE bool node_collision(GUINT node0, GUINT node1)
  450. {
  451. retrieve_node0_info(node0);
  452. retrieve_node1_info(node1);
  453. bool result = m_box0.overlapping_trans_cache(m_box1, trans_cache_1to0, true);
  454. if (!result) return false;
  455. if (t0_is_trimesh && node0_is_leaf)
  456. {
  457. //perform primitive vs box collision
  458. retrieve_node0_triangle(node0);
  459. //do triangle vs box collision
  460. m_box1.increment_margin(m_tri0.m_margin);
  461. result = m_box1.collide_triangle_exact(
  462. m_tri0.m_vertices[0], m_tri0.m_vertices[1], m_tri0.m_vertices[2], m_tri0_plane);
  463. m_box1.increment_margin(-m_tri0.m_margin);
  464. if (!result) return false;
  465. return true;
  466. }
  467. else if (t1_is_trimesh && node1_is_leaf)
  468. {
  469. //perform primitive vs box collision
  470. retrieve_node1_triangle(node1);
  471. //do triangle vs box collision
  472. m_box0.increment_margin(m_tri1.m_margin);
  473. result = m_box0.collide_triangle_exact(
  474. m_tri1.m_vertices[0], m_tri1.m_vertices[1], m_tri1.m_vertices[2], m_tri1_plane);
  475. m_box0.increment_margin(-m_tri1.m_margin);
  476. if (!result) return false;
  477. return true;
  478. }
  479. return true;
  480. }
  481. //stackless collision routine
  482. void find_collision_pairs()
  483. {
  484. gim_pair_set stack_collisions;
  485. stack_collisions.reserve(32);
  486. //add the first pair
  487. stack_collisions.push_pair(0, 0);
  488. while (stack_collisions.size())
  489. {
  490. //retrieve the last pair and pop
  491. GUINT node0 = stack_collisions.back().m_index1;
  492. GUINT node1 = stack_collisions.back().m_index2;
  493. stack_collisions.pop_back();
  494. if (node_collision(node0, node1)) // a collision is found
  495. {
  496. if (node0_is_leaf)
  497. {
  498. if (node1_is_leaf)
  499. {
  500. m_collision_pairs->push_pair(m_boxset0->getNodeData(node0), m_boxset1->getNodeData(node1));
  501. }
  502. else
  503. {
  504. //collide left
  505. stack_collisions.push_pair(node0, m_boxset1->getLeftNodeIndex(node1));
  506. //collide right
  507. stack_collisions.push_pair(node0, m_boxset1->getRightNodeIndex(node1));
  508. }
  509. }
  510. else
  511. {
  512. if (node1_is_leaf)
  513. {
  514. //collide left
  515. stack_collisions.push_pair(m_boxset0->getLeftNodeIndex(node0), node1);
  516. //collide right
  517. stack_collisions.push_pair(m_boxset0->getRightNodeIndex(node0), node1);
  518. }
  519. else
  520. {
  521. GUINT left0 = m_boxset0->getLeftNodeIndex(node0);
  522. GUINT right0 = m_boxset0->getRightNodeIndex(node0);
  523. GUINT left1 = m_boxset1->getLeftNodeIndex(node1);
  524. GUINT right1 = m_boxset1->getRightNodeIndex(node1);
  525. //collide left
  526. stack_collisions.push_pair(left0, left1);
  527. //collide right
  528. stack_collisions.push_pair(left0, right1);
  529. //collide left
  530. stack_collisions.push_pair(right0, left1);
  531. //collide right
  532. stack_collisions.push_pair(right0, right1);
  533. } // else if node1 is not a leaf
  534. } // else if node0 is not a leaf
  535. } // if(node_collision(node0,node1))
  536. } //while(stack_collisions.size())
  537. }
  538. public:
  539. void find_collision(BOX_SET_CLASS0* boxset1, const btTransform& trans1,
  540. BOX_SET_CLASS1* boxset2, const btTransform& trans2,
  541. gim_pair_set& collision_pairs, bool complete_primitive_tests = true)
  542. {
  543. m_collision_pairs = &collision_pairs;
  544. m_boxset0 = boxset1;
  545. m_boxset1 = boxset2;
  546. trans_cache_1to0.calc_from_homogenic(trans1, trans2);
  547. trans_cache_0to1 = trans2.inverse();
  548. trans_cache_0to1 *= trans1;
  549. if (complete_primitive_tests)
  550. {
  551. t0_is_trimesh = boxset1->getPrimitiveManager().is_trimesh();
  552. t1_is_trimesh = boxset2->getPrimitiveManager().is_trimesh();
  553. }
  554. else
  555. {
  556. t0_is_trimesh = false;
  557. t1_is_trimesh = false;
  558. }
  559. find_collision_pairs();
  560. }
  561. };
  562. #endif // GIM_BOXPRUNING_H_INCLUDED