TubeGeometry - Verge3D User Manual - Soft8Soft
Description: Learn how to use TubeGeometry in your interactive 3D apps made with Verge3D

BufferGeometry →

# TubeGeometry

Creates a tube that extrudes along a 3D curve.

## Code Example

`class CustomSinCurve extends v3d.Curve { constructor(scale = 1) { super(); this.scale = scale; } getPoint(t, optionalTarget = new v3d.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 v3d.TubeGeometry(path, 20, 2, 8, false); const material = new v3d.MeshStandardMaterial({ color: 0x00ff00 }); const mesh = new v3d.Mesh(geometry, material); app.scene.add(mesh);`

## Constructor

### TubeGeometry(path : Curve, tubularSegments : Integer, radius : Float, radialSegments : Integer, closed : Boolean)

- path — a 3D path that inherits from the Curve base class. Default is a quadratic bezier curve.
- tubularSegments — the number of segments that make up the tube. Default is `64`.
- radius — the radius of the tube. Default is `1`.
- radialSegments — the number of segments that make up the cross-section. Default is `8`.
- closed — is the tube open or closed. Default is `false`.

Procedural geometry is fun. However, in real life applications this feature is rarely needed. It would be more efficient do design tubes in the preferred modelling suite and export/load to Verge3D via glTF.

## Properties

See the base BufferGeometry class for inherited properties.

### # .parameters : Object

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

### # .tangents : Array

An array of Vector3 tangents.

### # .normals : Array

An array of Vector3 normals.

### # .binormals : Array

An array of Vector3 binormals.

## Methods

See the base BufferGeometry class for inherited methods.

## Source

For more info on how to obtain the source code of this module see this page.