#macro Body_Parts(Fem,High,Girth,Tummy,Hunch,Broad,Slim,Skin_Colour) #declare F= Fem ; #declare H= High ; #declare W= Girth*H ; #declare Tum= Tummy-1 ; #declare Hun= (Hunch-1)*.05; #declare Brd= Broad-1; #declare Slm= Slim; #declare SkinCol= Skin_Colour; #declare ChestA = Stance[ 9]*<-1,1,1>; #declare LhandA = Stance[ 0]; #declare RhandA = Stance[ 1]; #declare LUarmA = Stance[ 2]*<1,1,-1>+ChestA; #declare RUarmA = Stance[ 3]*<1,1,-1>+ChestA; #declare LFarmA = Stance[ 4]*<1,1,-1>+ChestA; #declare RFarmA = Stance[ 5]*<1,1,-1>+ChestA; #declare HeadA = Stance[ 6]*<-1,1,1>+<-1000*Hun,0,0>; #declare NodA = Stance[ 7]*<1,0,0>+<500*Hun,0,0>; #declare LshouA = Stance[ 7]*<0,1,1>; #declare RshouA = Stance[ 8]*<0,1,1>; #declare HipsA = Stance[10]*<-1,1,1>; #declare LthighA = Stance[11]*<1,1,-1>; #declare RthighA = Stance[12]*<1,1,-1>; #declare LshinA = Stance[13]*x+LthighA*<0,1,1>; #declare RshinA = Stance[14]*x+RthighA*<0,1,1>; #declare LfootA = <-Stance[13].y, Stance[13].z, 0>; #declare RfootA = <-Stance[14].y, Stance[14].z, 0>; #declare NeckL = (.22)*sqrt(H); #declare HeadD = .09*sqrt(H); #declare HeadB = (.01)*sqrt(H); #declare SpineTail = <0.0, -.4, 0.02>*; #declare SpineCoxx = <0.0, -.146, 0.024>*; // origin for constructing body is on the curve of the spine at the waist #declare SpineRibs = <0.0, .23, .024+Hun>*; #declare SpineNeck = <0.0, .37, .01-.5*Hun>*; #declare SpineHunc = (SpineNeck+<0.0, .1, -.12-.5*Hun >)*; #declare SpineBack = <0,.0345,0> *; // center of rotation for chest and hips #declare Collar = <0.024, .37, -.024>*; #declare NeckO = SpineNeck+<0.0, .035, -.036>*; #declare NeckH = SpineNeck.y; #declare StoopA = 180+ degrees(atan2((SpineNeck-SpineRibs).z,(SpineRibs-SpineNeck).y)); #declare HipsOff = <(0.11), -.00, -.06>*; #declare ButtOff = <0.096, -.01, -.048>*; #declare Ribsoff = <0.07, 0, -.024 >*; #declare ChestOff = <0.06, -.1*Brd, -.03>*; #declare ShoulOff = <.19,-.02, -.03>*; #declare ThighL = .43*H; #declare ShinL = .45*H; #declare UarmL = .33*H; #declare FarmL = .33*H; #declare ShoulR = .05 *W; // shoulder #declare ElbowR = .033*W; // elbow #declare WristR = .026*W; // wrist #declare HipR = .11 *W; // hip #declare KneeR = .06 *W; // knee #declare AnkleR = .045*W; // ankle #declare Lshou =(vrotate( (vrotate (ShoulOff,LshouA)+Collar) -SpineBack, ChestA)+SpineBack); #declare Rshou =(vrotate(((vrotate (ShoulOff,RshouA)+Collar)*<-1,1,1>)-SpineBack, ChestA)+SpineBack); #declare Neck =(vrotate (NeckO-SpineBack, ChestA)+SpineBack); #declare Lbutt = vrotate (SpineCoxx+ButtOff, HipsA); #declare Rbutt = vrotate ((SpineCoxx+ButtOff)*<-1,1,1>, HipsA); #declare Lhip = vrotate (HipsOff+SpineCoxx, HipsA); #declare Rhip = vrotate ((HipsOff+SpineCoxx)*<-1,1,1>, HipsA); #declare Lknee = vrotate (<0,-ThighL,0>,LthighA) + Lhip ; #declare Rknee = vrotate (<0,-ThighL,0>,RthighA) + Rhip ; #declare Lankle = vrotate (<0,-ShinL,0>,LshinA) + Lknee ; #declare Rankle = vrotate (<0,-ShinL,0>,RshinA) + Rknee ; #declare Llbow = vrotate (<0,-UarmL,0>, LUarmA) + Lshou ; #declare Rlbow = vrotate (<0,-UarmL,0> ,RUarmA) + Rshou ; #declare Lwrist = vrotate (<0,-FarmL,0> ,LFarmA) + Llbow ; #declare Rwrist = vrotate (<0,-FarmL,0> ,RFarmA) + Rlbow ; #declare Lbutt = vrotate(SpineCoxx+ButtOff, HipsA); #declare Rbutt = vrotate(SpineCoxx+ButtOff*<-1,1,1>, HipsA); #ifdef(Coat) #undef Coat #end #ifdef(Hair) #undef Hair #end #ifdef(Trousers) #undef Trousers #end #end #macro Tor(Coords) vrotate(Coords-SpineBack, ChestA) +SpineBack #end #macro TwistBack(Coords) translate Coords-SpineBack rotate ChestA translate SpineBack #end //******************************************************************************************************************** #macro MakeTorso(Bulge,Thick) #declare B= Bulge ; #declare T= Thick ; #declare WaistOff = <0.06*Slm+.03*B, .0, -.04>*; #declare SpineRad = (.06+.03*B) *W; #declare ButtRad = (.12)*W+T; #declare WaistRad = (.1+.02*B)*W+T; #declare RibsRad = .1*W*(1+.25*Brd)+T; #declare ChestRad = (.08-F*.01)*W*(1+.5*Brd)+T; #declare Torso = #union { sphere_sweep{ cubic_spline 6 vrotate(SpineTail, HipsA), SpineRad+T vrotate(SpineCoxx, HipsA), SpineRad*.7+T <0, 0, 0>, SpineRad Tor(SpineRibs), SpineRad+T Tor(SpineNeck), SpineRad*.7+T Tor(SpineHunc), SpineRad+T } sphere_sweep{ cubic_spline 6 vrotate(SpineTail+ButtOff, HipsA), .01 Lbutt, ButtRad <0, 0, 0>+WaistOff, WaistRad Tor(SpineRibs+Ribsoff), RibsRad Tor(SpineNeck+ChestOff), ChestRad Tor(SpineHunc+ChestOff), .01 } sphere_sweep{ cubic_spline 6 vrotate(SpineTail+(ButtOff*<-1,1,1>), HipsA), .01 Rbutt, ButtRad <0, 0, 0>+(WaistOff*<-1,1,1>), WaistRad Tor(SpineRibs+(Ribsoff*<-1,1,1>)), RibsRad Tor(SpineNeck+(ChestOff*<-1,1,1>)), ChestRad Tor(SpineHunc+(ChestOff*<-1,1,1>)), .01 } #if (T>0 ) // Buttocks #local K = min ((1+T/.01),2); blob { threshold 1 sphere {Lbutt, (ButtRad)*K, K } sphere {Rbutt, (ButtRad)*K, K } } #end #local Tp = SpineNeck+ChestOff; #local Bt = SpineRibs+Ribsoff; #declare Breast_top = ; #declare Breast_mid = ; #declare Breast_rad =.8* RibsRad ; #declare Breast_flat =<1,1,.5+.5*F> ; #union { sphere_sweep { linear_spline 2 Breast_top,Breast_rad, Breast_mid,Breast_rad } sphere_sweep { linear_spline 2 Breast_top*<-1,1,1>,Breast_rad, Breast_mid*<-1,1,1>,Breast_rad } scale Breast_flat TwistBack(0) } sphere {SpineNeck+<0,0.01,-0.03>, .07*W+T TwistBack(0) } // neck #declare Sblade = #union{ sphere {<0,0,0>,.05*W+T } blob { threshold .3-T cylinder { <.13 ,0,-.04>*W,<.15 ,.03,-.04>*W .13*W, 1 } cylinder { <.13 ,0,-.04>*W,<.15 ,-.03,-.04>*W .13*W, 1} sphere {<.08,0,-.04>,.10*W, 1} } scale <1,.8,.6> rotate <30+StoopA,200, 0> translate ShoulOff } object {Sblade rotate LshouA TwistBack(Collar) } object {Sblade rotate RshouA scale<-1,1,1> TwistBack(Collar*<-1,1,1>)} sphere {<0,0,0>, 1 scale <.13*W*(1+.5*Tum)+T, .19*H+T, .096*W*(1+Tum)+T> translate<0,-.014*H,-.054*W*(1+.5*Tum)> rotate HipsA} // Tummy } #end //********************************************************* #macro Make_Hair(H_Style,Tex) #local Scale = .01*sqrt(H); #local Long = H_Style[0]*Scale ; #local Thick= H_Style[1]*Scale; #local Hang = radians(H_Style[2]); //angle #local Shoulder_push = H_Style[3]; #local Flare = H_Style[4]; #local Dangle = H_Style[5]*Scale; #local Fringe=H_Style[6]*Scale; #local FaceW = H_Style[7]*Scale; #local Side_Tilt = radians(H_Style[8]); //angle #local Set_Back = H_Style[9]*Scale; #local Face_Long = H_Style[10]*Scale; #local Hair_Texture = Tex ; #declare Hair = #union { #intersection { blob { threshold 1 cylinder {<0, NeckL, -HeadB>, <0, -Long, (Long+NeckL)* sin(Hang) -HeadB> Thick, .8} cylinder {<0, Fringe, -Set_Back>,<0, Fringe-Face_Long*cos(Side_Tilt) ,-Set_Back+Face_Long*sin(Side_Tilt)>,FaceW, -2} sphere {<0,0,0>, .2, Shoulder_push } sphere {<0,NeckL,-HeadB>, Long+NeckL, Flare } } box {<1,NeckL-Dangle,1>,<-1,1,-1>} texture {Hair_Texture} } #ifdef (Show_Hair_Cut) #if (Show_Hair_Cut) #union { sphere_sweep{ linear_spline 2 <0 ,Fringe ,-Set_Back>,FaceW<0,Fringe-Face_Long*cos(Side_Tilt),-Set_Back+Face_Long*sin(Side_Tilt)>, FaceW pigment {Blue transmit .75}} } #end #end } #end //********************************************************* #macro Make_Trousers(T_Style,Texture) #declare TrouThik = T_Style[0]*.01; #declare Waist_High = -T_Style[1]*.01*H; #declare Leg_Length = T_Style[2]; #declare Leg_Flare = T_Style[3]*.01*H; #declare Trou_Texture = texture {Texture}; #declare Trou_Shadow = pigment {Shadow_Colour}; MakeTorso(0,TrouThik) #declare Trousers = #intersection { object {Torso rotate -HipsA texture { Trou_Texture}} box{<-1,-1,-1>,<1,Waist_High,1> pigment {Shadow_Colour}} } #end //********************************************************* #macro Make_Coat(C_Style,Texture) // 0 1 2 3 4 5 6 7 8 9 10 12 // thick long Hips Waist fall neck neck neck neck sleeve sleeve // long fill Fill deg shape back wide line long flare #declare T = C_Style[0]*.01; #declare Length = C_Style[1]*.01*W; #declare Hips_Fill = C_Style[3]; #declare Bust_Fall_Angle = C_Style[4]; #declare Neck_Shape = C_Style[5]; #declare Neck_z = -C_Style[6]*.01*W; #declare Neck_Wide = C_Style[7]*.01*W; #declare Neck_Line = C_Style[8]*.01*H; #declare Sleeve_Length = C_Style[9]; #declare Sleeve_Flair = C_Style[10]*.01*H; #declare Coat_Texture = texture {Texture}; #declare Coat_Shadow = pigment {Shadow_Colour}; MakeTorso(C_Style[3],T) #declare Breast_hang = ; #declare Coat = #difference { #intersection { #union { object {Torso} blob { threshold 1-T cylinder {Lbutt, Lbutt-<0,1,0>, ButtRad*2 2} cylinder {Rbutt, Rbutt-<0,1,0>, ButtRad*2 2} } sphere_sweep{ linear_spline 2 <0,0,0>, HipR+.01 <0,-ThighL,0>,HipR+T rotate LthighA translate Lhip} sphere_sweep{ linear_spline 2 <0,0,0>, HipR+.01 <0,-ThighL,0>,HipR+T rotate RthighA translate Rhip} blob { threshold 1-T cylinder { Breast_top,Breast_mid,2*Breast_rad, 2 } cylinder { Breast_top*<-1,1,1>,Breast_mid*<-1,1,1>,2*Breast_rad, 2 } scale Breast_flat TwistBack(0) } #intersection { blob { threshold 1-T cylinder { Breast_mid,Breast_hang,2*Breast_rad, 2 } cylinder { Breast_mid*<-1,1,1>,Breast_hang*<-1,1,1>,2*Breast_rad, 2 } scale Breast_flat } box {<1,1,-1>,<-1,0,ChestOff.z>} TwistBack(0) } texture {Coat_Texture} } #if (Length,NeckH} pigment {Shadow_Colour } } #end } // neck superellipsoid { pigment {Shadow_Colour} rotate < 0,0,45> rotate <20, 0,0> scale translate <0,.4*H+NeckH-Neck_Line,Neck_z> TwistBack(0) } //sleevless #if (Sleeve_Length<0) sphere {Lshou,-Sleeve_Length*0.01*W pigment {Shadow_Colour } } sphere {Rshou,-Sleeve_Length*0.01*W pigment {Shadow_Colour } } #end } #end //************************************************************************************* #macro Place_Figure(Tra, Rot) MakeTorso(0,0) #declare Head = #union { #union { #difference { ovus { 1, .8 } cylinder {<-1, .7, 1.1>, < 1, .7, 1.1>, .37} } sphere_sweep{ linear_spline 2 <0, .5, 1>, .1 <0, 1,.9>, .2 } sphere {<0,0,0>,.4 scale <.2,1,1> rotate <0,-20,15> translate <1,.4,0>} sphere {<0,0,0>,.4 scale <.2,1,1> rotate <0,20,-15> translate <-1,.4,0>} scale HeadD rotate <200,0,0>+NodA translate <0,NeckL,-HeadB> } cylinder { <0,0,0> <0,NeckL,0> .05*sqrt(H) } pigment {SkinCol} } // thigh--------------------------------------------- #declare Thigh = #ifdef(Trousers) #union { sphere_sweep{ linear_spline 2 <0, 0, 0>, HipR <0,-ThighL, 0>, KneeR pigment {SkinCol} } #intersection{ sphere_sweep { linear_spline 2 <0,0,0>, HipR+.01 <0,-ThighL,0>,HipR+Leg_Flare texture { Trou_Texture} } box {<1,1,1>,<-1,-ThighL*Leg_Length,-1>} pigment {Trou_Shadow} } } #else sphere_sweep{ linear_spline 2 <0, 0, 0>, HipR <0,-ThighL, 0>, KneeR pigment {SkinCol} } #end // shin--------------------------------------------- #declare Shin = #declare Trou = 0; #ifdef(Trousers) #if (Leg_Length>1) #declare Trou = 1; #end #end #if (Trou) #union { sphere_sweep{ linear_spline 2 <0,0,0>, KneeR <0,-ShinL,0>, AnkleR pigment {SkinCol} } #intersection{ sphere_sweep { linear_spline 2 <0,0,0>, HipR+Leg_Flare <0,-ThighL,0>,HipR+2*Leg_Flare texture { Trou_Texture} } box {<1,1,1>,<-1,ThighL*(1-Leg_Length),-1>} pigment {Trou_Shadow} } } #else sphere_sweep{ linear_spline 2 <0,0,0>, KneeR <0,-ShinL,0>, AnkleR pigment {SkinCol} } #end // Left foot--------------------------------------------- #declare Lfoot = intersection { sphere_sweep{ linear_spline 4 < 0, 0, 0>, .04 < 0,-.05, 0>.05 <0.01,-.08,-.12>, .06 < 0,-.07,-.16>, .04 } box { <1,-.08,1> <-1,1,-1> } scale<1*H,.7*H,1*H> pigment {SkinCol} } // Right foot---------------- #declare Rfoot = object {Lfoot scale<-1,1,1>}; // upper arm---------------- #declare Uarm = #declare Do_sleeve = 0; #ifdef(Coat) #if (Sleeve_Length>0) #declare Do_sleeve = 1; #end #end #if (Do_sleeve) #union { sphere_sweep{ linear_spline 2 <0,0,0>, ShoulR , <0,-UarmL,0>,ElbowR pigment {SkinCol} } #intersection { sphere_sweep { linear_spline 2 <0,0,0>, ShoulR+T, <0, -UarmL,0>,ShoulR+Sleeve_Flair texture {Coat_Texture} } box {<1,1,1>,<-1,-UarmL*Sleeve_Length,-1>} pigment {Shadow_Colour} } #else sphere_sweep{ linear_spline 2 <0,0,0>, ShoulR <0,-UarmL,0>,ElbowR pigment {SkinCol} #end } // forearm---------------- #declare Farm = #declare Do_sleeve = 0; #ifdef(Coat) #if (Sleeve_Length>1) #declare Do_sleeve = 1; #end #end #if (Do_sleeve) #union { sphere_sweep{ linear_spline 2 <0,0,0>, ElbowR <0,-UarmL,0>,WristR pigment {Red} } #intersection { sphere_sweep { linear_spline 2 <0,0,0>, ShoulR+Sleeve_Flair <0,-UarmL,0>,ShoulR+2*Sleeve_Flair texture {Coat_Texture} } box {<1,1,1>,<-1,FarmL*(1-Sleeve_Length),-1> pigment {Shadow_Colour}} } #else sphere_sweep{ linear_spline 2 <0,0,0>, ElbowR <0,-UarmL,0>,WristR pigment {SkinCol} #end } // Left hand--------------------------------------------- #declare Lhand = #union { sphere { <0,0,0>, .025 scale<1,1.3,1.4> } sphere { <-0.02,-.1,0>, .09 scale<.17,1,.55> } sphere{ <-0.02,-.05,0>, .05 scale<.5,1,1> } sphere_sweep{ linear_spline 2 <-.02,-.05,-.04>, .02 <-.02,-.13,-.06>.01 } scale H pigment {SkinCol} } // Right hand--------------------------------------------- #declare Rhand = object {Lhand scale<-1,1,1>}; MakeTorso(0,0) #declare Lknee = vrotate (<0,-ThighL,0>,LthighA) + Lhip ; #declare Rknee = vrotate (<0,-ThighL,0>,RthighA) + Rhip ; #declare Lankle = vrotate (<0,-ShinL,0>,LshinA) + Lknee ; #declare Rankle = vrotate (<0,-ShinL,0>,RshinA) + Rknee ; #declare Llbow = vrotate (<0,-UarmL,0>, LUarmA) + Lshou ; #declare Rlbow = vrotate (<0,-UarmL,0> ,RUarmA) + Rshou ; #declare Lwrist = vrotate (<0,-FarmL,0> ,LFarmA) + Llbow ; #declare Rwrist = vrotate (<0,-FarmL,0> ,RFarmA) + Rlbow ; #declare Lower_Legs = #union { object {Shin rotate RshinA translate Rknee} object {Shin rotate LshinA translate Lknee} object {Lfoot rotate LshinA+LfootA translate Lankle} object {Rfoot rotate RshinA+RfootA translate Rankle} } #declare Figure = #union { object {Torso pigment {SkinCol} } object {Head rotate HeadA+ChestA translate Neck} #ifndef (Bust_Only) #declare Feet_Level =(min_extent(Lower_Legs)).y; #if (Is_Sitting) #declare Bottom = (SpineCoxx+ButtOff-ButtRad*.8).y; #declare Bot_Gap = Bottom-Seat_High-Feet_Level; #if (Bot_Gap >0) #declare ThighA_adjust = ; object {Lower_Legs translate <0,Bot_Gap,0>} #else #declare ThighA_adjust = 0; object {Lower_Legs} #end #declare Floor = Feet_Level+Bot_Gap; #else #declare ThighA_adjust = 0; #declare Floor =Feet_Level; object {Lower_Legs} #end object {Thigh rotate LthighA-ThighA_adjust translate Lhip} object {Thigh rotate RthighA-ThighA_adjust translate Rhip} object {Uarm rotate LUarmA translate Lshou} object {Uarm rotate RUarmA translate Rshou} object {Farm rotate LFarmA translate Llbow} object {Farm rotate RFarmA translate Rlbow} object {Lhand rotate LhandA rotate LFarmA translate Lwrist} object {Rhand rotate RhandA rotate RFarmA translate Rwrist} #end #ifdef(Hair) object {Hair rotate ChestA+HeadA translate Neck} #end #ifdef(Coat) object {Coat} #end #ifdef(Trousers) object {Trousers rotate HipsA} #end } object {Figure rotate Rot translate Tra-<0,Floor,0>} #end