meta data for this page
  •  

This is an old revision of the document!


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.


Learn about cylinders at MathIsFun.com

The 'radius' specifies the size about the center axis. The resolution option determines the number of segments to create in 360 degrees of rotation.

Defaults:

  • radius : 1
  • height : 2
  • center : [0, 0, 0]
  • segments : 32
cylinder({r: 1, h: 10})
cylinder({r: 1, h: 10, center: true})   // default: center:false
cylinder({r: 1, h: 10, center: [true, true, false]})
cylinder({r: 1, h: 10, round: true})
cylinder({r1: 3, r2: 0, h: 10})
cylinder({start: [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn: 50})

The CSG library functions can also be used. NOTE: Deprecated in the V2 API

CSG.cylinder({
  start: [0, -1, 0],
  end: [0, 1, 0],
  radius: 1,                        // true cylinder
  resolution: 16
});
 
CSG.cylinder({
  start: [0, -1, 0],
  end: [0, 1, 0],
  radiusStart: 1,                   // start- and end radius defined, partial cones
  radiusEnd: 2,
  resolution: 16
});
 
CSG.roundedCylinder({               // and its rounded version
  start: [0, -1, 0],
  end: [0, 1, 0],
  radius: 1,
  resolution: 16
});