User Tools


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
design_guide_3d_primitives [2018/02/12 13:07]
z3dev
design_guide_3d_primitives [2018/04/14 03:12] (current)
z3dev [3D Primitives]
Line 1: Line 1:
 ===== 3D Primitives ===== ===== 3D Primitives =====
  
-Introduction+‘3D’ stands for three (3) dimensional. A 3D primitive is any shape that has three dimensions, which are often called width, depth, and height (or X, Y, Z.) 3D shapes have a known volume if closed. 
 + 
 +{{ :​wiki:​mathisfun-3d.svg?​nolink&​145 |}} 
 + 
 +The mathematical study of 3D shapes and dimensions is called [[https://​simple.m.wikipedia.org/​wiki/​Solid_geometry|solid geometry]].
  
 ==== Resolution of Shapes ==== ==== Resolution of Shapes ====
Line 12: Line 16:
  
 If the ''​resolution''​ option is omitted, the following resolution is used. If the ''​resolution''​ option is omitted, the following resolution is used.
-  * CSG.defaultResolution3D+  * CSG.defaultResolution3D ​= 12
  
 OpenSCAD like functions support the ''​fn''​ parameter, which is the same as ''​resolution''​. OpenSCAD like functions support the ''​fn''​ parameter, which is the same as ''​resolution''​.
Line 18: Line 22:
 {{page>​design_guide_cube}} {{page>​design_guide_cube}}
  
-==== Sphere ====+{{page>​design_guide_sphere}}
  
-Spheres can be created like this: +{{page>​design_guide_cylinder}}
-<code javascript>​ +
-sphere(1);​ +
-sphere({r: 2});                    // Note: center:true is default (unlike other primitives, as OpenSCAD) +
-sphere({r: 2, center: true});     // Note: OpenSCAD doesn'​t support center for sphere but we do +
-sphere({r: 2, center: [false, false, true]}); // individual axis center  +
-sphere({r: 10, fn: 100 }); +
-sphere({r: 10, fn: 100, type: '​geodesic'​});  // geodesic approach (icosahedron further triangulated)+
  
-CSG.sphere({ +{{page>design_guide_torus}}
-  center: [0, 0, 0], +
-  radius: 2,                      // must be scalar +
-  resolution: 128 +
-}); +
-</code>+
  
-In case of ``type: '​geodesic'​`` the fn tries to match the non-geodesic fn, yet, actually changes in steps of 6 (e.g. fn=6..11 is the same), fn = 1 reveals the base form: the icosahedron. +{{page>design_guide_polyhedron}}
- +
-==== Cylinder ==== +
- +
-Cylinders and cones can be created like this: +
- +
-<code javascript>​ +
-cylinder({r:​ 1, h: 10});                 // openscad like +
-cylinder({d:​ 1, h: 10}); +
-cylinder({r:​ 1, h: 10, center: true}); ​  // default: center:​false +
-cylinder({r:​ 1, h: 10, center: [true, true, false]}); ​ // individual x,y,z center flags +
-cylinder({r:​ 1, h: 10, round: true}); +
-cylinder({r1:​ 3, r2: 0, h: 10}); +
-cylinder({d1:​ 1, d2: 0.5, h: 10}); +
-cylinder({start:​ [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn: 50}); +
- +
-CSG.cylinder({ ​                     //using the CSG primitives +
-  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 +
-}); +
-</​code>​ +
- +
-{{page>design_guide_torus}}+