ArrowHelper.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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">Vector3</span>, origin : <span class="param-type">Vector3</span>, length : <span class="param-type">number</span>, color : <span class="param-type">number | Color | 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"><code>dir</code></td>
  40. <td class="description last"><p>The (normalized) direction vector.<br/>Default is <code>(0, 0, 1)</code>.</p></td>
  41. </tr>
  42. <tr>
  43. <td class="name"><code>origin</code></td>
  44. <td class="description last"><p>Point at which the arrow starts.<br/>Default is <code>(0, 0, 0)</code>.</p></td>
  45. </tr>
  46. <tr>
  47. <td class="name"><code>length</code></td>
  48. <td class="description last"><p>Length of the arrow in world units.<br/>Default is <code>1</code>.</p></td>
  49. </tr>
  50. <tr>
  51. <td class="name"><code>color</code></td>
  52. <td class="description last"><p>Color of the arrow.<br/>Default is <code>0xffff00</code>.</p></td>
  53. </tr>
  54. <tr>
  55. <td class="name"><code>headLength</code></td>
  56. <td class="description last"><p>The length of the head of the arrow.<br/>Default is <code>length*0.2</code>.</p></td>
  57. </tr>
  58. <tr>
  59. <td class="name"><code>headWidth</code></td>
  60. <td class="description last"><p>The width of the head of the arrow.<br/>Default is <code>headLength*0.2</code>.</p></td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. </div>
  66. <h2 class="subsection-title">Properties</h2>
  67. <div class="member">
  68. <h3 class="name" id="cone" translate="no">.<a href="#cone">cone</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  69. <div class="description">
  70. <p>The cone part of the arrow helper.</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="line" translate="no">.<a href="#line">line</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
  75. <div class="description">
  76. <p>The line part of the arrow helper.</p>
  77. </div>
  78. </div>
  79. <h2 class="subsection-title">Methods</h2>
  80. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  81. <div class="method">
  82. <div class="description">
  83. <p>Frees the GPU-related resources allocated by this instance. Call this
  84. method whenever this instance is no longer used in your app.</p>
  85. </div>
  86. </div>
  87. <h3 class="name name-method" id="setColor" translate="no">.<a href="#setColor">setColor</a><span class="signature">( color : <span class="param-type">number | Color | string</span> )</span> </h3>
  88. <div class="method">
  89. <div class="description">
  90. <p>Sets the color of the helper.</p>
  91. </div>
  92. <table class="params">
  93. <tbody>
  94. <tr>
  95. <td class="name"><code>color</code></td>
  96. <td class="description last"><p>The color to set.</p></td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. </div>
  101. <h3 class="name name-method" id="setDirection" translate="no">.<a href="#setDirection">setDirection</a><span class="signature">( dir : <span class="param-type">Vector3</span> )</span> </h3>
  102. <div class="method">
  103. <div class="description">
  104. <p>Sets the direction of the helper.</p>
  105. </div>
  106. <table class="params">
  107. <tbody>
  108. <tr>
  109. <td class="name"><code>dir</code></td>
  110. <td class="description last"><p>The normalized direction vector.</p></td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. <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>
  116. <div class="method">
  117. <div class="description">
  118. <p>Sets the length of the helper.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name"><code>length</code></td>
  124. <td class="description last"><p>Length of the arrow in world units.</p></td>
  125. </tr>
  126. <tr>
  127. <td class="name"><code>headLength</code></td>
  128. <td class="description last"><p>The length of the head of the arrow.<br/>Default is <code>length*0.2</code>.</p></td>
  129. </tr>
  130. <tr>
  131. <td class="name"><code>headWidth</code></td>
  132. <td class="description last"><p>The width of the head of the arrow.<br/>Default is <code>headLength*0.2</code>.</p></td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. </div>
  137. <h2 class="subsection-title">Source</h2>
  138. <p>
  139. <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/ArrowHelper.js" target="_blank" rel="noopener" translate="no">src/helpers/ArrowHelper.js</a>
  140. </p>
  141. </article>
  142. </section>
  143. <script src="../scripts/linenumber.js"></script>
  144. <script src="../scripts/page.js"></script>
  145. </body>
  146. </html>
粤ICP备19079148号