disc

        disc [surface-desc]  radius  cx cy cz  nx ny nz
Figure 2-10

Create a disc with the specified radius, centred at (cx cy cz) and with the specified normal. Apart from their use as "free standing" objects, discs are very useful in closing cylinders and cones so that they can be used in CSG operations. The direction of the normal is significant; when discs are used to close cylinders the normals should point away from the inside of the cylinder.

Calculating the disc's normal is quite simple, for example, if the disc is to close off a cylinder:

    cylinder   1   2 4 8   16 32 64
then the normal can be calculated by subtracting the coordinates of the ends, [2,4,8] - [16,32,64] = [-14,-28,-56]:
    disc       1    2  4  8   -14 -28 -56
    disc       1   16 32 64    14  28  56
In the example below, the texture "image" is used to "map" an RLE image (of a woman's face) onto a disc.

Figure 2-11

        /*
         face.ray
         image texture on a disc
         Stephen Peter 22 feb 92
        */
        eyep 0 -1 1
        lookp  0 -0.1 0
        screen 300 200
        background .9 .9 .9

        #define PIC IMAGES/face.rle

        disc .5  0 0 0   0 0 1
             texture image PIC map planar
                  translate -0.4 -0.5 0

Go to next primitive: heightfield.

Return to Contents.

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