1
0

ExtrudeGeometry.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ExtrudeGeometry - 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">ExtrudeGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Creates extruded geometry from a path shape.</p></div>
  17. <iframe id="viewer" src="../scenes/geometry-browser.html#ExtrudeGeometry"></iframe>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const length = 12, width = 8;
  20. const shape = new THREE.Shape();
  21. shape.moveTo( 0,0 );
  22. shape.lineTo( 0, width );
  23. shape.lineTo( length, width );
  24. shape.lineTo( length, 0 );
  25. shape.lineTo( 0, 0 );
  26. const geometry = new THREE.ExtrudeGeometry( shape );
  27. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  28. const mesh = new THREE.Mesh( geometry, material ) ;
  29. scene.add( mesh );
  30. </code></pre></div>
  31. </header>
  32. <article>
  33. <div class="container-overview">
  34. <h2>Constructor</h2>
  35. <h3 class="name name-method" id="ExtrudeGeometry" translate="no">new <a href="#ExtrudeGeometry">ExtrudeGeometry</a><span class="signature">( shapes : <span class="param-type"><a href="Shape.html">Shape</a> | Array.&lt;<a href="Shape.html">Shape</a>></span>, options : <span class="param-type"><a href="ExtrudeGeometry.html#~Options">ExtrudeGeometry~Options</a></span> )</span> </h3>
  36. <div class="method">
  37. <div class="description">
  38. <p>Constructs a new extrude geometry.</p>
  39. </div>
  40. <table class="params">
  41. <tbody>
  42. <tr>
  43. <td class="name">
  44. <strong>shapes</strong>
  45. </td>
  46. <td class="description last">
  47. <p>A shape or an array of shapes.</p>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td class="name">
  52. <strong>options</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The extrude settings.</p>
  56. </td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. </div>
  61. </div>
  62. <h2 class="subsection-title">Properties</h2>
  63. <div class="member">
  64. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  65. <div class="description">
  66. <p>Holds the constructor parameters that have been
  67. used to generate the geometry. Any modification
  68. after instantiation does not change the geometry.</p>
  69. </div>
  70. </div>
  71. <h2 class="subsection-title">Static Methods</h2>
  72. <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="ExtrudeGeometry.html">ExtrudeGeometry</a></span> </h3>
  73. <div class="method">
  74. <div class="description">
  75. <p>Factory method for creating an instance of this class from the given
  76. JSON object.</p>
  77. </div>
  78. <table class="params">
  79. <tbody>
  80. <tr>
  81. <td class="name">
  82. <strong>data</strong>
  83. </td>
  84. <td class="description last">
  85. <p>A JSON object representing the serialized geometry.</p>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td class="name">
  90. <strong>shapes</strong>
  91. </td>
  92. <td class="description last">
  93. <p>An array of shapes.</p>
  94. </td>
  95. </tr>
  96. </tbody>
  97. </table>
  98. <dl class="details">
  99. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  100. </dl>
  101. </div>
  102. <h2 class="subsection-title">Type Definitions</h2>
  103. <div class="member">
  104. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  105. <div class="description">
  106. <p>Represents the <code>options</code> type of the geometry's constructor.</p>
  107. </div>
  108. <table class="props">
  109. <tbody>
  110. <tr>
  111. <td class="name">
  112. <strong>curveSegments</strong>
  113. <br>
  114. <span class="param-type">number</span>
  115. </td>
  116. <td class="description last">
  117. <p>Number of points on the curves.</p>
  118. <p>Default is <code>12</code>.</p>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td class="name">
  123. <strong>steps</strong>
  124. <br>
  125. <span class="param-type">number</span>
  126. </td>
  127. <td class="description last">
  128. <p>Number of points used for subdividing segments along the depth of the extruded spline.</p>
  129. <p>Default is <code>1</code>.</p>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td class="name">
  134. <strong>depth</strong>
  135. <br>
  136. <span class="param-type">number</span>
  137. </td>
  138. <td class="description last">
  139. <p>Depth to extrude the shape.</p>
  140. <p>Default is <code>1</code>.</p>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td class="name">
  145. <strong>bevelEnabled</strong>
  146. <br>
  147. <span class="param-type">boolean</span>
  148. </td>
  149. <td class="description last">
  150. <p>Whether to beveling to the shape or not.</p>
  151. <p>Default is <code>true</code>.</p>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td class="name">
  156. <strong>bevelThickness</strong>
  157. <br>
  158. <span class="param-type">number</span>
  159. </td>
  160. <td class="description last">
  161. <p>How deep into the original shape the bevel goes.</p>
  162. <p>Default is <code>0.2</code>.</p>
  163. </td>
  164. </tr>
  165. <tr>
  166. <td class="name">
  167. <strong>bevelSize</strong>
  168. <br>
  169. <span class="param-type">number</span>
  170. </td>
  171. <td class="description last">
  172. <p>Distance from the shape outline that the bevel extends.</p>
  173. <p>Default is <code>bevelThickness-0.1</code>.</p>
  174. </td>
  175. </tr>
  176. <tr>
  177. <td class="name">
  178. <strong>bevelOffset</strong>
  179. <br>
  180. <span class="param-type">number</span>
  181. </td>
  182. <td class="description last">
  183. <p>Distance from the shape outline that the bevel starts.</p>
  184. <p>Default is <code>0</code>.</p>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td class="name">
  189. <strong>bevelSegments</strong>
  190. <br>
  191. <span class="param-type">number</span>
  192. </td>
  193. <td class="description last">
  194. <p>Number of bevel layers.</p>
  195. <p>Default is <code>3</code>.</p>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td class="name">
  200. <strong>extrudePath</strong>
  201. <br>
  202. <span class="param-type"><a href="Curve.html">Curve</a></span>
  203. </td>
  204. <td class="description last">
  205. <p>A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.</p>
  206. <p>Default is <code>null</code>.</p>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td class="name">
  211. <strong>UVGenerator</strong>
  212. <br>
  213. <span class="param-type">Object</span>
  214. </td>
  215. <td class="description last">
  216. <p>An object that provides UV generator functions for custom UV generation.</p>
  217. </td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. </div>
  222. <h2 class="subsection-title">Source</h2>
  223. <p>
  224. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js" translate="no" target="_blank" rel="noopener">src/geometries/ExtrudeGeometry.js</a>
  225. </p>
  226. </article>
  227. </section>
  228. <script src="../scripts/linenumber.js"></script>
  229. <script src="../scripts/page.js"></script>
  230. </body>
  231. </html>
粤ICP备19079148号