ConvexHull.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ConvexHull - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">ConvexHull</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Can be used to compute the convex hull in 3D space for a given set of points. It
  16. is primarily intended for <a href="ConvexGeometry.html">ConvexGeometry</a>.</p>
  17. <p>This Quickhull 3D implementation is a port of <a href="https://github.com/maurizzzio/quickhull3d/" target="_blank" rel="noopener">quickhull3d</a>
  18. by Mauricio Poppe.</p></div>
  19. </header>
  20. <article>
  21. <h2 class="subsection-title">Import</h2>
  22. <p><span translate="no">ConvexHull</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  23. <pre><code class="language-js">import { ConvexHull } from 'three/addons/math/ConvexHull.js';</code></pre>
  24. <div class="container-overview">
  25. <h2>Constructor</h2>
  26. <h3 class="name name-method" id="ConvexHull" translate="no">new <a href="#ConvexHull">ConvexHull</a><span class="signature">()</span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Constructs a new convex hull.</p>
  30. </div>
  31. </div>
  32. </div>
  33. <h2 class="subsection-title">Methods</h2>
  34. <h3 class="name name-method" id="containsPoint" translate="no">.<a href="#containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Returns <code>true</code> if the given point lies in the convex hull.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>point</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The point to test.</p>
  47. </td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. <dl class="details">
  52. <dt class="tag-returns"><strong>Returns:</strong> Whether the given point lies in the convex hull or not.</dt>
  53. </dl>
  54. </div>
  55. <h3 class="name name-method" id="intersectRay" translate="no">.<a href="#intersectRay">intersectRay</a><span class="signature">( ray : <span class="param-type"><a href="Ray.html">Ray</a></span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  56. <div class="method">
  57. <div class="description">
  58. <p>Computes the intersections point of the given ray and this convex hull.</p>
  59. </div>
  60. <table class="params">
  61. <tbody>
  62. <tr>
  63. <td class="name">
  64. <strong>ray</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The ray to test.</p>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td class="name">
  72. <strong>target</strong>
  73. </td>
  74. <td class="description last">
  75. <p>The target vector that is used to store the method's result.</p>
  76. </td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <dl class="details">
  81. <dt class="tag-returns"><strong>Returns:</strong> The intersection point. Returns <code>null</code> if not intersection was detected.</dt>
  82. </dl>
  83. </div>
  84. <h3 class="name name-method" id="intersectsRay" translate="no">.<a href="#intersectsRay">intersectsRay</a><span class="signature">( ray : <span class="param-type"><a href="Ray.html">Ray</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  85. <div class="method">
  86. <div class="description">
  87. <p>Returns <code>true</code> if the given ray intersects with this convex hull.</p>
  88. </div>
  89. <table class="params">
  90. <tbody>
  91. <tr>
  92. <td class="name">
  93. <strong>ray</strong>
  94. </td>
  95. <td class="description last">
  96. <p>The ray to test.</p>
  97. </td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <dl class="details">
  102. <dt class="tag-returns"><strong>Returns:</strong> Whether the given ray intersects with this convex hull or not.</dt>
  103. </dl>
  104. </div>
  105. <h3 class="name name-method" id="makeEmpty" translate="no">.<a href="#makeEmpty">makeEmpty</a><span class="signature">()</span><span class="type-signature"> : <a href="ConvexHull.html">ConvexHull</a></span> </h3>
  106. <div class="method">
  107. <div class="description">
  108. <p>Makes the convex hull empty.</p>
  109. </div>
  110. <dl class="details">
  111. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  112. </dl>
  113. </div>
  114. <h3 class="name name-method" id="setFromObject" translate="no">.<a href="#setFromObject">setFromObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : <a href="ConvexHull.html">ConvexHull</a></span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Computes the convex hull of the given 3D object (including its descendants),
  118. accounting for the world transforms of both the 3D object and its descendants.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name">
  124. <strong>object</strong>
  125. </td>
  126. <td class="description last">
  127. <p>The 3D object to compute the convex hull for.</p>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  134. </dl>
  135. </div>
  136. <h3 class="name name-method" id="setFromPoints" translate="no">.<a href="#setFromPoints">setFromPoints</a><span class="signature">( points : <span class="param-type">Array.&lt;<a href="Vector3.html">Vector3</a>></span> )</span><span class="type-signature"> : <a href="ConvexHull.html">ConvexHull</a></span> </h3>
  137. <div class="method">
  138. <div class="description">
  139. <p>Computes to convex hull for the given array of points.</p>
  140. </div>
  141. <table class="params">
  142. <tbody>
  143. <tr>
  144. <td class="name">
  145. <strong>points</strong>
  146. </td>
  147. <td class="description last">
  148. <p>The array of points in 3D space.</p>
  149. </td>
  150. </tr>
  151. </tbody>
  152. </table>
  153. <dl class="details">
  154. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  155. </dl>
  156. </div>
  157. <h2 class="subsection-title">Source</h2>
  158. <p>
  159. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ConvexHull.js" translate="no" target="_blank" rel="noopener">examples/jsm/math/ConvexHull.js</a>
  160. </p>
  161. </article>
  162. </section>
  163. <script src="../scripts/linenumber.js"></script>
  164. <script src="../scripts/page.js"></script>
  165. </body>
  166. </html>
粤ICP备19079148号