Box

A box is a rectangular prism in 3D space. A Box is defined by a first corner and a second corner, but unlike rectangle faces, these two coordinates need not share identical x-, y-, or z-values. The two corner points unambiguously represent a unique rectangular prism, in which all faces are parallel to the coordinate planes.

The box specifies its orientation by comparing the first and second corner points in local coordinates. If the x-coordinate of the first point is less than the x-coordinate of the second point, the surface normal points out of the box; otherwise, the box is flipped inside out and the surface normals point into the box.

In conjunction with an optional 4×4 transformation matrix, a Box can represent boxes that are not parallel to the coordinate planes. This matrix can store affine transformations.

Boxes may possess optional front or back appearances, and may be single or double sided.