Three.js Lathe & Sweep Surfaces
Revolve spline profiles into vases, goblets, chess pawns and bells with LatheGeometry, or sweep star, gear and flower cross-sections along 3D paths with twist and taper using Frenet frames.
Key topics: three.js lathe, lathegeometry, sweep surface, frenet frames, extrude along path, procedural modeling
Game Over
What this code does
- Lathe: a smoothed `SplineCurve` profile in (radius, height) is revolved around Y by `LatheGeometry`.
- Partial Revolve: a revolve angle under 360° opens the solid to show its wall thickness.
- Sweep: a custom generator places a 2D cross-section at each `computeFrenetFrames` sample along the path.
- Twist & Taper: the section rotates and scales along the curve, like extruded pasta or a drill bit.
- Closed Paths: for the trefoil knot the frames and indices wrap, giving a seamless loop.
- Controls: mode, profile, radial segments, revolve angle, path, cross-section, radius, twist, taper and segments.
Related Demos
Continue Learning
JavaScript Implementation
// Lathe: revolve a 2D profile around the Y axis
const profile = new THREE.SplineCurve([
new THREE.Vector2(0, 0), new THREE.Vector2(0.9, 0.05), new THREE.Vector2(1.1, 0.5),
new THREE.Vector2(0.8, 1.4), new THREE.Vector2(0.45, 2.1), new THREE.Vector2(0.7, 2.7)
]).getPoints(100)
scene.add(new THREE.Mesh(new THREE.LatheGeometry(profile, 64), new THREE.MeshStandardMaterial({ color: 0xc084fc, side: THREE.DoubleSide })))
// Sweep: move a cross-section along a curve using Frenet frames
const curve = new THREE.CatmullRomCurve3(Array.from({ length: 50 }, (_, i) => new THREE.Vector3(Math.cos(i * 0.4), i * 0.06, Math.sin(i * 0.4))))
const frames = curve.computeFrenetFrames(200)
// vertex = curve.getPointAt(t) + N * (x * r) + B * (y * r) for each section point (x, y)