TubeGeometry.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Geometry] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">Creates a tube that extrudes along a 3d curve</div>
  14. <h2>Example</h2>
  15. <code>
  16. var CustomSinCurve = THREE.Curve.create(
  17. function ( scale ) { //custom curve constructor
  18. this.scale = (scale === undefined) ? 1 : scale;
  19. },
  20. function ( t ) { //getPoint: t is between 0-1
  21. var tx = t * 3 - 1.5,
  22. ty = Math.sin( 2 * Math.PI * t ),
  23. tz = 0;
  24. return new THREE.Vector3(tx, ty, tz).multiplyScalar(this.scale);
  25. }
  26. );
  27. var path = new CustomSinCurve( 10 );
  28. var geometry = new THREE.TubeGeometry(
  29. path, //path
  30. 20, //segments
  31. 2, //radius
  32. 8, //radiusSegments
  33. false //closed
  34. );
  35. </code>
  36. <h2>Constructor</h2>
  37. <h3>[name]([page:Curve path], [page:Integer segments], [page:Float radius], [page:Integer radiusSegments], [page:Boolean closed])</h3>
  38. <div>
  39. path — [page:Curve] - A path that inherits from the [page:Curve] base class<br />
  40. segments — [page:Integer] - The number of segments that make up the tube, default is 64<br />
  41. radius — [page:Float] - The radius of the tube, default is 1<br />
  42. radiusSegments — [page:Integer] - The number of segments that make up the cross-section, default is 8 <br />
  43. closed — [page:Boolean] Is the tube open or closed, default is false <br />
  44. </div>
  45. <h2>Properties</h2>
  46. <h3>[property:Object parameters]</h3>
  47. <div>
  48. An object with all of the parameters that were used to generate the geometry.
  49. </div>
  50. <h3>[property:Array tangents]</h3>
  51. <div>
  52. An array of [page:Vector3] tangents
  53. </div>
  54. <h3>[property:Array normals]</h3>
  55. <div>
  56. An array of [page:Vector3] normals
  57. </div>
  58. <h3>[property:Array binormals]</h3>
  59. <div>
  60. An array of [page:Vector3] binormals
  61. </div>
  62. <h2>Methods</h2>
  63. <h3>THREE.TubeGeometry.FrenetFrames([page:Curve path], [page:Integer segments], [page:Boolean closed])</h3>
  64. <div>
  65. path — A path that inherits from the [page:Curve] base class <br />
  66. segments — The number of segments that make up the tube <br />
  67. closed — Is the tube open or closed
  68. </div>
  69. <div>
  70. A static method that generates the Frenet Frames. This is internally run on any new TubeGeometry and then the
  71. generated tangents, normals, and binormals are exposed as properties on the TubeGeometry object.
  72. </div>
  73. <h2>Source</h2>
  74. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  75. </body>
  76. </html>