meta data for this page
  •  

Cylinder

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:

  • radius : 1
  • height : 2
  • center : [0, 0, 0]
  • segments : 32
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})

Elliptical Cylinder

 Cylinder Elliptic

Various cylindrical shapes can be created using the elliptical cylinder, including cylinders with changing radius (cones).

Defaults:

  • height : 2
  • startRadius : [1, 1]
  • endRadius : [1, 1]
  • center : [0, 0, 0]
  • segments : 32
  • startAngle : 0
  • endAngle : PI * 2
const { cylinderElliptic } = require('@jscad/modeling').primitives
 
const myshape = cylinderElliptic({height: 2, startRadius: [10, 5], endRadius: [8, 3]})

Rounded Cylinder

 Rounded Cylinder

Cylinders can be created with rounded ends by specifying roundRadius.

Defaults:

  • radius : 1
  • height : 2
  • roundRadius: 0.5
  • center : [0, 0, 0]
  • segments : 32
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})