LineGeometry.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>LineGeometry - 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="InstancedBufferGeometry.html">InstancedBufferGeometry</a> → <a href="LineSegmentsGeometry.html">LineSegmentsGeometry</a> → </p>
  13. <h1 translate="no">LineGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A chain of vertices, forming a polyline.</p>
  17. <p>This is used in <a href="Line2.html">Line2</a> to describe the shape.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const points = [
  20. new THREE.Vector3( - 10, 0, 0 ),
  21. new THREE.Vector3( 0, 5, 0 ),
  22. new THREE.Vector3( 10, 0, 0 ),
  23. ];
  24. const geometry = new LineGeometry();
  25. geometry.setFromPoints( points );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">LineGeometry</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>
  31. <pre><code class="language-js">import { LineLineGeometry2 } from 'three/addons/lines/LineGeometry.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="LineGeometry" translate="no">new <a href="#LineGeometry">LineGeometry</a><span class="signature">()</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new line geometry.</p>
  38. </div>
  39. </div>
  40. </div>
  41. <h2 class="subsection-title">Properties</h2>
  42. <div class="member">
  43. <h3 class="name" id="isLineGeometry" translate="no">.<a href="#isLineGeometry">isLineGeometry</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  44. <div class="description">
  45. <p>This flag can be used for type testing.</p>
  46. <p>Default is <code>true</code>.</p>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Methods</h2>
  50. <h3 class="name name-method" id="fromLine" translate="no">.<a href="#fromLine">fromLine</a><span class="signature">( line : <span class="param-type"><a href="Line.html">Line</a></span> )</span><span class="type-signature"> : <a href="LineGeometry.html">LineGeometry</a></span> </h3>
  51. <div class="method">
  52. <div class="description">
  53. <p>Setups this line segments geometry from the given line.</p>
  54. </div>
  55. <table class="params">
  56. <tbody>
  57. <tr>
  58. <td class="name">
  59. <strong>line</strong>
  60. </td>
  61. <td class="description last">
  62. <p>The line that should be used as a data source for this geometry.</p>
  63. </td>
  64. </tr>
  65. </tbody>
  66. </table>
  67. <dl class="details">
  68. <dt class="tag-returns"><strong>Returns:</strong> A reference to this geometry.</dt>
  69. </dl>
  70. </div>
  71. <h3 class="name name-method" id="setColors" translate="no">.<a href="#setColors">setColors</a><span class="signature">( array : <span class="param-type">Float32Array | Array.&lt;number></span> )</span><span class="type-signature"> : <a href="LineGeometry.html">LineGeometry</a></span> </h3>
  72. <div class="method">
  73. <div class="description">
  74. <p>Sets the given line colors for this geometry.</p>
  75. </div>
  76. <table class="params">
  77. <tbody>
  78. <tr>
  79. <td class="name">
  80. <strong>array</strong>
  81. </td>
  82. <td class="description last">
  83. <p>The position data to set.</p>
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. <dl class="details">
  89. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LineSegmentsGeometry.html#setColors">LineSegmentsGeometry#setColors</a></dt>
  90. </dl>
  91. <dl class="details">
  92. <dt class="tag-returns"><strong>Returns:</strong> A reference to this geometry.</dt>
  93. </dl>
  94. </div>
  95. <h3 class="name name-method" id="setFromPoints" translate="no">.<a href="#setFromPoints">setFromPoints</a><span class="signature">( points : <span class="param-type">Array.&lt;(<a href="Vector3.html">Vector3</a>|<a href="Vector2.html">Vector2</a>)></span> )</span><span class="type-signature"> : <a href="LineGeometry.html">LineGeometry</a></span> </h3>
  96. <div class="method">
  97. <div class="description">
  98. <p>Setups this line segments geometry from the given sequence of points.</p>
  99. </div>
  100. <table class="params">
  101. <tbody>
  102. <tr>
  103. <td class="name">
  104. <strong>points</strong>
  105. </td>
  106. <td class="description last">
  107. <p>An array of points in 2D or 3D space.</p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> A reference to this geometry.</dt>
  114. </dl>
  115. </div>
  116. <h3 class="name name-method" id="setPositions" translate="no">.<a href="#setPositions">setPositions</a><span class="signature">( array : <span class="param-type">Float32Array | Array.&lt;number></span> )</span><span class="type-signature"> : <a href="LineGeometry.html">LineGeometry</a></span> </h3>
  117. <div class="method">
  118. <div class="description">
  119. <p>Sets the given line positions for this geometry.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name">
  125. <strong>array</strong>
  126. </td>
  127. <td class="description last">
  128. <p>The position data to set.</p>
  129. </td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. <dl class="details">
  134. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LineSegmentsGeometry.html#setPositions">LineSegmentsGeometry#setPositions</a></dt>
  135. </dl>
  136. <dl class="details">
  137. <dt class="tag-returns"><strong>Returns:</strong> A reference to this geometry.</dt>
  138. </dl>
  139. </div>
  140. <h2 class="subsection-title">Source</h2>
  141. <p>
  142. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineGeometry.js" translate="no" target="_blank" rel="noopener">examples/jsm/lines/LineGeometry.js</a>
  143. </p>
  144. </article>
  145. </section>
  146. <script src="../scripts/linenumber.js"></script>
  147. <script src="../scripts/page.js"></script>
  148. </body>
  149. </html>
粤ICP备19079148号