// Last edited on 2007-05-23 08:46:45 by stolfi // Human dummy (or dummy human?) #declare human_rnd = seed(4615); #macro scone(a,ra,b,rb) // {a,b} are the centers of the balls // {ra,rb} are their radii. #local eps = rand(human_rnd)*0.0001; sphere { a, ra+eps } sphere { b, rb+eps } #local dab = vlength(a-b); #if (dab > abs(ra-rb)) #local ct = (ra-rb)/dab; #local st = sqrt(max(0,1-ct*ct)); #local uab = (b-a)/dab; #local aw = a + ct*ra*uab; #local bw = b + ct*rb*uab; cone { aw, ra*st, bw, rb*st } #end #end #macro sfoot(a,ra,b,rb) scone( a, ra, b, rb ) #end #macro human(ht,fat,sitting) // {ht} is standing height of human. Other dimensions are derived from it. // {fat} is a relative fat factor (1 = like the author). // If {sitting=true} the human is sitting. // In any case the feet soles are at Z=0 // and the head is centered on the Z axis. // Build a human that is 1.720 m tall, then scale #local ref_ht = 1.720; // Part heights: #local head_dz = 0.220; // From head top to top of neck (chin). #local neck_dz = 0.080; // From top of neck to bottom of neck (shoulders) #local tnec_dm = 0.100*fat; // Neck diameter at top. #local bnec_dm = 0.130*fat; // Neck diameter at base. #local trax_dz = 0.620; // From top of hips to base of neck. #local hips_dm = 0.180*fat; // Diameter of hip joint (buttock). #local pube_dm = 0.160*fat; // Diameter of pubis node. #local toen_dm = 0.020*fat; // Diameter of toenails. #local foot_wy = 0.150; // From front of ankle joint to toe nails. #local foot_dz = 0.020*fat; // From floor to base of ankle joint. #local ankl_dm = 0.060*fat; // Diameter of ankle. #local shin_dz = 0.380; // From top of foot joint to bottom of knee. #local knee_dm = 0.120*fat; // Diameter of knee. #local tlun_dm = 0.140*fat; // Diameter of tluntops. #local shld_dm = 0.120*fat; // From armpit to shouldertop (thickness of upper arm). #local uarm_dz = 0.150; // From armpit to top of elbow. #local elbw_dm = 0.100*fat; // Diameter of elbow. #local larm_dz = 0.230; // From base of elbow to top of wrist. #local wrst_dm = 0.030*fat; // Diameter of wrist. #local hand_dz = 0.050; // From base of wrist to top of knuckles. #local knck_dm = 0.050*fat; // Diameter of knuckles. #local fing_dz = 0.080; // From base of knuckles to top of nail. #local nail_dm = 0.015*fat; // Diameter of nail. // Balance is {thig_dz}, from top of knee to bottom of hips. #local thig_dz = ref_ht - (head_dz + neck_dz + trax_dz + knee_dm + shin_dz + ankl_dm + foot_dz); // Widths: #local shld_wx = 0.500*fat; // From outside shoulders. #local hips_wx = 1.90*hips_dm; // From outside hips. // Key Y and Z coordinates: // Add Z coords up from toenail to hips: #local toen_z = toen_dm/2; #local ankl_z = foot_dz + ankl_dm/2; #local knee_z = ankl_z + ankl_dm/2 + shin_dz + knee_dm/2; #if (sitting) #local hips_z = knee_z + (hips_dm - knee_dm)/2; #else #local hips_z = knee_z + knee_dm/2 + thig_dz + hips_dm/2; #end // Add Y coords down from hips to toenail #local hips_y = 0; #if (sitting) #local knee_y = hips_dm/2 + thig_dz + knee_dm/2; #else #local knee_y = 0; #end #local ankl_y = knee_y; #local toen_y = ankl_y + ankl_dm/2 + foot_wy + toen_dm/2; // Now add Y and Z up from the hips joints: #local pube_z = hips_z + (pube_dm - hips_dm)/2; #local pube_y = hips_y - (pube_dm - hips_dm)/2; #local shld_z = hips_z - hips_dm/2 + trax_dz - shld_dm/2; #local shld_y = hips_y; #local tlun_z = shld_z - (tlun_dm - shld_dm)/2; #local tlun_y = shld_y - (tlun_dm - shld_dm)/2; #local elbw_z = shld_z - shld_dm/2 - uarm_dz - elbw_dm/2; #local elbw_y = shld_y; #if (sitting) #local wrst_z = elbw_z - (elbw_dm - wrst_dm)/2; #local wrst_y = elbw_dm/2 + larm_dz + wrst_dm/2; #local knck_z = wrst_z - (wrst_dm - knck_dm)/2; #local knck_y = wrst_y + wrst_dm/2 + hand_dz + knck_dm/2; #local nail_z = knck_z - (knck_dm - nail_dm)/2; #local nail_y = knck_y + knck_dm/2 + fing_dz + nail_dm/2; #else #local wrst_z = elbw_z - elbw_dm/2 - larm_dz - wrst_dm/2; #local wrst_y = elbw_y; #local knck_z = wrst_z - wrst_dm/2 - hand_dz - knck_dm/2; #local knck_y = wrst_y; #local nail_z = knck_z - knck_dm/2 - fing_dz - nail_dm/2; #local nail_y = knck_y; #end #local bnec_z = shld_z - (bnec_dm - shld_dm)/2; #local bnec_y = shld_y - (bnec_dm - shld_dm)/2; #local tnec_z = bnec_z + bnec_dm/2 + neck_dz + tnec_dm/2; #local tnec_y = bnec_y - (tnec_dm - bnec_dm)/2; #local head_z = tnec_z - tnec_dm/2 + head_dz/2; #local head_y = tnec_y; // Lateral displacements: #local shld_x = shld_wx/2 - shld_dm/2; #local tlun_x = shld_x - max(shld_dm,tlun_dm)/2; #local hips_x = hips_wx/2 - hips_dm/2; #local elbw_x = hips_x + (elbw_dm + hips_dm)/2; // Arms: #local arm_L = union { scone( < shld_x, shld_y, shld_z >, shld_dm/2, < elbw_x, elbw_y, elbw_z >, elbw_dm/2 ) scone( < elbw_x, elbw_y, elbw_z >, elbw_dm/2, < elbw_x, wrst_y, wrst_z >, wrst_dm/2 ) scone( < elbw_x, wrst_y, wrst_z >, wrst_dm/2, < elbw_x, knck_y, knck_z >, knck_dm/2 ) scone( < elbw_x, knck_y, knck_z >, knck_dm/2, < elbw_x, nail_y, nail_z >, nail_dm/2 ) } #local arm_R = object { arm_L scale <-1,1,1> } // Legs: #local leg_L = union { scone( < hips_x, hips_y, hips_z >, hips_dm/4, < hips_x, knee_y, knee_z >, knee_dm/2 ) // scone( < hips_x, hips_y, hips_z >, hips_dm/2, < hips_x, knee_y, knee_z >, knee_dm/2 ) scone( < hips_x, knee_y, knee_z >, knee_dm/2, < hips_x, ankl_y, ankl_z >, ankl_dm/2 ) sfoot( < hips_x, ankl_y, ankl_z >, ankl_dm/2, < hips_x, toen_y, toen_z >, toen_dm/2 ) } #local leg_R = object { leg_L scale <-1,1,1> } // // Ribcages // #local rib_L = // union { // scone( < tlun_x, tlun_y, tlun_z >, tlun_dm/2, < hips_x, hips_y, hips_z >, hips_dm/2 ) // scone( < shld_x, shld_y, shld_z >, shld_dm/2, < tlun_x, tlun_y, tlun_z >, tlun_dm/2 ) // scone( < 0, bnec_y, bnec_z >, bnec_dm/2, < tlun_x, tlun_y, tlun_z >, tlun_dm/2 ) // scone( < 0, pube_y, pube_z >, pube_dm/2, < hips_x, hips_y, hips_z >, hips_dm/2 ) // } // #local rib_R = object { rib_L scale <-1,1,1> } union { // Head: sphere { < 0, head_y, head_z >, head_dz/2 } // Neck: scone( < 0, bnec_y, bnec_z >, bnec_dm/2, < 0, tnec_y, tnec_z >, tnec_dm/2 ) // // Midthorax: // scone( < 0, pube_y, pube_z >, pube_dm/2, < 0, bnec_y, bnec_z >, bnec_dm/2 ) // Torso: cylinder { < 0, hips_y, hips_z - hips_dm/2 >, < 0, bnec_y, bnec_z + bnec_dm/2 >, 1 scale < hips_wx/2, hips_dm/2, 1.000 > } // Ribcages, arms and legs: object { arm_L } object { arm_R } object { leg_L } object { leg_R } // object { rib_L } // object { rib_R } scale ht/ref_ht } #end