Intersection Object

        [name  objname]  intersect
                  object1
                  object2
        end  [transformations]  [textures]
Figure 5-6

The intersect object includes those parts common to both objects.

I often find that the applications of intersect are less obvious than union and difference. I think that we are trained from primary school in adding and subtracting, and so using an intersection operator is much less intuitive.

This example shows a simple use for intersect: a series of boxes are intersected with a sphere. The sphere is used to "cut" the edges of the boxes (and the resulting shape also uses the sphere's surface definition on the edges.

Figure 5-7

        /*
           intersect.ray
           intersect a series of boxes with a sphere
           Stephen Peter 2 aug 92
        */

        eyep 1250 450 1600
        lookp 0 0 0
        screen 300 200

        light 1 point 1500 1000 1000

        surface white
            ambient  .3 .3 .3
            diffuse  .4 .4 .4
            specular .4 .4 .4
            reflect .2
            specpow 50

        surface blue
            ambient   0  0 .3
            diffuse  .2 .2 .4
            specular .4 .4 .4
            reflect .2
            specpow 25

        name boxes
            list
                box -600 -455 -600    600 -445 600
                box -600 -305 -600    600 -295 600
                box -600 -155 -600    600 -145 600
                box -600   -5 -600    600    5 600
                box -600  155 -600    600  145 600
                box -600  305 -600    600  295 600
                box -600  455 -600    600  445 600
            end

        name frame
            intersect
	            object white boxes
	            sphere blue  500   0 0 0
            end

        object frame rotate 0 0 1 60
        object frame rotate 0 0 1 -60
        object frame

Go to next section:
Difference Object.

Return to Contents.

THE END - Notes on Rayshade - 5 - Objects - Intersection