#include "eixos.inc" #macro bond_view(thing, show_axes, view) // Sets the {camlight} parameters for the specific {view} // of object {thing} #local thmin = min_extent(thing); #local thmax = max_extent(thing); #local thpos = thmin; #local thdim = thmax - thpos; #debug concat("\n!! thpos = ", vstr(3, thpos, " ", 0,1), " thdim = ", vstr(3, thdim, " ", 0,1), "\n") #local thrad = vlength(thdim)/2; #local thctr = (thmin + thmax)/2; #local scene = union{ object{ thing } #if (show_axes) object{ eixos(1.3*thrad, 0.005*thrad) } #end } object{ scene } #if (view = 0) // Full view of object from first octant: #declare centro_cena = thctr; #declare raio_cena = 1.2*thrad; #declare dir_camera = < 5.0, 6.0, 7.0 >; #declare dist_camera = 5*raio_cena; #elseif (view = 1) // Perspective view from {+X} #declare centro_cena = thctr + thdim/2; #declare raio_cena = 5.0; #declare dir_camera = < +1, 00, 00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 2) // Perspective view from {+Y}: #declare centro_cena = thctr; #declare raio_cena = 1.5*thrad; #declare dir_camera = < 00, +1, 00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 3) // Full view from first octant, nearly from +X: #declare centro_cena = thctr; #declare raio_cena = 1.d25*thrad; #declare dir_camera = < 14.00, 3.00, 5.00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 4) // Full view from first octant, lower #declare centro_cena = thctr; #declare raio_cena = 1.0*thrad; #declare dir_camera = < 5.0, 6.0, 4.0 >; #declare dist_camera = 10*raio_cena; #elseif (view = 5) // Top front right corner larger detail: #declare centro_cena = thctr + thdim/2; #declare raio_cena = 250; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 6) // Top front right corner larger detail from back: #declare centro_cena = thctr + thdim/2; #declare raio_cena = 250; #declare dir_camera = < -14.00, 12.00, 4.00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 7) // Center front detail: #declare centro_cena = thctr + thdim.x/2*x; #declare raio_cena = 100; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 7*raio_cena; #elseif (view = 8) // Top right edge middle larger detail from back: #declare centro_cena = thctr + < 0, thdim.y/2, thdim.z/2 >; #declare raio_cena = 250; #declare dir_camera = < -14.00, 12.00, 4.00 >; #declare dist_camera = 7*raio_cena; #end #end