home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / simple / csg3.pi < prev    next >
Text File  |  1994-12-31  |  899b  |  28 lines

  1. viewpoint {
  2.    from <0,4,-20>
  3.    at <-0.8,0.5,0>
  4.    up <0,1,0>
  5.    angle 23
  6.    resolution 256, 256
  7.    }
  8.  
  9. background white
  10. light <0, 20, -40>
  11.  
  12. include "../colors.inc"
  13.  
  14. // Create a sphere with a checker texture
  15. define two_sphere object { sphere <0, 0, 0>, 2 }
  16.  
  17. define short_box object { box <-2, -0.4, -0.5>, <0.5, 0.4, 2> shiny_red }
  18. define cylinder_z object { cylinder <0, 0, -2>, <0, 0, 2>, 0.5 shiny_green }
  19. define unit_sphere object { sphere <0, 0, 0>, 1 shiny_blue }
  20.  
  21. // Define a CSG shape by deleting a cylinder from a sphere
  22. object {
  23.      object { short_box + unit_sphere  rotate <-45, -30, 0> translate <-2, 2, 0> }
  24.    + object { short_box * unit_sphere  rotate <-45, -30, 0> translate < 2, 2, 0> }
  25.    + object { short_box - unit_sphere  rotate <0,  20, 0> translate <-2,-2, 0> }
  26.    + object { short_box & ~unit_sphere rotate <0,  20, 0> translate < 2,-2, 0> }
  27.    }
  28.