// The Lazo heater // Last edited on 2005-08-29 23:56:06 by stolfi #macro heater_height(profile) #include concat("heater-profile-", profile, ".inc") heater_profile_height() #end #macro heater_radius(profile) #include concat("heater-profile-", profile, ".inc") heater_profile_radius() #end #macro heater_mirror_blank(B, N) prism { linear_sweep bezier_spline -2.00 2.00 2*N + 8 #debug "Defining the heater mirror...\n" #local thck = 0.010; // Mirror thickness #local k = 0; #local isense = 0; #while (isense <= 1) #local sense = 1 - 2*isense; // Sense of traversal (+1 or -1) #local dsp = (1-isense)*thck; // Displ. of current side along its normal #local dsn = isense*thck; // Displ. of other side along its normal #if (isense > 0) , // Yes, a comma! #end #local kk = 0; #while (kk < N) // Arc endpoints: #local A0 = B[k+0*sense]; #local A1 = B[k+1*sense]; #local A2 = B[k+2*sense]; #local A3 = B[k+3*sense]; #debug "\n" #debug concat("A0 = ", str(A0.x,7,4), " ", str(A0.y,7,4), "\n") #debug concat("A1 = ", str(A1.x,7,4), " ", str(A1.y,7,4), "\n") #debug concat("A2 = ", str(A2.x,7,4), " ", str(A2.y,7,4), "\n") #debug concat("A3 = ", str(A3.x,7,4), " ", str(A3.y,7,4), "\n") // Previous and next arc endpoints: #if ((k-2*sense >= 0) & (k-2*sense < N)) #local P2 = B[k-2*sense]; #else #local P2 = A0; #end #if ((k+5*sense >= 0) & (k+5*sense < N)) #local Q1 = B[k+5*sense]; #else #local Q1 = A3; #end // Forward tangent vectors at endpoints: #local tg0 = A1 - P2; #local tg3 = Q1 - A2; #debug "\n" #debug concat("tg0 = ", str(tg0.x,7,4), " ", str(tg0.y,7,4), "\n") #debug concat("tg3 = ", str(tg3.x,7,4), " ", str(tg3.y,7,4), "\n") // Sormal vectors at endpoints, pointing away from current side: #local nv0 = < tg0.y, -tg0.x >/vlength(tg0); #local nv3 = < tg3.y, -tg3.x >/vlength(tg3); #debug "\n" #debug concat("nv0 = ", str(nv0.x,7,4), " ", str(nv0.y,7,4), "\n") #debug concat("nv3 = ", str(nv3.x,7,4), " ", str(nv3.y,7,4), "\n") #local B0 = A0 + dsp * nv0; #local B1 = A1 + dsp * nv0; #local B2 = A2 + dsp * nv3; #local B3 = A3 + dsp * nv3; #debug "\n" #debug concat("B0 = ", str(B0.x,7,4), " ", str(B0.y,7,4), "\n") #debug concat("B1 = ", str(B1.x,7,4), " ", str(B1.y,7,4), "\n") #debug concat("B2 = ", str(B2.x,7,4), " ", str(B2.y,7,4), "\n") #debug concat("B3 = ", str(B3.x,7,4), " ", str(B3.y,7,4), "\n") B0, B1, B2, B3, #local k = k + 4*sense; #local kk = kk + 4; #end #local k = k - sense; // Closing the prism: #local C0 = B[k] + dsp*nv3; #local C1 = B[k] + (2*dsp-dsn)*nv3; #local C2 = B[k] + (dsp-2*dsn)*dsn*nv3; #local C3 = B[k] - dsn*nv3; #debug "\n" #debug concat("C0 = ", str(C0.x,7,4), " ", str(C0.y,7,4), "\n") #debug concat("C1 = ", str(C1.x,7,4), " ", str(C1.y,7,4), "\n") #debug concat("C2 = ", str(C2.x,7,4), " ", str(C2.y,7,4), "\n") #debug concat("C3 = ", str(C3.x,7,4), " ", str(C3.y,7,4), "\n") C0, C1, C2, C3 #local isense = isense + 1; #end #debug "\n" } #end #macro heater_mirror_slice(B, N, M) #local heater_mirror_color = < 1.000, 1.000, 1.000 >; #declare heater_mirror_texture = texture { pigment { color rgb heater_mirror_color } finish { diffuse 0.0 ambient 0.0 reflection 0.9 } } #local ang = 360/M/2; intersection { object{ heater_mirror_blank(B, N) } plane { y,0 rotate ang*z } plane { -y, 0 rotate -ang*z } texture { heater_mirror_texture } } #end // The Lazo heater with profile "heater-profile-{profile}.inc", // collector "collector-{colltype}.inc", and {M} wedges. #macro heater(profile, colltype, M) #include concat("heater-profile-", profile, ".inc") #local N = heater_profile_num_points(); #local B = heater_profile_points(); #local heater_ht = heater_profile_height(); #local heater_rad = heater_profile_radius(); #local mirror_twist = 0; // Rotation of mirror around Z #local mirror_slice = object{ heater_mirror_slice(B, N, M) } #local i = 0; #local reflector = union { #while (i < M) object { mirror_slice rotate i*360/M*z } #local i = i + 1; #end } #include concat("collector-", colltype, ".inc") #local coll_ht = heater_ht; #local coll_rad = 0.200*heater_rad; // #local coll_offset_y = -0.35*heater_rad; #local coll_offset_y = 0; #local heater_mirror_hole_color = < 0.500, 0.500, 0.500 >; #declare heater_mirror_hole_texture = texture { pigment { color rgb heater_mirror_hole_color } finish { diffuse 0.1 ambient 0.9 } } // All together now: union { difference { object { reflector rotate -mirror_twist*z } object { collector_hole(coll_ht, coll_rad) translate coll_offset_y * y texture { heater_mirror_hole_texture } } } object { collector(coll_ht, coll_rad) translate coll_offset_y * y } } #end