meta data for this page
  •  

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:design_guide_cylinder [2020/11/29 06:00]
JSCAD Editor
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. 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?nolink | Cylinder}} {{ :wiki:mathisfun-cylinder.svg?nolink | Cylinder}}
Line 7: Line 7:
 //[[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 'radius' specifies the circular size about the Z axis, while the 'height' specifies the size. The 'segments' specify the number of segments to create per full rotation. +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: Defaults:
Line 16: Line 16:
  
 <code javascript> <code javascript>
-cylinder({r: 1, h: 10}+const { cylinder } = 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 = cylinder({radius5height: 10}) 
-cylinder({r1h: 10, round: true}) +const myshape = cylinder({radius5height: 10, center: [555], segments64})
-cylinder({r13r2: 0, h: 10}) +
-cylinder({start: [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn50})+
 </code> </code>
  
-The CSG library functions can also be used//NOTEDeprecated in the V2 API//+ 
 +=== 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>
-CSG.cylinder(+const { cylinderElliptic } = require('@jscad/modeling').primitives
-  start: [0, -1, 0], +
-  end: [0, 1, 0], +
-  radius: 1,                        // true cylinder +
-  resolution: 16 +
-});+
  
-CSG.cylinder({ +const myshape = cylinderElliptic({height: 2, startRadius: [105], endRadius: [83]}) 
-  start: [0, -10], +</code> 
-  end: [01, 0], + 
-  radiusStart: 1,                   // startand end radius defined, partial cones +=== Rounded Cylinder === 
-  radiusEnd: 2, + 
-  resolution16 +{{ :wiki:jscad-roundedCylinder.png?nolink | Rounded Cylinder}} 
-});+ 
 +Cylinders can be created with rounded ends by specifying ''roundRadius''
 + 
 +Defaults: 
 +  * radius : 1 
 +  * height : 2 
 +  * roundRadius: 0.5 
 +  * center : [00, 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>