ShapeGeometry.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ShapeGeometry - 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">ShapeGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Creates an one-sided polygonal geometry from one or more path shapes.</p></div>
  17. <iframe id="viewer" src="../scenes/geometry-browser.html#ShapeGeometry"></iframe>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const arcShape = new THREE.Shape()
  20. .moveTo( 5, 1 )
  21. .absarc( 1, 1, 4, 0, Math.PI * 2, false );
  22. const geometry = new THREE.ShapeGeometry( arcShape );
  23. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide } );
  24. const mesh = new THREE.Mesh( geometry, material ) ;
  25. scene.add( mesh );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="ShapeGeometry" translate="no">new <a href="#ShapeGeometry">ShapeGeometry</a><span class="signature">( shapes : <span class="param-type"><a href="Shape.html">Shape</a> | Array.&lt;<a href="Shape.html">Shape</a>></span>, curveSegments : <span class="param-type">number</span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new shape geometry.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name">
  40. <strong>shapes</strong>
  41. </td>
  42. <td class="description last">
  43. <p>A shape or an array of shapes.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong>curveSegments</strong>
  49. </td>
  50. <td class="description last">
  51. <p>Number of segments per shape.</p>
  52. <p>Default is <code>12</code>.</p>
  53. </td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. </div>
  58. </div>
  59. <h2 class="subsection-title">Properties</h2>
  60. <div class="member">
  61. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  62. <div class="description">
  63. <p>Holds the constructor parameters that have been
  64. used to generate the geometry. Any modification
  65. after instantiation does not change the geometry.</p>
  66. </div>
  67. </div>
  68. <h2 class="subsection-title">Static Methods</h2>
  69. <h3 class="name name-method" id=".fromJSON" translate="no">.<a href="#.fromJSON">fromJSON</a><span class="signature">( data : <span class="param-type">Object</span>, shapes : <span class="param-type">Array.&lt;<a href="Shape.html">Shape</a>></span> )</span><span class="type-signature"> : <a href="ShapeGeometry.html">ShapeGeometry</a></span> </h3>
  70. <div class="method">
  71. <div class="description">
  72. <p>Factory method for creating an instance of this class from the given
  73. JSON object.</p>
  74. </div>
  75. <table class="params">
  76. <tbody>
  77. <tr>
  78. <td class="name">
  79. <strong>data</strong>
  80. </td>
  81. <td class="description last">
  82. <p>A JSON object representing the serialized geometry.</p>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td class="name">
  87. <strong>shapes</strong>
  88. </td>
  89. <td class="description last">
  90. <p>An array of shapes.</p>
  91. </td>
  92. </tr>
  93. </tbody>
  94. </table>
  95. <dl class="details">
  96. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  97. </dl>
  98. </div>
  99. <h2 class="subsection-title">Source</h2>
  100. <p>
  101. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/ShapeGeometry.js" translate="no" target="_blank" rel="noopener">src/geometries/ShapeGeometry.js</a>
  102. </p>
  103. </article>
  104. </section>
  105. <script src="../scripts/linenumber.js"></script>
  106. <script src="../scripts/page.js"></script>
  107. </body>
  108. </html>
粤ICP备19079148号