cone

        cone [surface-desc]  bottom-radius  bx by bz  top-radius  tx ty tz
Figure 2-4

Create a cone with the bottom centred at (bx by bz) and the top centred at (tx ty tz), with the specified radii. Cones (like cylinders) are not solid: discs can be used where necessary to close off cones that you want to use in CSG operations.

In the example below a wine glass is made using cones. The first series of cones create the outside surface and the second define the inside; the two objects are subtracted (using difference) to create the glass.

Figure 2-5

Note the use of disc to close off the groups of cones. The second series of cones only uses one disc because the first cone has a radius of 0.

A better wine glass could be created using (transformed) spheres for the bowl; but then I would have had to think up a different example here! The example for the difference object is a better wine glass!

Figure 2-6

        /*
         wine.ray
         wine glass - using cone primitive
         Stephen Peter 22 feb 92
        */
        eyep    200  400 300
        lookp  -200 -200   0
        screen 300 300
        background .9 .9 .9

        surface glass
            diffuse .08 .08 .08   specular .2 .2 .2
            reflect .8   transp .9   body .8 .8 .8  index 1.3

        surface table
          ambient .1 .1 .1 diffuse .7 .4 .2 specular .2 .2 .2

        surface green
          ambient .1 .1 .1 diffuse .2 .7 .3 specular .2 .2 .2

        /* the glass's "outside" */
        name outer
            list
                disc  43  0 0  0   0 0 -1     /* close bottom */
                cone  43  0 0  0   42  0 0  2
                cone  42  0 0  2   14  0 0  4
                cone  14  0 0  4    7  0 0  7
                cone   7  0 0  7    3  0 0 25
                cone   3  0 0 25    7  0 0 50
                cone   7  0 0 50   12  0 0 57
                cone  12  0 0 57   28  0 0 66
                cone  28  0 0 66   42  0 0 85
                cone  42  0 0 85   46  0 0 120
                disc  46  0 0 120  0 0 1      /* close top */
            end

        /* the glass's "bowl" */
        name inner
            list
                cone   0  0 0 53   10  0 0 57
                cone  10  0 0 57   26  0 0 66
                cone  26  0 0 66   40  0 0 85
                cone  40  0 0 85   44  0 0 121
                disc  44  0 0 121  0 0 1      /* close top */
            end

        name wine-glass
            difference
                  object outer
                  object inner
            end

        object glass wine-glass

        box table -200 -200 -10   200 200 0
            texture checker green
            scale 50 50 50 translate 0 0 .1

Go to next primitive: cylinder.

Return to Contents.

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