// Last edited on 2023-06-12 20:29:38 by stolfi #macro curvsamp_camera_parms(thing, view, clk) // Globally defines the {camlight} parameters {scene_center}, // {scene_radius}, {dir_camera}, and {dist_camera} for the view of // object {thing} for the movie clock {clk}. #local thpos = min_extent(thing); #local thdim = max_extent(thing) - thpos; #debug concat("\n!! thpos = ", vstr(3, thpos, " ", 0,1), " thdim = ", vstr(3, thdim, " ", 0,1), "\n") #local thrad = vlength(thdim)/2; #local thctr = thpos + thdim/2; #declare scene_center = thctr; #declare scene_radius = 1.2*thrad; #if (view = 0) // View from {X} axis: #declare dir_camera = < 1, 0, 0 >; #declare dist_camera = 9999; #elseif (view = 1) // View from {Y} axis: #declare dir_camera = < 0, 1, 0 >; #declare dist_camera = 9999; #elseif (view = 2) // View from {Z} axis: #declare dir_camera = < 0, 0, 1 >; #declare dist_camera = 9999; #elseif(view = 3) // View from first octant: #local azim = 4*pi*clk; #local elev = 0.5*pi*(0.20 - 0.15*cos(0.5*azim)); #declare dir_camera = < cos(azim)*cos(elev), sin(azim)*cos(elev), sin(elev) >; #declare dist_camera = 5*scene_radius; #else #debug "** invalid {view}\n" #end #end