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_cuboid [2020/11/28 02:14]
JSCAD Editor
en:design_guide_cuboid [2022/04/12 08:07] (current)
rozek
Line 1: Line 1:
 ==== Cuboid ==== ==== Cuboid ====
  
-A three dimensional shape created from six retangular faces, each at right angles to another, and opposite faces are equal. The **cube** is a special case of the a cuboid in which all six faces are squares.+A three dimensional shape created from six retangular faces, each at right angles to another, and opposite faces are equal.
  
-{{ :wiki:mathisfun-cuboid.svg | Cuboid}}+{{ :wiki:mathisfun-cuboid.svg?nolink | Cuboid}}
  
 //[[http://www.mathsisfun.com/geometry/cuboids-rectangular-prisms.html|Learn about cuboids at MathIsFun.com]]// //[[http://www.mathsisfun.com/geometry/cuboids-rectangular-prisms.html|Learn about cuboids at MathIsFun.com]]//
  
-Cubes can be created at a requested center.  The radius specifies the size of the faces. Cubes with different radius for X, Y and Z axis can be specified by supplying an array of values.+The ''size'' specifies the size of each face spanning X, Y and Z axis. Cuboids can be created at a requested ''center''.
  
 Defaults: Defaults:
-  * size : 1 or [1,1,1+  * size : [222
-  * center : [0,0,0] +  * center : [0, 0, 0]
-  * radius : 0 +
-  * round: false+
  
 <code javascript> <code javascript>
-cube({size: 1}) +const cuboid = require('@jscad/modeling').primitives 
-cube({size: [1,2,3]}) + 
-cube({size: 1, center: true}) // default center:false +const myshape = cuboid({size: [1, 2, 3]}) 
-cube({size: 1center: [false,false,false]}) // individual axis center true or false +const myshape = cuboid({size: [1, 23], center: [456]})
-cube({size: [1,2,3], round: true})+
 </code> </code>
  
-Also, the CSG library functions can be used directly//NOTE Deprecated in the V2 API//+=== Cube === 
 + 
 +{{ :wiki:jscad-cube.png?nolink | Cube}} 
 + 
 +The **cube** is a special case of the cuboid in which all six faces are squares. 
 + 
 +Defaults: 
 +  * size : 2 
 +  * center : [0, 0, 0]
  
 <code javascript> <code javascript>
-CSG.cube({ +const cube = require('@jscad/modeling').primitives
-    center: [0, 0, 0], +
-    radius: [1, 1, 1] +
-})+
  
-CSG.cube({ // define two opposite corners +const myshape = cube({size: 3}) 
-    corner1: [4, 4, 4], +const myshape = cube({size: 3, center: [4, 5, 6]})
-    corner2: [5, 4, 2] +
-})+
 </code> </code>
  
-Rounded cubes are created by specifying a rounded radius for the corners and the sides.+=== Rounded Cuboid === 
 + 
 +{{ :wiki:jscad-roundedCuboid.png?nolink | Rounded Cuboid}} 
 + 
 +Rounded cuboids can be created by specifying a ''roundRadius'' for the corners. 
 + 
 +Defaults: 
 +  * size : [2, 2, 2] 
 +  * center : [0, 0, 0] 
 +  * roundRadius : 0.2 
 +  * segments : 32
  
 <code javascript> <code javascript>
-CSG.roundedCube({ // rounded cube +const roundedCuboid } = require('@jscad/modeling').primitives 
-    center: [000], + 
-    radius: 1, +const myshape = roundedCuboid({size: [123], roundRadius: 0.25}) 
-    roundradius: 0.9, +const myshape = roundedCuboid({size[1, 2, 3], roundRadius: 0.25center[45, 6], segments: 32})
-    resolution8, +
-});+
 </code> </code>