Node: Cuboid Getstart, Next: , Previous: Solid Figures, Up: Solid Figures



Cuboids

A cuboid is a solid figure consisting of six rectangular faces that meet at right angles. A cube is a special form of cuboid, whose faces are all squares. The constructor for the class Cuboid follows the pattern familiar from the constructors for the plane figures: The first argument is the center of the Cuboid, followed by three real arguments for the height, width, and depth, and then three more real arguments for the angles of rotation about the x, y, and z-axes. The Cuboid is first constructed with its center at the origin. Its width, height, and depth are measured along the x, y, and z-axes respectively. If rotations are specified, it is rotated about the x, y, z-axes in that order. Finally, it is shifted such that its center comes to lie on its Point argument, if the latter is not the origin.

If the width, height, and depth arguments are equal, the Cuboid is a cube:

     Cuboid c0(origin, 3, 3, 3, 0, 30);
     c0.draw();
     


[Figure 37. Not displayed.]

Fig. 37.

In the following example, the Cuboid is "filldrawn", so that the lines dilineating the hidden surfaces of the Cuboid are covered.

     Cuboid c1(origin, 3, 4, 5, 0, 30);
     c1.filldraw();
     


[Figure 38. Not displayed.]

Fig. 38.