meta data for this page
  •  

This is an old revision of the document!


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.


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.

Defaults:

  • size : 1 or [1,1,1]
  • center : [0,0,0]
  • radius : 0
  • round: false
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})

Also, the CSG library functions can be used directly. NOTE Deprecated in the V2 API

CSG.cube({
    center: [0, 0, 0],
    radius: [1, 1, 1]
})
 
CSG.cube({ // define two opposite corners
    corner1: [4, 4, 4],
    corner2: [5, 4, 2]
})

Rounded cubes are created by specifying a rounded radius for the corners and the sides.

CSG.roundedCube({ // rounded cube
    center: [0, 0, 0],
    radius: 1,
    roundradius: 0.9,
    resolution: 8,
});