User Tools


Cylinder

A three dimensional shape with two flat ends that are circular or elliptical. The cylinder has the same cross-section from one end to the other.

 Cylinder

Learn about cylinders at MathIsFun.com

The following show examples of creating cylinders. The radius specifies the size about the axis. The resolution option determines the number of segments to create in 360 degrees of rotation.

If necessary then additional options can be provide for start and end points of the axis. As well as start and end radius.

Note: See the start of 3D Primitives for information about the resolution of three dimensional shapes.

Defaults:

  • radius : 1 or
    • radiusStart : 1
    • radiusEnd : 1
  • axis :
    • start : [0,0,-1], end : [0,0,1]
  • resolution : Resolution3D (12)

Note: A start or end radius of 0 creates a cone.

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
});