A three dimensional shape with two flat ends that are circular. The cylinder has the same cross-section from one end to the other, extending about the Z axis.
Learn about cylinders at MathIsFun.com
The radius
specifies the circular size about the Z axis, while the height
specifies the size. Cylinders can be created at a requested center
. The segments
specify the number of segments to create per full rotation.
Defaults:
const { cylinder } = require('@jscad/modeling').primitives const myshape = cylinder({radius: 5, height: 10}) const myshape = cylinder({radius: 5, height: 10, center: [5, 5, 5], segments: 64})
Various cylindrical shapes can be created using the elliptical cylinder, including cylinders with changing radius (cones).
Defaults:
const { cylinderElliptic } = require('@jscad/modeling').primitives const myshape = cylinderElliptic({height: 2, startRadius: [10, 5], endRadius: [8, 3]})
Cylinders can be created with rounded ends by specifying roundRadius
.
Defaults:
const { roundedCylinder } = require('@jscad/modeling').primitives const myshape = roundedCylinder({radius: 5, height: 10, roundRadius: 0.5}) const myshape = roundedCylinder({radius: 5, height: 10, roundRadius: 0.5, center: [5, 5, 5], segments: 64})