ArrowHelper.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">用于模拟方向的3维箭头对象.</p>
  13. <h2>代码示例</h2>
  14. <code>
  15. const dir = new THREE.Vector3( 1, 2, 0 );
  16. //normalize the direction vector (convert to vector of length 1)
  17. dir.normalize();
  18. const origin = new THREE.Vector3( 0, 0, 0 );
  19. const length = 1;
  20. const hex = 0xffff00;
  21. const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
  22. scene.add( arrowHelper );
  23. </code>
  24. <h2>例子</h2>
  25. <p>
  26. [example:webgl_shadowmesh WebGL / shadowmesh]
  27. </p>
  28. <h2>构造函数</h2>
  29. <h3>[name]([param:Vector3 dir], [param:Vector3 origin], [param:Number length], [param:Number hex], [param:Number headLength], [param:Number headWidth] )</h3>
  30. <p>
  31. [page:Vector3 dir] -- 基于箭头原点的方向. 必须为单位向量. <br />
  32. [page:Vector3 origin] -- 箭头的原点.<br />
  33. [page:Number length] -- 箭头的长度. 默认为 *1*.<br />
  34. [page:Number hex] -- 定义的16进制颜色值. 默认为 0xffff00.<br />
  35. [page:Number headLength] -- 箭头头部(锥体)的长度. 默认为箭头长度的0.2倍(0.2 * length).<br />
  36. [page:Number headWidth] -- The width of the head of the arrow. Default is 0.2 * headLength.<br />
  37. </p>
  38. <h2>属性</h2>
  39. <p>请到基类 [page:Object3D] 页面查看公共属性.</p>
  40. <h3>[property:Line line]</h3>
  41. <p>包含箭头辅助对象的线段部分.</p>
  42. <h3>[property:Mesh cone]</h3>
  43. <p>包含箭头辅助对象的锥体部分.</p>
  44. <h2>方法</h2>
  45. <p>请到基类 [page:Object3D] 页面查看公共方法.</p>
  46. <h3>[method:undefined setColor]([param:Color color])</h3>
  47. <p>
  48. color -- 所需的颜色。<br /><br />
  49. 设置箭头辅助对象的颜色.
  50. </p>
  51. <h3>[method:undefined setLength]([param:Number length], [param:Number headLength], [param:Number headWidth])</h3>
  52. <p>
  53. length -- 要设置的长度.<br />
  54. headLength -- 要设置的箭头头部(锥体)的长度.<br />
  55. headWidth -- The width of the head of the arrow.<br /><br />
  56. 设置箭头辅助对象的长度.
  57. </p>
  58. <h3>[method:undefined setDirection]([param:Vector3 dir])</h3>
  59. <p>
  60. dir -- 要设置的方向. 必须为单位向量.<br /><br />
  61. 设置箭头辅助对象的方向.
  62. </p>
  63. <h2>源码</h2>
  64. <p>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </p>
  67. </body>
  68. </html>