Creates a tube that extrudes along a 3D curve.
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);
64.1.8.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.
See the base BufferGeometry class for common properties.
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
An array of Vector3 tangents.
An array of Vector3 normals.
An array of Vector3 binormals.
See the base BufferGeometry class for common methods.
For more info on how to obtain the source code of this module see this page.