Previous page Next page

Box Object

The box is one of the most common objects used. We try this example in place of the sphere:

  box {

    <-1, 0,   -1>,  // Near lower left corner

    < 1, 0.5,  3>   // Far upper right corner

    texture {

      T_Stone25     // Pre-defined from stones.inc

      scale 4       // Scale by the same amount in all

                    // directions

    }

    rotate y*20     // Equivalent to "rotate <0,20,0>"

  }

In the example we can see that a box is defined by specifying the 3D coordinates of its opposite corners. The first vector must be the minimum x-, y- and z-coordinates and the 2nd vector must be the maximum x-, y- and z-values. Box objects can only be defined parallel to the axes of the world coordinate system. We can later rotate them to any angle. Note that we can perform simple math on values and vectors. In the rotate parameter we multiplied the vector identifier y by 20. This is the same as <0,1,0>*20 or <0,20,0>.

Previous page Next page