To draw a cuboid, you have to use the box()
function by giving its dimensions as its parameters.
size(200, 200, P3D); //Starting the P3D renderer
translate(width/2, height/2); //Translating to the centre of the sketch
rotateY(PI/4); //rotate so that...
rotateX(PI/6); //... it will be easy to see the box
noFill(); //disabling the box's fill, so that we will be able to see its edges
box(100, 50, 75); //the box function requires its dimensions as its parameters
Note that the
box()
function does not accept its position as the parameters
There also is a way to call the box()
function with only one parameter. In this case, it will be a cube.
stroke(0, 100, 255); //change the edges' colour
fill(0, 0, 255); //fill the `box` in a blue colour
box(100); //draw a cube