HexCoord[] path, e.g. from findPath().
The same HexLayout used for rendering.
Any object with a getElevation(col, row) method.
Control-point samples between each pair of cells. Default 8.
const pts = smoothPath(path, layout, map);
const positions = new Float32Array(pts.length * 3);
pts.forEach((p, i) => {
positions[i * 3] = p.x;
positions[i * 3 + 1] = p.y + 0.15; // float above terrain
positions[i * 3 + 2] = p.z;
});
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(positions, 3));
const line = new THREE.Line(geo, new THREE.LineBasicMaterial({ color: 0xffaa22 }));
Converts a hex cell path into a dense array of world-space points following a smooth Catmull-Rom spline through the cell centres.
Use this to draw a curved path preview line instead of straight segments between cell centres. The returned points include the Y elevation of each cell so the curve follows the terrain surface.
Pass the result directly to a
THREE.BufferGeometrypositionattribute to render aTHREE.Line, or feed it into your own tube/ribbon builder.