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/12/02 23:32]
JSCAD Editor
en:design_guide_cuboid [2022/04/12 08:07] (current)
rozek
Line 3: Line 3:
 A three dimensional shape created from six retangular faces, each at right angles to another, and opposite faces are equal. 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]]//
  
-The ''size'' specifies the size of each face. Cuboids with different ''radius'' for X, Y and Z axis can be specified by supplying an array of values. Cuboids can be created at a requested ''center''.+The ''size'' specifies the size of each face spanning X, Y and Z axis. Cuboids can be created at a requested ''center''.
  
 Defaults: Defaults:
Line 14: Line 14:
  
 <code javascript> <code javascript>
 +const { cuboid } = require('@jscad/modeling').primitives
 +
 const myshape = cuboid({size: [1, 2, 3]}) const myshape = cuboid({size: [1, 2, 3]})
 const myshape = cuboid({size: [1, 2, 3], center: [4, 5, 6]}) const myshape = cuboid({size: [1, 2, 3], center: [4, 5, 6]})
Line 19: Line 21:
  
 === Cube === === Cube ===
 +
 +{{ :wiki:jscad-cube.png?nolink | Cube}}
  
 The **cube** is a special case of the cuboid in which all six faces are squares. The **cube** is a special case of the cuboid in which all six faces are squares.
Line 27: Line 31:
  
 <code javascript> <code javascript>
 +const { cube } = require('@jscad/modeling').primitives
 +
 const myshape = cube({size: 3}) const myshape = cube({size: 3})
 const myshape = cube({size: 3, center: [4, 5, 6]}) const myshape = cube({size: 3, center: [4, 5, 6]})
 </code> </code>
  
-=== Rounded Cuboid === +=== Rounded Cuboid === 
 + 
 +{{ :wiki:jscad-roundedCuboid.png?nolink | Rounded Cuboid}}
  
 Rounded cuboids can be created by specifying a ''roundRadius'' for the corners. 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>
 +const { roundedCuboid } = require('@jscad/modeling').primitives
 +
 const myshape = roundedCuboid({size: [1, 2, 3], roundRadius: 0.25}) const myshape = roundedCuboid({size: [1, 2, 3], roundRadius: 0.25})
 const myshape = roundedCuboid({size: [1, 2, 3], roundRadius: 0.25, center: [4, 5, 6], segments: 32}) const myshape = roundedCuboid({size: [1, 2, 3], roundRadius: 0.25, center: [4, 5, 6], segments: 32})
 </code> </code>