btVoronoiSimplexSolver.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*
  2. Bullet Continuous Collision Detection and Physics Library
  3. Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
  4. This software is provided 'as-is', without any express or implied warranty.
  5. In no event will the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it freely,
  8. subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  10. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  11. 3. This notice may not be removed or altered from any source distribution.
  12. Elsevier CDROM license agreements grants nonexclusive license to use the software
  13. for any purpose, commercial or non-commercial as long as the following credit is included
  14. identifying the original source of the software:
  15. Parts of the source are "from the book Real-Time Collision Detection by
  16. Christer Ericson, published by Morgan Kaufmann Publishers,
  17. (c) 2005 Elsevier Inc."
  18. */
  19. #include "btVoronoiSimplexSolver.h"
  20. #define VERTA 0
  21. #define VERTB 1
  22. #define VERTC 2
  23. #define VERTD 3
  24. #define CATCH_DEGENERATE_TETRAHEDRON 1
  25. void btVoronoiSimplexSolver::removeVertex(int index)
  26. {
  27. btAssert(m_numVertices > 0);
  28. m_numVertices--;
  29. m_simplexVectorW[index] = m_simplexVectorW[m_numVertices];
  30. m_simplexPointsP[index] = m_simplexPointsP[m_numVertices];
  31. m_simplexPointsQ[index] = m_simplexPointsQ[m_numVertices];
  32. }
  33. void btVoronoiSimplexSolver::reduceVertices(const btUsageBitfield& usedVerts)
  34. {
  35. if ((numVertices() >= 4) && (!usedVerts.usedVertexD))
  36. removeVertex(3);
  37. if ((numVertices() >= 3) && (!usedVerts.usedVertexC))
  38. removeVertex(2);
  39. if ((numVertices() >= 2) && (!usedVerts.usedVertexB))
  40. removeVertex(1);
  41. if ((numVertices() >= 1) && (!usedVerts.usedVertexA))
  42. removeVertex(0);
  43. }
  44. //clear the simplex, remove all the vertices
  45. void btVoronoiSimplexSolver::reset()
  46. {
  47. m_cachedValidClosest = false;
  48. m_numVertices = 0;
  49. m_needsUpdate = true;
  50. m_lastW = btVector3(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
  51. m_cachedBC.reset();
  52. }
  53. //add a vertex
  54. void btVoronoiSimplexSolver::addVertex(const btVector3& w, const btVector3& p, const btVector3& q)
  55. {
  56. m_lastW = w;
  57. m_needsUpdate = true;
  58. m_simplexVectorW[m_numVertices] = w;
  59. m_simplexPointsP[m_numVertices] = p;
  60. m_simplexPointsQ[m_numVertices] = q;
  61. m_numVertices++;
  62. }
  63. bool btVoronoiSimplexSolver::updateClosestVectorAndPoints()
  64. {
  65. if (m_needsUpdate)
  66. {
  67. m_cachedBC.reset();
  68. m_needsUpdate = false;
  69. switch (numVertices())
  70. {
  71. case 0:
  72. m_cachedValidClosest = false;
  73. break;
  74. case 1:
  75. {
  76. m_cachedP1 = m_simplexPointsP[0];
  77. m_cachedP2 = m_simplexPointsQ[0];
  78. m_cachedV = m_cachedP1 - m_cachedP2; //== m_simplexVectorW[0]
  79. m_cachedBC.reset();
  80. m_cachedBC.setBarycentricCoordinates(btScalar(1.), btScalar(0.), btScalar(0.), btScalar(0.));
  81. m_cachedValidClosest = m_cachedBC.isValid();
  82. break;
  83. };
  84. case 2:
  85. {
  86. //closest point origin from line segment
  87. const btVector3& from = m_simplexVectorW[0];
  88. const btVector3& to = m_simplexVectorW[1];
  89. btVector3 nearest;
  90. btVector3 p(btScalar(0.), btScalar(0.), btScalar(0.));
  91. btVector3 diff = p - from;
  92. btVector3 v = to - from;
  93. btScalar t = v.dot(diff);
  94. if (t > 0)
  95. {
  96. btScalar dotVV = v.dot(v);
  97. if (t < dotVV)
  98. {
  99. t /= dotVV;
  100. diff -= t * v;
  101. m_cachedBC.m_usedVertices.usedVertexA = true;
  102. m_cachedBC.m_usedVertices.usedVertexB = true;
  103. }
  104. else
  105. {
  106. t = 1;
  107. diff -= v;
  108. //reduce to 1 point
  109. m_cachedBC.m_usedVertices.usedVertexB = true;
  110. }
  111. }
  112. else
  113. {
  114. t = 0;
  115. //reduce to 1 point
  116. m_cachedBC.m_usedVertices.usedVertexA = true;
  117. }
  118. m_cachedBC.setBarycentricCoordinates(1 - t, t);
  119. nearest = from + t * v;
  120. m_cachedP1 = m_simplexPointsP[0] + t * (m_simplexPointsP[1] - m_simplexPointsP[0]);
  121. m_cachedP2 = m_simplexPointsQ[0] + t * (m_simplexPointsQ[1] - m_simplexPointsQ[0]);
  122. m_cachedV = m_cachedP1 - m_cachedP2;
  123. reduceVertices(m_cachedBC.m_usedVertices);
  124. m_cachedValidClosest = m_cachedBC.isValid();
  125. break;
  126. }
  127. case 3:
  128. {
  129. //closest point origin from triangle
  130. btVector3 p(btScalar(0.), btScalar(0.), btScalar(0.));
  131. const btVector3& a = m_simplexVectorW[0];
  132. const btVector3& b = m_simplexVectorW[1];
  133. const btVector3& c = m_simplexVectorW[2];
  134. closestPtPointTriangle(p, a, b, c, m_cachedBC);
  135. m_cachedP1 = m_simplexPointsP[0] * m_cachedBC.m_barycentricCoords[0] +
  136. m_simplexPointsP[1] * m_cachedBC.m_barycentricCoords[1] +
  137. m_simplexPointsP[2] * m_cachedBC.m_barycentricCoords[2];
  138. m_cachedP2 = m_simplexPointsQ[0] * m_cachedBC.m_barycentricCoords[0] +
  139. m_simplexPointsQ[1] * m_cachedBC.m_barycentricCoords[1] +
  140. m_simplexPointsQ[2] * m_cachedBC.m_barycentricCoords[2];
  141. m_cachedV = m_cachedP1 - m_cachedP2;
  142. reduceVertices(m_cachedBC.m_usedVertices);
  143. m_cachedValidClosest = m_cachedBC.isValid();
  144. break;
  145. }
  146. case 4:
  147. {
  148. btVector3 p(btScalar(0.), btScalar(0.), btScalar(0.));
  149. const btVector3& a = m_simplexVectorW[0];
  150. const btVector3& b = m_simplexVectorW[1];
  151. const btVector3& c = m_simplexVectorW[2];
  152. const btVector3& d = m_simplexVectorW[3];
  153. bool hasSeparation = closestPtPointTetrahedron(p, a, b, c, d, m_cachedBC);
  154. if (hasSeparation)
  155. {
  156. m_cachedP1 = m_simplexPointsP[0] * m_cachedBC.m_barycentricCoords[0] +
  157. m_simplexPointsP[1] * m_cachedBC.m_barycentricCoords[1] +
  158. m_simplexPointsP[2] * m_cachedBC.m_barycentricCoords[2] +
  159. m_simplexPointsP[3] * m_cachedBC.m_barycentricCoords[3];
  160. m_cachedP2 = m_simplexPointsQ[0] * m_cachedBC.m_barycentricCoords[0] +
  161. m_simplexPointsQ[1] * m_cachedBC.m_barycentricCoords[1] +
  162. m_simplexPointsQ[2] * m_cachedBC.m_barycentricCoords[2] +
  163. m_simplexPointsQ[3] * m_cachedBC.m_barycentricCoords[3];
  164. m_cachedV = m_cachedP1 - m_cachedP2;
  165. reduceVertices(m_cachedBC.m_usedVertices);
  166. }
  167. else
  168. {
  169. // printf("sub distance got penetration\n");
  170. if (m_cachedBC.m_degenerate)
  171. {
  172. m_cachedValidClosest = false;
  173. }
  174. else
  175. {
  176. m_cachedValidClosest = true;
  177. //degenerate case == false, penetration = true + zero
  178. m_cachedV.setValue(btScalar(0.), btScalar(0.), btScalar(0.));
  179. }
  180. break;
  181. }
  182. m_cachedValidClosest = m_cachedBC.isValid();
  183. //closest point origin from tetrahedron
  184. break;
  185. }
  186. default:
  187. {
  188. m_cachedValidClosest = false;
  189. }
  190. };
  191. }
  192. return m_cachedValidClosest;
  193. }
  194. //return/calculate the closest vertex
  195. bool btVoronoiSimplexSolver::closest(btVector3& v)
  196. {
  197. bool succes = updateClosestVectorAndPoints();
  198. v = m_cachedV;
  199. return succes;
  200. }
  201. btScalar btVoronoiSimplexSolver::maxVertex()
  202. {
  203. int i, numverts = numVertices();
  204. btScalar maxV = btScalar(0.);
  205. for (i = 0; i < numverts; i++)
  206. {
  207. btScalar curLen2 = m_simplexVectorW[i].length2();
  208. if (maxV < curLen2)
  209. maxV = curLen2;
  210. }
  211. return maxV;
  212. }
  213. //return the current simplex
  214. int btVoronoiSimplexSolver::getSimplex(btVector3* pBuf, btVector3* qBuf, btVector3* yBuf) const
  215. {
  216. int i;
  217. for (i = 0; i < numVertices(); i++)
  218. {
  219. yBuf[i] = m_simplexVectorW[i];
  220. pBuf[i] = m_simplexPointsP[i];
  221. qBuf[i] = m_simplexPointsQ[i];
  222. }
  223. return numVertices();
  224. }
  225. bool btVoronoiSimplexSolver::inSimplex(const btVector3& w)
  226. {
  227. bool found = false;
  228. int i, numverts = numVertices();
  229. //btScalar maxV = btScalar(0.);
  230. //w is in the current (reduced) simplex
  231. for (i = 0; i < numverts; i++)
  232. {
  233. #ifdef BT_USE_EQUAL_VERTEX_THRESHOLD
  234. if (m_simplexVectorW[i].distance2(w) <= m_equalVertexThreshold)
  235. #else
  236. if (m_simplexVectorW[i] == w)
  237. #endif
  238. {
  239. found = true;
  240. break;
  241. }
  242. }
  243. //check in case lastW is already removed
  244. if (w == m_lastW)
  245. return true;
  246. return found;
  247. }
  248. void btVoronoiSimplexSolver::backup_closest(btVector3& v)
  249. {
  250. v = m_cachedV;
  251. }
  252. bool btVoronoiSimplexSolver::emptySimplex() const
  253. {
  254. return (numVertices() == 0);
  255. }
  256. void btVoronoiSimplexSolver::compute_points(btVector3& p1, btVector3& p2)
  257. {
  258. updateClosestVectorAndPoints();
  259. p1 = m_cachedP1;
  260. p2 = m_cachedP2;
  261. }
  262. bool btVoronoiSimplexSolver::closestPtPointTriangle(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c, btSubSimplexClosestResult& result)
  263. {
  264. result.m_usedVertices.reset();
  265. // Check if P in vertex region outside A
  266. btVector3 ab = b - a;
  267. btVector3 ac = c - a;
  268. btVector3 ap = p - a;
  269. btScalar d1 = ab.dot(ap);
  270. btScalar d2 = ac.dot(ap);
  271. if (d1 <= btScalar(0.0) && d2 <= btScalar(0.0))
  272. {
  273. result.m_closestPointOnSimplex = a;
  274. result.m_usedVertices.usedVertexA = true;
  275. result.setBarycentricCoordinates(1, 0, 0);
  276. return true; // a; // barycentric coordinates (1,0,0)
  277. }
  278. // Check if P in vertex region outside B
  279. btVector3 bp = p - b;
  280. btScalar d3 = ab.dot(bp);
  281. btScalar d4 = ac.dot(bp);
  282. if (d3 >= btScalar(0.0) && d4 <= d3)
  283. {
  284. result.m_closestPointOnSimplex = b;
  285. result.m_usedVertices.usedVertexB = true;
  286. result.setBarycentricCoordinates(0, 1, 0);
  287. return true; // b; // barycentric coordinates (0,1,0)
  288. }
  289. // Check if P in edge region of AB, if so return projection of P onto AB
  290. btScalar vc = d1 * d4 - d3 * d2;
  291. if (vc <= btScalar(0.0) && d1 >= btScalar(0.0) && d3 <= btScalar(0.0))
  292. {
  293. btScalar v = d1 / (d1 - d3);
  294. result.m_closestPointOnSimplex = a + v * ab;
  295. result.m_usedVertices.usedVertexA = true;
  296. result.m_usedVertices.usedVertexB = true;
  297. result.setBarycentricCoordinates(1 - v, v, 0);
  298. return true;
  299. //return a + v * ab; // barycentric coordinates (1-v,v,0)
  300. }
  301. // Check if P in vertex region outside C
  302. btVector3 cp = p - c;
  303. btScalar d5 = ab.dot(cp);
  304. btScalar d6 = ac.dot(cp);
  305. if (d6 >= btScalar(0.0) && d5 <= d6)
  306. {
  307. result.m_closestPointOnSimplex = c;
  308. result.m_usedVertices.usedVertexC = true;
  309. result.setBarycentricCoordinates(0, 0, 1);
  310. return true; //c; // barycentric coordinates (0,0,1)
  311. }
  312. // Check if P in edge region of AC, if so return projection of P onto AC
  313. btScalar vb = d5 * d2 - d1 * d6;
  314. if (vb <= btScalar(0.0) && d2 >= btScalar(0.0) && d6 <= btScalar(0.0))
  315. {
  316. btScalar w = d2 / (d2 - d6);
  317. result.m_closestPointOnSimplex = a + w * ac;
  318. result.m_usedVertices.usedVertexA = true;
  319. result.m_usedVertices.usedVertexC = true;
  320. result.setBarycentricCoordinates(1 - w, 0, w);
  321. return true;
  322. //return a + w * ac; // barycentric coordinates (1-w,0,w)
  323. }
  324. // Check if P in edge region of BC, if so return projection of P onto BC
  325. btScalar va = d3 * d6 - d5 * d4;
  326. if (va <= btScalar(0.0) && (d4 - d3) >= btScalar(0.0) && (d5 - d6) >= btScalar(0.0))
  327. {
  328. btScalar w = (d4 - d3) / ((d4 - d3) + (d5 - d6));
  329. result.m_closestPointOnSimplex = b + w * (c - b);
  330. result.m_usedVertices.usedVertexB = true;
  331. result.m_usedVertices.usedVertexC = true;
  332. result.setBarycentricCoordinates(0, 1 - w, w);
  333. return true;
  334. // return b + w * (c - b); // barycentric coordinates (0,1-w,w)
  335. }
  336. // P inside face region. Compute Q through its barycentric coordinates (u,v,w)
  337. btScalar denom = btScalar(1.0) / (va + vb + vc);
  338. btScalar v = vb * denom;
  339. btScalar w = vc * denom;
  340. result.m_closestPointOnSimplex = a + ab * v + ac * w;
  341. result.m_usedVertices.usedVertexA = true;
  342. result.m_usedVertices.usedVertexB = true;
  343. result.m_usedVertices.usedVertexC = true;
  344. result.setBarycentricCoordinates(1 - v - w, v, w);
  345. return true;
  346. // return a + ab * v + ac * w; // = u*a + v*b + w*c, u = va * denom = btScalar(1.0) - v - w
  347. }
  348. /// Test if point p and d lie on opposite sides of plane through abc
  349. int btVoronoiSimplexSolver::pointOutsideOfPlane(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c, const btVector3& d)
  350. {
  351. btVector3 normal = (b - a).cross(c - a);
  352. btScalar signp = (p - a).dot(normal); // [AP AB AC]
  353. btScalar signd = (d - a).dot(normal); // [AD AB AC]
  354. #ifdef CATCH_DEGENERATE_TETRAHEDRON
  355. #ifdef BT_USE_DOUBLE_PRECISION
  356. if (signd * signd < (btScalar(1e-8) * btScalar(1e-8)))
  357. {
  358. return -1;
  359. }
  360. #else
  361. if (signd * signd < (btScalar(1e-4) * btScalar(1e-4)))
  362. {
  363. // printf("affine dependent/degenerate\n");//
  364. return -1;
  365. }
  366. #endif
  367. #endif
  368. // Points on opposite sides if expression signs are opposite
  369. return signp * signd < btScalar(0.);
  370. }
  371. bool btVoronoiSimplexSolver::closestPtPointTetrahedron(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c, const btVector3& d, btSubSimplexClosestResult& finalResult)
  372. {
  373. btSubSimplexClosestResult tempResult;
  374. // Start out assuming point inside all halfspaces, so closest to itself
  375. finalResult.m_closestPointOnSimplex = p;
  376. finalResult.m_usedVertices.reset();
  377. finalResult.m_usedVertices.usedVertexA = true;
  378. finalResult.m_usedVertices.usedVertexB = true;
  379. finalResult.m_usedVertices.usedVertexC = true;
  380. finalResult.m_usedVertices.usedVertexD = true;
  381. int pointOutsideABC = pointOutsideOfPlane(p, a, b, c, d);
  382. int pointOutsideACD = pointOutsideOfPlane(p, a, c, d, b);
  383. int pointOutsideADB = pointOutsideOfPlane(p, a, d, b, c);
  384. int pointOutsideBDC = pointOutsideOfPlane(p, b, d, c, a);
  385. if (pointOutsideABC < 0 || pointOutsideACD < 0 || pointOutsideADB < 0 || pointOutsideBDC < 0)
  386. {
  387. finalResult.m_degenerate = true;
  388. return false;
  389. }
  390. if (!pointOutsideABC && !pointOutsideACD && !pointOutsideADB && !pointOutsideBDC)
  391. {
  392. return false;
  393. }
  394. btScalar bestSqDist = FLT_MAX;
  395. // If point outside face abc then compute closest point on abc
  396. if (pointOutsideABC)
  397. {
  398. closestPtPointTriangle(p, a, b, c, tempResult);
  399. btVector3 q = tempResult.m_closestPointOnSimplex;
  400. btScalar sqDist = (q - p).dot(q - p);
  401. // Update best closest point if (squared) distance is less than current best
  402. if (sqDist < bestSqDist)
  403. {
  404. bestSqDist = sqDist;
  405. finalResult.m_closestPointOnSimplex = q;
  406. //convert result bitmask!
  407. finalResult.m_usedVertices.reset();
  408. finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
  409. finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexB;
  410. finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC;
  411. finalResult.setBarycentricCoordinates(
  412. tempResult.m_barycentricCoords[VERTA],
  413. tempResult.m_barycentricCoords[VERTB],
  414. tempResult.m_barycentricCoords[VERTC],
  415. 0);
  416. }
  417. }
  418. // Repeat test for face acd
  419. if (pointOutsideACD)
  420. {
  421. closestPtPointTriangle(p, a, c, d, tempResult);
  422. btVector3 q = tempResult.m_closestPointOnSimplex;
  423. //convert result bitmask!
  424. btScalar sqDist = (q - p).dot(q - p);
  425. if (sqDist < bestSqDist)
  426. {
  427. bestSqDist = sqDist;
  428. finalResult.m_closestPointOnSimplex = q;
  429. finalResult.m_usedVertices.reset();
  430. finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
  431. finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexB;
  432. finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexC;
  433. finalResult.setBarycentricCoordinates(
  434. tempResult.m_barycentricCoords[VERTA],
  435. 0,
  436. tempResult.m_barycentricCoords[VERTB],
  437. tempResult.m_barycentricCoords[VERTC]);
  438. }
  439. }
  440. // Repeat test for face adb
  441. if (pointOutsideADB)
  442. {
  443. closestPtPointTriangle(p, a, d, b, tempResult);
  444. btVector3 q = tempResult.m_closestPointOnSimplex;
  445. //convert result bitmask!
  446. btScalar sqDist = (q - p).dot(q - p);
  447. if (sqDist < bestSqDist)
  448. {
  449. bestSqDist = sqDist;
  450. finalResult.m_closestPointOnSimplex = q;
  451. finalResult.m_usedVertices.reset();
  452. finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
  453. finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexC;
  454. finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB;
  455. finalResult.setBarycentricCoordinates(
  456. tempResult.m_barycentricCoords[VERTA],
  457. tempResult.m_barycentricCoords[VERTC],
  458. 0,
  459. tempResult.m_barycentricCoords[VERTB]);
  460. }
  461. }
  462. // Repeat test for face bdc
  463. if (pointOutsideBDC)
  464. {
  465. closestPtPointTriangle(p, b, d, c, tempResult);
  466. btVector3 q = tempResult.m_closestPointOnSimplex;
  467. //convert result bitmask!
  468. btScalar sqDist = (q - p).dot(q - p);
  469. if (sqDist < bestSqDist)
  470. {
  471. bestSqDist = sqDist;
  472. finalResult.m_closestPointOnSimplex = q;
  473. finalResult.m_usedVertices.reset();
  474. //
  475. finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexA;
  476. finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC;
  477. finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB;
  478. finalResult.setBarycentricCoordinates(
  479. 0,
  480. tempResult.m_barycentricCoords[VERTA],
  481. tempResult.m_barycentricCoords[VERTC],
  482. tempResult.m_barycentricCoords[VERTB]);
  483. }
  484. }
  485. //help! we ended up full !
  486. if (finalResult.m_usedVertices.usedVertexA &&
  487. finalResult.m_usedVertices.usedVertexB &&
  488. finalResult.m_usedVertices.usedVertexC &&
  489. finalResult.m_usedVertices.usedVertexD)
  490. {
  491. return true;
  492. }
  493. return true;
  494. }