sources.cylinder
A closed faceted cylinder along Y: two flat polygon caps and side quads, with a hard rim and persistent ids.
Usage
Sources.cylinder(params?: SourceCylinderParams): Result<Geometry>Parameters
params.radiusnumberDistance from the axis to every rim point. Default
0.5. In model.params.heightnumberLength along y, from −height/2 to +height/2. Default
1. In model.params.segmentsnumberSide quads around the axis; an integer. Default
16. Range [3, 1024] count.params.addIdsbooleanAccepted for hosts that send it; point and face ids (id, idFrom, primId, primIdFrom) are always written, whatever its value. Default
true.params.scopestringThe host’s node id; ids are minted under it. Default
undefined (index ids, minter 0).
Returns
Ok with polygon geometry of 2 · segments points (the top rim, then the bottom rim) and segments + 2 faces (the top cap, the bottom cap, then one quad per segment); N (Float32 ×3) per corner, axial on the caps and radial on the side.
Errors
Guarantees
- volume equals (segments / 2) · radius² · sin(2π / segments) · height, the prism’s
- closed
- the same parameters give the same bytes (geometryContentHash), natively and in WASM
- The same result on every machine.
Example
const r = Sources.cylinder({ radius: 0.5, height: 2, segments: 32 })
r.ok || r.diagnostics[0].code // → 64 points and 34 faces once loadGeometryKernel() has run