TubeGeometry
Creates a tube that extrudes along a 3d curve.
Code Example
class CustomSinCurve extends THREE.Curve { constructor( scale = 1 ) { super();
this.scale = scale; } getPoint( t, optionalTarget = new THREE.Vector3() ) {
const tx = t * 3 - 1.5; const ty = Math.sin( 2 * Math.PI * t ); const tz = 0;
return optionalTarget.set( tx, ty, tz ).multiplyScalar( this.scale ); } }
const path = new CustomSinCurve( 10 ); const geometry = new
THREE.TubeGeometry( path, 20, 2, 8, false ); const material = new
THREE.MeshBasicMaterial( { color: 0x00ff00 } ); const mesh = new THREE.Mesh(
geometry, material ); scene.add( mesh );
Constructor
TubeGeometry
function TubeGeometry( path: Curve, tubularSegments: Integer, radius: Float,
radialSegments: Integer, closed: Boolean ): void;
path — Curve - A 3D path that inherits from the
Curve base class. Default is a quadratic bezier
curve.
tubularSegments — Integer - The number of segments that make up the tube.
Default is 64.
radius — Float - The radius of the tube. Default is 1.
radialSegments — Integer - The number of segments that make up the cross-
section. Default is 8.
closed — Boolean Is the tube open or closed. Default is false.
Properties
See the base BufferGeometry class for common properties.
parameters
parameters: Object;
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
tangents
tangents: Array;
An array of Vector3 tangents
normals
normals: Array;
An array of Vector3 normals
binormals
binormals: Array;
An array of Vector3 binormals
Methods
See the base BufferGeometry class for common methods.