next up previous contents index
Next: Materials Up: Linking Objects Together Previous: Bind

Cancer

    If two objects in a scene have a surface at the same coordinates then when the scene is raytraced the surface shown could be either of the two surfaces. Parts of both surfaces could be shown at different points on the surface. This is called cancer. Cancer can cause problems when subtracting a shape from another shape. The surfaces of the subtracted object should extend beyond the surfaces of the object that it is subtracted from. Figure 9 show the effect on the surface of two objects at the same place.

  figure240
Figure 9: Cancer: Two Spheres at the Same Coordinates.

In the pipe example below the innerpipe is subtracted from the pipe. If the innerpipe was a cylinder of the same length as the pipe cylinder, then at the ends of the pipe the surface of the outer and inner pipe would be in the same place and this could cause cancer. To avoid this the inner pipe is made out of a longer cylinder (an infinite length cylinder);

  object Pipe::make_pipe(void) {
   object pipe, innerpipe; 
   pipe = stretch(2, 2, 6, new_unitcyl());
   innerpipe = stretch(1.5, 1.5, 1.0, new_cyl()));
   LINK(pipe, MINUS, innerpipe);
   return bind(pipe);
 }



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998