ExtrudeGeometry.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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">Shape | Array.&lt;Shape></span>, options : <span class="param-type">ExtrudeGeometry~Options</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"><code>shapes</code></td>
  44. <td class="description last"><p>A shape or an array of shapes.</p></td>
  45. </tr>
  46. <tr>
  47. <td class="name"><code>options</code></td>
  48. <td class="description last"><p>The extrude settings.</p></td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Properties</h2>
  55. <div class="member">
  56. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  57. <div class="description">
  58. <p>Holds the constructor parameters that have been
  59. used to generate the geometry. Any modification
  60. after instantiation does not change the geometry.</p>
  61. </div>
  62. </div>
  63. <h2 class="subsection-title">Static Methods</h2>
  64. <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;Shape></span> )</span><span class="type-signature"> : <a href="ExtrudeGeometry.html">ExtrudeGeometry</a></span> </h3>
  65. <div class="method">
  66. <div class="description">
  67. <p>Factory method for creating an instance of this class from the given
  68. JSON object.</p>
  69. </div>
  70. <table class="params">
  71. <tbody>
  72. <tr>
  73. <td class="name"><code>data</code></td>
  74. <td class="description last"><p>A JSON object representing the serialized geometry.</p></td>
  75. </tr>
  76. <tr>
  77. <td class="name"><code>shapes</code></td>
  78. <td class="description last"><p>An array of shapes.</p></td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. <dl class="details">
  83. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  84. </dl>
  85. </div>
  86. <h2 class="subsection-title">Type Definitions</h2>
  87. <div class="member">
  88. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  89. <div class="description">
  90. <p>Represents the <code>options</code> type of the geometry's constructor.</p>
  91. </div>
  92. <h5 class="subsection-title">Properties:</h5>
  93. <table class="props">
  94. <thead>
  95. <tr>
  96. <th>Name</th>
  97. <th>Type</th>
  98. <th>Attributes</th>
  99. <th>Default</th>
  100. <th class="last">Description</th>
  101. </tr>
  102. </thead>
  103. <tbody>
  104. <tr>
  105. <td class="name"><code>curveSegments</code></td>
  106. <td class="type">
  107. <span class="param-type">number</span>
  108. </td>
  109. <td class="attributes">
  110. &lt;optional><br>
  111. </td>
  112. <td class="default">
  113. 12
  114. </td>
  115. <td class="description last"><p>Number of points on the curves.</p></td>
  116. </tr>
  117. <tr>
  118. <td class="name"><code>steps</code></td>
  119. <td class="type">
  120. <span class="param-type">number</span>
  121. </td>
  122. <td class="attributes">
  123. &lt;optional><br>
  124. </td>
  125. <td class="default">
  126. 1
  127. </td>
  128. <td class="description last"><p>Number of points used for subdividing segments along the depth of the extruded spline.</p></td>
  129. </tr>
  130. <tr>
  131. <td class="name"><code>depth</code></td>
  132. <td class="type">
  133. <span class="param-type">number</span>
  134. </td>
  135. <td class="attributes">
  136. &lt;optional><br>
  137. </td>
  138. <td class="default">
  139. 1
  140. </td>
  141. <td class="description last"><p>Depth to extrude the shape.</p></td>
  142. </tr>
  143. <tr>
  144. <td class="name"><code>bevelEnabled</code></td>
  145. <td class="type">
  146. <span class="param-type">boolean</span>
  147. </td>
  148. <td class="attributes">
  149. &lt;optional><br>
  150. </td>
  151. <td class="default">
  152. true
  153. </td>
  154. <td class="description last"><p>Whether to beveling to the shape or not.</p></td>
  155. </tr>
  156. <tr>
  157. <td class="name"><code>bevelThickness</code></td>
  158. <td class="type">
  159. <span class="param-type">number</span>
  160. </td>
  161. <td class="attributes">
  162. &lt;optional><br>
  163. </td>
  164. <td class="default">
  165. 0.2
  166. </td>
  167. <td class="description last"><p>How deep into the original shape the bevel goes.</p></td>
  168. </tr>
  169. <tr>
  170. <td class="name"><code>bevelSize</code></td>
  171. <td class="type">
  172. <span class="param-type">number</span>
  173. </td>
  174. <td class="attributes">
  175. &lt;optional><br>
  176. </td>
  177. <td class="default">
  178. bevelThickness-0.1
  179. </td>
  180. <td class="description last"><p>Distance from the shape outline that the bevel extends.</p></td>
  181. </tr>
  182. <tr>
  183. <td class="name"><code>bevelOffset</code></td>
  184. <td class="type">
  185. <span class="param-type">number</span>
  186. </td>
  187. <td class="attributes">
  188. &lt;optional><br>
  189. </td>
  190. <td class="default">
  191. 0
  192. </td>
  193. <td class="description last"><p>Distance from the shape outline that the bevel starts.</p></td>
  194. </tr>
  195. <tr>
  196. <td class="name"><code>bevelSegments</code></td>
  197. <td class="type">
  198. <span class="param-type">number</span>
  199. </td>
  200. <td class="attributes">
  201. &lt;optional><br>
  202. </td>
  203. <td class="default">
  204. 3
  205. </td>
  206. <td class="description last"><p>Number of bevel layers.</p></td>
  207. </tr>
  208. <tr>
  209. <td class="name"><code>extrudePath</code></td>
  210. <td class="type">
  211. <span class="param-type"><a href="Curve.html">Curve</a></span>
  212. </td>
  213. <td class="attributes">
  214. &lt;optional><br>
  215. &lt;nullable><br>
  216. </td>
  217. <td class="default">
  218. null
  219. </td>
  220. <td class="description last"><p>A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.</p></td>
  221. </tr>
  222. <tr>
  223. <td class="name"><code>UVGenerator</code></td>
  224. <td class="type">
  225. <span class="param-type">Object</span>
  226. </td>
  227. <td class="attributes">
  228. &lt;optional><br>
  229. </td>
  230. <td class="default">
  231. </td>
  232. <td class="description last"><p>An object that provides UV generator functions for custom UV generation.</p></td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. </div>
  237. <h2 class="subsection-title">Source</h2>
  238. <p>
  239. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js" target="_blank" rel="noopener" translate="no">src/geometries/ExtrudeGeometry.js</a>
  240. </p>
  241. </article>
  242. </section>
  243. <script src="../scripts/linenumber.js"></script>
  244. <script src="../scripts/page.js"></script>
  245. </body>
  246. </html>
粤ICP备19079148号