mesh.cylinder
A closed faceted cylinder standing on a plane: side quads and two flat polygon caps.
Usage
Mesh.cylinder(radius: number, height: number, segments?: number, plane?: Plane): Result<Mesh>Parameters
radiusnumberDistance from the axis to every side point (the circumradius of the caps). Required. In model.
heightnumberLength along the plane’s normal. Required. In model.
segmentsnumberSide faces around the axis; an integer. Default
32. Range [3, 256] count.planePlaneThe base: centred on its origin, the axis along its normal. Default
Plane.worldXY. In model.
Returns
Ok with a closed, edge-manifold, outward mesh of 2 · segments points and segments + 2 faces.
Errors
Guarantees
- validate() succeeds
- volume() equals (segments / 2) · radius² · sin(2π / segments) · height, the prism’s exact volume, which tends to π · radius² · height
- The same result on every machine.
Example
const r = Mesh.cylinder(1, 2, 64)
r.ok && r.value.faceCount // → 66