box

        box [surface-desc]    x1 y1 z1   x2 y2 z2
Figure 2-2

The two points define the diagonally opposite vertices of a box; the box's edges are parallel to the axis. If you require a box that is not axis-aligned, create the box at the origin, rotate it into the required orientation then translate it to the required position.

The example below shows three boxes, the first and third are transformed: "shearing" them vertically, the second box is untransformed!

Figure 2-3

        /*
          box.ray
          3 boxes
          Stephen Peter 24 feb 92
        */
        eyep .51 7 3
        lookp .5 0 1.5
        background .9 .9 .9
        screen 300 200
        light 1 point 5 5 3

        surface green
            ambient 0 .1 0
            diffuse 0 .5 0

        box green 0 0 0  1 1 1
            transform 1 0 2  0 1 0  0 0 1  1.5 0 0
        box green 0 0 0  1 1 1
        box green 0 0 0  1 1 1
            transform 1 0 2  0 1 0  0 0 1  .5 0 0
            scale -1 1 1

Go to next primitive: cone.

Return to Contents.

THE END - Notes on Rayshade - 2 - Rayshade Primitives - Box