ConvexGeometry.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ConvexGeometry - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="BufferGeometry.html">BufferGeometry</a> → </p>
  13. <h1 translate="no">ConvexGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can be used to generate a convex hull for a given array of 3D points.
  17. The average time complexity for this task is considered to be O(nlog(n)).</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const geometry = new ConvexGeometry( points );
  20. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  21. const mesh = new THREE.Mesh( geometry, material );
  22. scene.add( mesh );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">ConvexGeometry</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  28. <pre><code class="language-js">import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="ConvexGeometry" translate="no">new <a href="#ConvexGeometry">ConvexGeometry</a><span class="signature">( points : <span class="param-type">Array.&lt;Vector3></span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new convex geometry.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name"><code>points</code></td>
  40. <td class="description last"><p>An array of points in 3D space which should be enclosed by the convex hull.</p></td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. </div>
  46. <h2 class="subsection-title">Source</h2>
  47. <p>
  48. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ConvexGeometry.js" target="_blank" rel="noopener" translate="no">examples/jsm/geometries/ConvexGeometry.js</a>
  49. </p>
  50. </article>
  51. </section>
  52. <script src="../scripts/linenumber.js"></script>
  53. <script src="../scripts/page.js"></script>
  54. </body>
  55. </html>
粤ICP备19079148号