// PoVRay 3.7 Scene File " ... .pov" // author: ... // date: ... //-------------------------------------------------------------------------- //+w1000 +h640 +a0.3 +am2 +bm2 +bs8 +wt6 #version 3.8; global_settings {assumed_gamma 1.0} //-------------------------------------------------------------------------- // camera ------------------------------------------------------------------ #declare Camera_0 = camera {perspective angle 75 // front view location <0.5, 1.5,-6.0> right x*image_width/image_height look_at <0.5, 0.5, 0.0>} camera{Camera_0} // sun ---------------------------------------------------------------------- light_source{< 3000,3000,-3000> color rgb 1} // sky ---------------------------------------------------------------------- sky_sphere { pigment { gradient <0,1,0> color_map { [0.00 rgb <0.6,0.7,1.0>] [0.35 rgb <0.1,0.0,0.8>] [0.65 rgb <0.1,0.0,0.8>] [1.00 rgb <0.6,0.7,1.0>] } scale 2 } // end of pigment } //end of skysphere // ground ------------------------------------------------------------------- plane {<0, 1, 0>, -5 texture { cylindrical texture_map { [0.0 pigment {rgb <1, 1, 0>*0.98}] [0.9 pigment {checker color rgb <1, 1, 1>*0.98 color rgb <1, 1, 1>*0.90 scale 0.05}] } scale 30 } // end of texture } // end of plane //--------------------------------------------------------------------------- //---------------------------- objects in scene ---------------------------- //--------------------------------------------------------------------------- #declare Cylinder = cylinder { <0, 0, 0>, <0, 5, 0>, 0.3 rotate 45*z translate <2.5, -2.0, 0> } #declare Box = box { <-2, -0.1, -2>, <3, 0.0, 2> } #declare Crossing = intersection { object {Box} object {Cylinder} } //These are rendered objects used; note that "Crossing" has been slightly scaled-up to make it visible in the scene //Whale3 object {Cylinder pigment {rgbt <1, 0, 0, 0.7>}} object {Box pigment {rgbt <0, 1, 0, 0.7>}} object {Crossing pigment {rgb <0, 1, 1>} scale 1.01} //These are the faulty results from standard intersection: #declare MinCross_old = min_extent(Crossing); #declare MaxCross_old = max_extent(Crossing); #declare MidCross_old = MaxCross_old-(MaxCross_old-MinCross_old)/2; #debug concat ("\nMinCross_old: ", vstr(3, MinCross_old, ", ", 3, 3), ".\n") #debug concat ("MaxCross_old: ", vstr(3, MaxCross_old, ", ", 3, 3), ".\n") #debug concat ("MidCross_old: ", vstr(3, MidCross_old, ", ", 3, 3), ".\n") //------------------------------------ #include "bounder.inc" //to be used to optimize the intersection bounding box! Bounder(Crossing, 10) //------------------------------------ //These are the optimized results from the Bounder.inc macro (thanks to Jr!): #declare MinCross = ol_; //min_extent optimised BB #declare MaxCross = ou_; //max_extent optimised BB #declare MidCross = MaxCross-(MaxCross-MinCross)/2; #debug concat ("\nOpimized MinCross: ", vstr(3, MinCross, ", ", 3, 3), ".\n") #debug concat ("Optimized MaxCross: ", vstr(3, MaxCross, ", ", 3, 3), ".\n") #debug concat ("Optimized MidCross: ", vstr(3, MidCross, ", ", 3, 3), ".\n") //These are the locations of the different bounding boxes: union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,0,1>} translate MinCross_old } union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,0,1>} translate MaxCross_old } union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,0,1>} translate MidCross_old } union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,1,0>} translate MinCross } union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,1,0>} translate MaxCross } union { cylinder {<0, -1, 0>,<0, 1, 0>, 0.01} sphere {0, 0.03} pigment {rgb <1,1,0>} translate MidCross }