[page:Geometry] →

[name]

Creates a tube that extrudes along a 3d curve.

Example

function CustomSinCurve( scale ) { THREE.Curve.call( this ); this.scale = ( scale === undefined ) ? 1 : scale; } CustomSinCurve.prototype = Object.create( THREE.Curve.prototype ); CustomSinCurve.prototype.constructor = CustomSinCurve; CustomSinCurve.prototype.getPoint = function ( t ) { var tx = t * 3 - 1.5; var ty = Math.sin( 2 * Math.PI * t ); var tz = 0; return new THREE.Vector3( tx, ty, tz ).multiplyScalar( this.scale ); }; var path = new CustomSinCurve( 10 ); var geometry = new THREE.TubeGeometry( path, 20, 2, 8, false ); var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); var mesh = new THREE.Mesh( geometry, material ); scene.add( mesh );

Constructor

[name]([param:Curve path], [param:Integer tubularSegments], [param:Float radius], [param:Integer radialSegments], [param:Boolean closed])

path — [page:Curve] - A path that inherits from the [page:Curve] base class
tubularSegments — [page:Integer] - The number of segments that make up the tube, default is 64
radius — [page:Float] - The radius of the tube, default is 1
radialSegments — [page:Integer] - The number of segments that make up the cross-section, default is 8
closed — [page:Boolean] Is the tube open or closed, default is false

Properties

See the base [page:Geometry] class for common properties.

[property:Object parameters]

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

[property:Array tangents]

An array of [page:Vector3] tangents

[property:Array normals]

An array of [page:Vector3] normals

[property:Array binormals]

An array of [page:Vector3] binormals

Methods

See the base [page:Geometry] class for common methods.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]