// Last edited on 2012-02-18 19:04:54 by stolfilocal #declare pill_sink = 0; // Relative to radius. #declare pill_pump = 1/sqrt(1-pill_sink*pill_sink); #declare pill_thk = 0.20; // Pill thickness in mm. #macro pill(ctX,ctY,rad) #local rcorr = rad*pill_pump; sphere{ <0,0,0>, rcorr - eps scale <1, 1, pill_thk/(2*rcorr) > translate < ctX, ctY, 0 > } #end #macro oval_plate(szX, szY, thk) union{ cylinder{ <0,0,-thk/2>, <0,0,+thk/2>, szX/2-thk } torus{ szX/2-thk, 0.999*thk rotate 90*x } scale < 1, szY/szX, 1 > } #end #macro rect_plate(szX, szY, thk, rnd) // Rectangular plate of dimensions {szX × szY × thk} with chamfer of radius {rnd}. // Centered at origin. #local xmin = -szX/2+rnd; #local xmax = +szX/2-rnd; #local ymin = -szY/2+rnd; #local ymax = +szY/2-rnd; union{ box{ , } box{ , } cylinder{ < xmin, ymin, -thk/2+rnd>, < xmin, ymax, -thk/2+rnd>, 0.999*rnd } cylinder{ < xmax, ymin, -thk/2+rnd>, < xmax, ymax, -thk/2+rnd>, 0.999*rnd } cylinder{ < xmin, ymin, -thk/2+rnd>, < xmax, ymin, -thk/2+rnd>, 0.999*rnd } cylinder{ < xmin, ymax, -thk/2+rnd>, < xmax, ymax, -thk/2+rnd>, 0.999*rnd } sphere{ < xmin, ymin, -thk/2+rnd>, 0.998*rnd } sphere{ < xmin, ymax, -thk/2+rnd>, 0.998*rnd } sphere{ < xmax, ymin, -thk/2+rnd>, 0.998*rnd } sphere{ < xmax, ymax, -thk/2+rnd>, 0.998*rnd } cylinder{ < xmin, ymin, +thk/2-rnd>, < xmin, ymax, +thk/2-rnd>, 0.999*rnd } cylinder{ < xmax, ymin, +thk/2-rnd>, < xmax, ymax, +thk/2-rnd>, 0.999*rnd } cylinder{ < xmin, ymin, +thk/2-rnd>, < xmax, ymin, +thk/2-rnd>, 0.999*rnd } cylinder{ < xmin, ymax, +thk/2-rnd>, < xmax, ymax, +thk/2-rnd>, 0.999*rnd } sphere{ < xmin, ymin, +thk/2-rnd>, 0.998*rnd } sphere{ < xmin, ymax, +thk/2-rnd>, 0.998*rnd } sphere{ < xmax, ymin, +thk/2-rnd>, 0.998*rnd } sphere{ < xmax, ymax, +thk/2-rnd>, 0.998*rnd } } #end #if (cover_side = 0) #include "cover_boss_0.inc" #include "cover_face.inc" #include "cover_name.inc" #include "cover_year.inc" #else #include "cover_boss_1.inc" #include "cover_copy.inc" #end #include "cover_card.inc" #declare cover_ctX = page_szX/2; #declare cover_ctY = page_szY/2; #declare cover_bare = union{ difference{ object{ cover_card translate < cover_ctX, cover_ctY, -cover_card_thk/2 > } #if (cover_side = 0) object{ cover_face_inset translate < cover_face_ctX, cover_face_ctY, 0 > } object{ cover_name_inset translate < cover_name_ctX, cover_name_ctY, 0 > } object{ cover_year_inset translate < cover_year_ctX, cover_year_ctY, 0 > } #else object{ cover_copy_inset translate < cover_copy_ctX, cover_copy_ctY, 0 > } #end } #if (cover_boss_add != 0) object{ cover_boss translate -pill_sink*pill_thk*z } #end texture{ tx_cuir } } #declare cover_paint = union{ #if (cover_side = 0) object{ cover_face_paint translate < cover_face_ctX, cover_face_ctY, 0 > } object{ cover_name_paint translate < cover_name_ctX, cover_name_ctY, 0 > } object{ cover_year_paint translate < cover_year_ctX, cover_year_ctY, 0 > } #else object{ cover_copy_paint translate < cover_copy_ctX, cover_copy_ctY, 0 > } #end texture{ tx_gold } } #declare cover = union{ // intersection{ // plane{ z,0 } // plane{ -z,0 translate -0.05*z } // plane{ y,0 translate < cover_face_ctX, cover_face_ctY, 0 > } // texture{ tx_red } // translate -0.50*cover_face_inset_thk*z // } object{ cover_bare } object{ cover_paint } }