ConvexGeometry.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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" rel="noopener">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;<a href="Vector3.html">Vector3</a>></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">
  40. <strong>points</strong>
  41. </td>
  42. <td class="description last">
  43. <p>An array of points in 3D space which should be enclosed by the convex hull.</p>
  44. </td>
  45. </tr>
  46. </tbody>
  47. </table>
  48. </div>
  49. </div>
  50. <h2 class="subsection-title">Source</h2>
  51. <p>
  52. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ConvexGeometry.js" translate="no" target="_blank" rel="noopener">examples/jsm/geometries/ConvexGeometry.js</a>
  53. </p>
  54. </article>
  55. </section>
  56. <script src="../scripts/linenumber.js"></script>
  57. <script src="../scripts/page.js"></script>
  58. </body>
  59. </html>
粤ICP备19079148号