ConvexHull.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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/">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">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">Vector3</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"><code>point</code></td>
  43. <td class="description last"><p>The point to test.</p></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. <dl class="details">
  48. <dt class="tag-returns"><strong>Returns:</strong> Whether the given point lies in the convex hull or not.</dt>
  49. </dl>
  50. </div>
  51. <h3 class="name name-method" id="intersectRay" translate="no">.<a href="#intersectRay">intersectRay</a><span class="signature">( ray : <span class="param-type">Ray</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  52. <div class="method">
  53. <div class="description">
  54. <p>Computes the intersections point of the given ray and this convex hull.</p>
  55. </div>
  56. <table class="params">
  57. <tbody>
  58. <tr>
  59. <td class="name"><code>ray</code></td>
  60. <td class="description last"><p>The ray to test.</p></td>
  61. </tr>
  62. <tr>
  63. <td class="name"><code>target</code></td>
  64. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  65. </tr>
  66. </tbody>
  67. </table>
  68. <dl class="details">
  69. <dt class="tag-returns"><strong>Returns:</strong> The intersection point. Returns <code>null</code> if not intersection was detected.</dt>
  70. </dl>
  71. </div>
  72. <h3 class="name name-method" id="intersectsRay" translate="no">.<a href="#intersectsRay">intersectsRay</a><span class="signature">( ray : <span class="param-type">Ray</span> )</span><span class="type-signature"> : boolean</span> </h3>
  73. <div class="method">
  74. <div class="description">
  75. <p>Returns <code>true</code> if the given ray intersects with this convex hull.</p>
  76. </div>
  77. <table class="params">
  78. <tbody>
  79. <tr>
  80. <td class="name"><code>ray</code></td>
  81. <td class="description last"><p>The ray to test.</p></td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <dl class="details">
  86. <dt class="tag-returns"><strong>Returns:</strong> Whether the given ray intersects with this convex hull or not.</dt>
  87. </dl>
  88. </div>
  89. <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>
  90. <div class="method">
  91. <div class="description">
  92. <p>Makes the convex hull empty.</p>
  93. </div>
  94. <dl class="details">
  95. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  96. </dl>
  97. </div>
  98. <h3 class="name name-method" id="setFromObject" translate="no">.<a href="#setFromObject">setFromObject</a><span class="signature">( object : <span class="param-type">Object3D</span> )</span><span class="type-signature"> : <a href="ConvexHull.html">ConvexHull</a></span> </h3>
  99. <div class="method">
  100. <div class="description">
  101. <p>Computes the convex hull of the given 3D object (including its descendants),
  102. accounting for the world transforms of both the 3D object and its descendants.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name"><code>object</code></td>
  108. <td class="description last"><p>The 3D object to compute the convex hull for.</p></td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  114. </dl>
  115. </div>
  116. <h3 class="name name-method" id="setFromPoints" translate="no">.<a href="#setFromPoints">setFromPoints</a><span class="signature">( points : <span class="param-type">Array.&lt;Vector3></span> )</span><span class="type-signature"> : <a href="ConvexHull.html">ConvexHull</a></span> </h3>
  117. <div class="method">
  118. <div class="description">
  119. <p>Computes to convex hull for the given array of points.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name"><code>points</code></td>
  125. <td class="description last"><p>The array of points in 3D space.</p></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-returns"><strong>Returns:</strong> A reference to this convex hull.</dt>
  131. </dl>
  132. </div>
  133. <h2 class="subsection-title">Source</h2>
  134. <p>
  135. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ConvexHull.js" target="_blank" rel="noopener" translate="no">examples/jsm/math/ConvexHull.js</a>
  136. </p>
  137. </article>
  138. </section>
  139. <script src="../scripts/linenumber.js"></script>
  140. <script src="../scripts/page.js"></script>
  141. </body>
  142. </html>
粤ICP备19079148号