Name

box()

Description

A box is an extruded rectangle. A box with equal dimension on all sides is a cube.

Examples

  • size(400,400,P3D);
    translate(232, 192, 0); 
    rotateY(0.5);
    noFill();
    box(160);
    Image output for example 1
  • translate(232, 192, 0); 
    rotateY(0.5);
    noFill();
    box(160, 80, 200);
    Image output for example 2

Syntax

  • box(size)
  • box(w, h, d)

Parameters

  • size(float)dimension of the box in all dimensions (creates a cube)
  • w(float)dimension of the box in the x‑dimension
  • h(float)dimension of the box in the y‑dimension
  • d(float)dimension of the box in the z‑dimension

Return

  • void

Related