meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:design_guide_cylinder [2020/11/28 02:17]
JSCAD Editor created
en:design_guide_cylinder [2022/04/13 06:54] (current)
rozek included "require" statements
Line 1: Line 1:
 ==== Cylinder ==== ==== 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.+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.
  
-{{ :wiki:mathisfun-cylinder.svg | Cylinder}}+{{ :wiki:mathisfun-cylinder.svg?nolink | Cylinder}}
  
 //[[http://www.mathsisfun.com/geometry/cylinder.html|Learn about cylinders at MathIsFun.com]]// //[[http://www.mathsisfun.com/geometry/cylinder.html|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.+The ''radius'' specifies the circular size about the 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. 
  
-If necessary then additional options can be provide for start and end points of the axis. As well as start and end radius.+Defaults: 
 +  * radius : 1 
 +  * height : 2 
 +  * center : [0, 0, 0] 
 +  * segments : 32
  
-//Note: See the start of 3D Primitives for information about the resolution of three dimensional shapes.//+<code javascript> 
 +const { cylinder } = require('@jscad/modeling').primitives
  
-Defaults: +const myshape = cylinder({radius: 5, height10}) 
-  * radius : 1 or +const myshape = cylinder({radius5, height10, center: [555], segments64}) 
-    * radiusStart 1 +</code>
-    * radiusEnd +
-  * axis : +
-    * start : [0,0,-1], end [0,0,1] +
-  * resolution : Resolution3D (12)+
  
-//NoteA start or end radius of 0 creates a cone.//+ 
 +=== Elliptical Cylinder === 
 + 
 +{{ :wiki:jscad-cylinderElliptic.png?nolink | 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
  
 <code javascript> <code javascript>
-cylinder({r: 1, h: 10}+const cylinderElliptic = require('@jscad/modeling').primitives 
-cylinder({r: 1, h: 10, center: true})   // default: center:false + 
-cylinder({r: 1, h: 10, center: [true, true, false]}+const myshape = cylinderElliptic({height2startRadius[10, 5], endRadius: [83]})
-cylinder({r: 1, h: 10, round: true}) +
-cylinder({r13r2: 0, h: 10}) +
-cylinder({start: [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn: 50})+
 </code> </code>
  
-The CSG library functions can also be used. //NOTE: Deprecated in the V2 API//+=== Rounded Cylinder ===
  
-<code javascript> +{:wiki:jscad-roundedCylinder.png?nolink | Rounded Cylinder}}
-CSG.cylinder({ +
-  start[0, -1, 0], +
-  end[0, 1, 0], +
-  radius: 1,                        // true cylinder +
-  resolution: 16 +
-});+
  
-CSG.cylinder({ +Cylinders can be created with rounded ends by specifying ''roundRadius''. 
-  start[0, -10], + 
-  end: [0, 1, 0], +Defaults: 
-  radiusStart1,                   // start- and end radius defined, partial cones +  * radius : 1 
-  radiusEnd: 2, +  * height : 2 
-  resolution: 16 +  * roundRadius: 0.5 
-});+  * center : [0, 0, 0] 
 +  * segments 32 
 + 
 +<code javascript> 
 +const { roundedCylinder = require('@jscad/modeling').primitives
  
-CSG.roundedCylinder({               // and its rounded version +const myshape = roundedCylinder({radius: 5, height: 10, roundRadius: 0.5}) 
-  start[0, -1, 0], +const myshape = roundedCylinder({radius: 5height: 10roundRadius: 0.5center: [555], segments64})
-  end: [010], +
-  radius1, +
-  resolution: 16 +
-});+
 </code> </code>