ArrowHelper.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ArrowHelper - 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="Object3D.html">Object3D</a> → </p>
  13. <h1 translate="no">ArrowHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>An 3D arrow object for visualizing directions.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const dir = new THREE.Vector3( 1, 2, 0 );
  19. //normalize the direction vector (convert to vector of length 1)
  20. dir.normalize();
  21. const origin = new THREE.Vector3( 0, 0, 0 );
  22. const length = 1;
  23. const hex = 0xffff00;
  24. const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
  25. scene.add( arrowHelper );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="ArrowHelper" translate="no">new <a href="#ArrowHelper">ArrowHelper</a><span class="signature">( dir : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, origin : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, length : <span class="param-type">number</span>, color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span>, headLength : <span class="param-type">number</span>, headWidth : <span class="param-type">number</span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new arrow helper.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name">
  40. <strong>dir</strong>
  41. </td>
  42. <td class="description last">
  43. <p>The (normalized) direction vector.</p>
  44. <p>Default is <code>(0, 0, 1)</code>.</p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="name">
  49. <strong>origin</strong>
  50. </td>
  51. <td class="description last">
  52. <p>Point at which the arrow starts.</p>
  53. <p>Default is <code>(0, 0, 0)</code>.</p>
  54. </td>
  55. </tr>
  56. <tr>
  57. <td class="name">
  58. <strong>length</strong>
  59. </td>
  60. <td class="description last">
  61. <p>Length of the arrow in world units.</p>
  62. <p>Default is <code>1</code>.</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="name">
  67. <strong>color</strong>
  68. </td>
  69. <td class="description last">
  70. <p>Color of the arrow.</p>
  71. <p>Default is <code>0xffff00</code>.</p>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td class="name">
  76. <strong>headLength</strong>
  77. </td>
  78. <td class="description last">
  79. <p>The length of the head of the arrow.</p>
  80. <p>Default is <code>length*0.2</code>.</p>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td class="name">
  85. <strong>headWidth</strong>
  86. </td>
  87. <td class="description last">
  88. <p>The width of the head of the arrow.</p>
  89. <p>Default is <code>headLength*0.2</code>.</p>
  90. </td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. </div>
  95. </div>
  96. <h2 class="subsection-title">Properties</h2>
  97. <div class="member">
  98. <h3 class="name" id="cone" translate="no">.<a href="#cone">cone</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  99. <div class="description">
  100. <p>The cone part of the arrow helper.</p>
  101. </div>
  102. </div>
  103. <div class="member">
  104. <h3 class="name" id="line" translate="no">.<a href="#line">line</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
  105. <div class="description">
  106. <p>The line part of the arrow helper.</p>
  107. </div>
  108. </div>
  109. <h2 class="subsection-title">Methods</h2>
  110. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  111. <div class="method">
  112. <div class="description">
  113. <p>Frees the GPU-related resources allocated by this instance. Call this
  114. method whenever this instance is no longer used in your app.</p>
  115. </div>
  116. </div>
  117. <h3 class="name name-method" id="setColor" translate="no">.<a href="#setColor">setColor</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
  118. <div class="method">
  119. <div class="description">
  120. <p>Sets the color of the helper.</p>
  121. </div>
  122. <table class="params">
  123. <tbody>
  124. <tr>
  125. <td class="name">
  126. <strong>color</strong>
  127. </td>
  128. <td class="description last">
  129. <p>The color to set.</p>
  130. </td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. </div>
  135. <h3 class="name name-method" id="setDirection" translate="no">.<a href="#setDirection">setDirection</a><span class="signature">( dir : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
  136. <div class="method">
  137. <div class="description">
  138. <p>Sets the direction of the helper.</p>
  139. </div>
  140. <table class="params">
  141. <tbody>
  142. <tr>
  143. <td class="name">
  144. <strong>dir</strong>
  145. </td>
  146. <td class="description last">
  147. <p>The normalized direction vector.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. </div>
  153. <h3 class="name name-method" id="setLength" translate="no">.<a href="#setLength">setLength</a><span class="signature">( length : <span class="param-type">number</span>, headLength : <span class="param-type">number</span>, headWidth : <span class="param-type">number</span> )</span> </h3>
  154. <div class="method">
  155. <div class="description">
  156. <p>Sets the length of the helper.</p>
  157. </div>
  158. <table class="params">
  159. <tbody>
  160. <tr>
  161. <td class="name">
  162. <strong>length</strong>
  163. </td>
  164. <td class="description last">
  165. <p>Length of the arrow in world units.</p>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td class="name">
  170. <strong>headLength</strong>
  171. </td>
  172. <td class="description last">
  173. <p>The length of the head of the arrow.</p>
  174. <p>Default is <code>length*0.2</code>.</p>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="name">
  179. <strong>headWidth</strong>
  180. </td>
  181. <td class="description last">
  182. <p>The width of the head of the arrow.</p>
  183. <p>Default is <code>headLength*0.2</code>.</p>
  184. </td>
  185. </tr>
  186. </tbody>
  187. </table>
  188. </div>
  189. <h2 class="subsection-title">Source</h2>
  190. <p>
  191. <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/ArrowHelper.js" translate="no" target="_blank" rel="noopener">src/helpers/ArrowHelper.js</a>
  192. </p>
  193. </article>
  194. </section>
  195. <script src="../scripts/linenumber.js"></script>
  196. <script src="../scripts/page.js"></script>
  197. </body>
  198. </html>
粤ICP备19079148号