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/11 11:30]
z3dev [Sphere]
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''​.
  
-==== Cube ==== +{{page>design_guide_cube}}
- +
-Cubes or rounded cubes are created by specifying one or more radius values. +
- +
-<code javascript>​ +
-cube(1); +
-cube({size: 1}); +
-cube({size: [1,​2,​3]});​ +
-cube({size: 1, center: true}); // default center:​false +
-cube({size: 1, center: [false,​false,​false]});​ // individual axis center true or false +
-cube({size: [1,2,3], round: true}); +
-</code> +
- +
-Also, using CSG library directly is possible. TO BE DECOMMISSIONED +
- +
-<code javascript>​ +
-CSG.cube({ +
-    center: [0, 0, 0], +
-    radius: [1, 1, 1] +
-}); +
- +
-CSG.cube({ // define two opposite corners +
-    corner1: [4, 4, 4], +
-    corner2: [5, 4, 2] +
-}); +
- +
-CSG.roundedCube({ // rounded cube +
-    center: [0, 0, 0], +
-    radius: 1, +
-    roundradius:​ 0.9, +
-    resolution: 8, +
-}); +
-</​code>​+
  
-==== 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}}