def main // for use with dr for visualisation // undeclared variables new px,py,pz new a,b,c, fo, pi, cr num #####.### cr=\13+\10 pi=3.14159 // const px=0;py=0;pz=0; // defaults fo="main.pov"; output fo a="Generating scene script for POV Ray v3.1" b=time()+" "+uk.date ( date() )+" "+weekday ( date() ) c="file: "+fo print (a); print (b); print (c) $ // [a] $ // [b] $ // [c] $ white () info_text ("") // def modular_panel ( x,y,z,xw,yw,zw,ry, mat, frame, clad, quw ) // modular_panel ( 0,0,0, 10,50,1, 40, "", 1, 1, "11 1 1" ) // print ("done"); output // end still_life () // intersecting_lathes () main.structure () $#if (conservatory=1) small.structure () $#end $#if (geo_building=1) building () $#end output print () print ("done mooncoyn3") end def intersecting_lathes () $ difference { $ lathe { $ cubic_spline $ 7, $ <10, 15> $ < 5, 15> $ < 5, -10> $ <10, -10> $ <10, 15> $ < 5, 15> $ < 5, -10> $ } $ // cylinder { < 0, -10, 0>,< 0, 15, 0>, 10 } $ // box { < -20, 0, -20>,< 20, 5, 20> rotate 25*z } $ lathe { $ cubic_spline $ 7, $ <10, 15> $ < 5, 15> $ < 5, -10> $ <10, -10> $ <10, 15> $ < 5, 15> $ < 5, -10> $ scale < 0.7, 1.2, 0.7 > $ rotate 90*x $ } $ rotate 40*x $ scale 2 $ } end def still_life () $union { cup ( 0, 0, 0, 0) cup (30, 0, 0,-45) cup ( 0, 0,30,180) jug ( -40, 0,-10, 0 ) // silver_jug ( -40, 0,50, 10 ) spoon ( -30, 0, -40, 10, 0.75) spoon ( -40, 0, -50, -20, 0.75) plate ( 40, 0, -50, 0, 0.75) plate ( -5, 0, -55, 0, 1.00) circular_top () $scale 1 $} end def plate (x,y,z,ya,sc) $ union { $ difference { $ sphere {<0,10,0>,20} $ sphere {<0,10,0>,18} $ box { <-21,10,-21>,<21,50,21> } $ scale <1,0.3,1> $ } $ cylinder { <0,0,0>,<0,1,0>,16 } $ rotate [ya]*y $ scale [sc] $ translate <[x],[y],[z]> $ } end def spoon (x,y,z,ya,sc) $ union { $ // handle $ difference { $ prism { $ cubic_spline $ conic_sweep $ 0.5,1,7, $ <10,10> $ <-10,10> $ <-10,-10> $ <10,-10> $ <10,10> $ <-10,10> $ <-10,-10> $ scale < 0.8, 400, 0.25 > $ translate <0, -200, 1.5 > $ rotate 90*x $ } $ sphere { < 0,0,0 >, 20 $ scale < 1, 0.7, 2 > $ } // spoon void $ } // end diff $ $ // spoon end $ difference { $ sphere { < 0,0,0 >, 20 } $ sphere { < 0,0,0 >, 19 } $ box { < -25, 0, -25 >, < 25, 25, 25 > } $ scale < 1, 0.7, 2 > $ } $ translate 14*y sc=sc/5 $ scale [sc] $ rotate [ya]*y $ translate <[x],[y],[z]> // silver() $ } // union end def small.structure print ('visualise entension for Mooncoyne') do small.parameters $ #if (extension=1) do base do small.frames //do drainage cross.beams () do wall.plates do small.round.roof // do internal.partitions // do east.face $ #end end // small.structure def main.structure print ('visualise entension for Mooncoyne') do main.parameters $ #if (dimens) do dimensioning $ #end $ #if (furniture=1) furniture () $ #end $ #if (extension=1) do base do frames //do drainage cross.beams () do wall.plates do round.roof // do internal.partitions // do east.face $ #end $ #if (house=1) do main.house $ #end $#if (landscape) landscape () $#end end // main.structure def small.parameters do declarations print ('setting parameters') // 1 unit=0.1 metres th=1 // default thickness xqp=4 // number of west / east panels zqp=4 // number of north / south panel xi=7 // width of panels xw=xi*xqp // overall width xb=-35 // x origin with offset zf=0 // front distance zi=7 // side width increment yh=24.4 // height y1=0 // -42 // base offset y2=y1+yh // top y3=21+y1 // upper panels xc=xw/2+xb // roof centre yc=y2 // roof centre // roof parameters no front.roofover ll=xw*0.55 lht=9 // height of lane above base ebdry=531 // East boundary ( to centre of hedge ) yb=y1-.001 g=0.5 // gap yy1=y1 yy2=y2 yy3=y3 moff=-5 // main building x offset (northward) texx=0; texy=0; texz=0 // texture angles // boundaries xf=xb+xw; yf=yb-2 x=xb-15+moff y=yb; yn=yf z=zf+40; zn=210 xn=xb+moff+77+30+10 nbdry=x sbdry=xn end def main.parameters do declarations print ('setting parameters') // 1 unit=0.1 metres th=1 // default thickness xqp=10 // number of panels zqp=10 // number of panels xi=7 // width of panels xw=xi*xqp // overall width xb=-xw/2-3 // x origin with offset zf=40 // front distance zi=7 // side width increment yh=24.4 // height y1=0 // -42 // base offset y2=y1+yh // top y3=21+y1 // upper panels xc=xw/2+xb // roof centre yc=y2 // roof centre // roof parameters no front.roofover ll=38 lht=9 // height of lane above base ebdry=531 // East boundary ( to centre of hedge ) yb=y1-.001 g=0.5 // gap yy1=y1 yy2=y2 yy3=y3 moff=-5 // main building x offset (northward) texx=0; texy=0; texz=0 // texture angles // boundaries xf=xb+xw; yf=yb-2 x=xb-15+moff y=yb; yn=yf z=zf-40; zn=210 xn=xb+moff+77+30+10 nbdry=x sbdry=xn end def declarations new xx,rx,ry,rz,xn,yn,zn,rn,xf,yf,zf,xqp,zqp new ln,xt,yt,zt new th,xi,xw,xb,yb,zf,zb,zi,y1,y2,y3,y4,xc,yc,ll,yy1,yy2,yy3,yy4,xxi,yh new lht,moff,texx,texy,texz,texr new nbdry,sbdry,wbdry,ebdry new material,front.roofover new a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z end def dimensioning print ('dimensioning and labels') rx=0; ry=0; rz=0 s=4; ln=0 x=xb+moff y=80; z=110; rz=0; c=1; t="Mooncoyne"; do text // labels // dimensioning // horizontals s=4 ln=xw/2; x=xb; y=y2; n=ln/10; z=-5; rz=0; c=1; t="[n]M"; do text; z+1; do ruler ln=xw/2; x=0; y=y2; n=ln/10; z=25; rz=0; c=1; t="[n]M"; do text; z+1; do ruler x=xb+moff; y=70; ln=77; n=ln/10; z=105; rz=0; c=1; t="[n]M"; do text; z+1; do ruler // verticals x=xb-10; y=0; ln=y2; n=ln/10; z=-5; rz=90; c=1; t="[n]M"; do text; z+1; do ruler x=0; y=y2; ln=yc-y2+3; n=ln/10; z=-5; rz=90; c=1; t="[n]M"; do text; z+1; do ruler x=xb+moff; y=0; ln=62; n=ln/10; z=105; rz=90; c=1; t=". [n]M"; do text; z+1; do ruler ln=0 end def drainage print ("drain pipes") rx=0; rz=0 ry=-90; ln=50 x=xb+xw+4 y=y2-1 z=zf do gutter ry=0 do down.pipe rx=0; ry=0; rz=0 end def down.pipe rz=-90; ln=y2-y1-1 r=0.8 do pipe end def cedar $ #default { //$ texture { pigment { color Brown } } $ texture { pigment { color rgb <0.8, 0.4, 0.1 > } } $ finish { ambient 0.5 } $ normal { bumps 0 } $ } $ end def white $ #default { $ texture { pigment { color rgb <0.9, 0.9, 0.9 > } } //$ texture { pigment { White } } $ finish { ambient 0.5 } $ normal { bumps 0 } $ } $ end def base //$ box { < [x], [y], [z] >, < [xn], [yn], [zn] > //$ texture { pigment { color rgb < .8, .8, .8 > } } } print ('floor boards') $ // base $ // floor boards 20 cm $ union { i=xb e=i+xw z=zf; zn=zqp*zi+z; y=y1+.01; yn=yb loop x=i; xn=x+1.5-0.02 $ box { < [x], [y], [z] >, < [xn], [yn], [zn] > } // board i+1.5 when i>=e; exit endl //map $ texture { $ pigment { $ wood $ turbulence .1 $ octaves 3 $ color_map { // macro off $ [ 0.0 color rgb < 0.6, 0.6, 0.4> ] $ [ 0.3 color rgb < 0.5, 0.5, 0.4> ] $ [ 0.6 color rgb < 0.65, 0.55, 0.4> ] macro on // $ } // end color map $ } // end pigment $ scale < 0.2, 0.2, 20 > $ finish { phong 1 ambient 0.85 } $ normal { bumps 0.0 scale 5 } $ } // end texture $ } // end union end def small.frames new z0,z1,z2,x1,x2,xx,zz,xm,ym,zm,frame,fstyle,opn print ('frames') fstyle=0 //yy4=y2-y1/2 yy4=y2-4 xxi=xi opn="" // openings xi=xxi y1=yy1 y2=yy2 y3=yy3 // west upper opn=" " e=xqp m="n"; th=1 z0=zf x1=xb; z1=0 x2=xb+xi; z2=th y1=yy4 y2=yy2 xbox () y1=yy1 y2=yy4 // west middle y1+4 opn=" " m="g" e=xqp z0=zf m="n"; th=2 x1=xb; x2=x1+xi; z1=0; z2=th // Mid panels fstyle=0 opn=" 1 4 " xbox () // Side panels m="n" fstyle=0 opn= " 2 3 " x1=xb; x2=x1+xi xbox () fstyle=0 xi=xxi // west base opn=" " y2=y1 y1=yy1 fstyle=4 x1=xb; x2=x1+xi; z1=0; z2=th xbox () fstyle=0 opn= " " $// west internal panels $ #default { texture { pigment { color rgb <.9,.9,.9 > }} } // white y2=yy3 y1=yy1 x1=xb; x2=x1+xi; z1=zf+th+.01; z2=z1+.1 i=1 e=xqp e=0 loop when i>e; exit a=at(str(i),opn) if a=0 $ box { <[x1],[y1],[z1]>,<[x2],[y2],[z2]> } endif x1+xi; x2+xi; i+1 endl $// base below windows opn= " " y2=yy1+4 y1=yy1 x1=xb; x2=x1+xi; z1=zf+th+.01; z2=z1+.1 i=1 e=xqp loop when i>e; exit a=at(str(i),opn) if a=0 $ box { <[x1],[y1],[z1]>,<[x2],[y2],[z2]> } endif x1+xi; x2+xi; i+1 endl y1=yy1 y2=yy2 // North upper side opn=" " e=zqp m="n"; th=1 z0=zf x1=0 z1=0+xb x2=xi z2=th+xb y1=yy3; y2=yy2 zbox (1) // North lower side opn=" 8 " e=zqp m="t"; th=1 // t z0=zf y1=yy1 y2=yy3 x1=0 x2=xi z1=xb-th z2=th+z1 zbox (1) $ // North internal wall x=xb+th; xn=x+.1; i=1 z0=zf; z1=z0+xi loop a=at(str(i),opn) if a=0 $ box { $ <[x],[y1],[z0]>,<[xn],[y2],[z1]> $ texture { pigment { colour <0.9,0.9,0.9> }} $ } endif z0+xi; z1+xi; i+1 when i>e; exit endl y1=yy1 y2=yy2 // south side fstyle=0 //south top panes opn=" " e=zqp m="n"; th=1 z0=zf x1=0 x2=xi z1=0+xb+xw z2=th+xb+xw y1=yy3; y2=yy2 zbox (-1) // south mid panels y2=yy4 y1=yb+4 opn=" 2 3 " e=zqp m="n"; th=1 // t z0=zf x1=0 ; z1=0+xb+xw x2=xi ; z2=th+xb+xw zbox (-1) // south base opn=" 2 3 " m="n" y1=yb y2=y1+4 fstyle=4 x1=0; x2=xi; z1=0+xb+xw; z2=th+xb+xw zbox (-1) fstyle=0 y1=yy1 y2=yy2 end def zshelving i=1 loop when i>e; exit a=at(str(i),opn) if i=1 //panel without shelving at start zz=z0+th $ box { <[x],[y1],[zz]>,<[xn],[y2],[z1]> $ texture { pigment { colour <0.9,0.9,0.9> }} $ } a=1 endif if a=0 $ box { <[x],[y1],[z0]>,<[xn],[y2],[z1]> $ texture { pigment { colour <0.9,0.9,0.9> }} $ } $ // shelving $ union { $ // sides xm=-3 // shelf width ym=y2-y1 // shelving height zm=0.2 // shelving sides thickness yn=y1 $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z0]> } zm=-0.2 $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z1]> } $ texture { pigment { colour <0.9,0.9,0.9> }} $ } // $ // shelves $ union { xm=-3; zm=7; ym=.2 yn=y1+3.5 $ // shelf 1.. $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z0]> } yn=y1+7 $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z0]> } yn=y1+10.5 $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z0]> } yn=y1+14 $ box { <0,0,0>,<[xm],[ym],[zm]> translate <[x],[yn],[z0]> } // $ texture { pigment { colour <0.7,0.7,0.4> }} $ } $ sphere { <-2,1.2,3.5>,1 translate < [x],[yn],[z0] > texture { pigment { color < 1,0,0 > }} } endif z0+xi; z1+xi; i+1 endl end def frames new z0,z1,z2,x1,x2,xx,zz,xm,ym,zm,frame,fstyle,opn print ('frames') fstyle=0 //yy4=y2-y1/2 yy4=y2-4 xxi=xi opn="" // openings xi=xxi y1=yy1 y2=yy2 y3=yy3 // west upper opn=" " e=xqp m="n"; th=1 z0=zf x1=xb; z1=0 x2=xb+xi; z2=th y1=yy4 y2=yy2 xbox () y1=yy1 y2=yy4 // west middle y1+4 opn=" " m="g" e=xqp z0=zf m="n"; th=2 x1=xb; x2=x1+xi; z1=0; z2=th // Mid panels fstyle=0 opn=" 5 6 " xbox () // Side panels m="t" fstyle=0 opn= " 2 3 4 5 6 7 8 9 " x1=xb; x2=x1+xi xbox () fstyle=0 xi=xxi // west base opn=" 5 6 " y2=y1 y1=yy1 fstyle=4 x1=xb; x2=x1+xi; z1=0; z2=th xbox () fstyle=0 opn= " 2 3 4 5 6 7 8 9 " $// west internal panels $ #default { texture { pigment { color rgb <.9,.9,.9 > }} } // white y2=yy3 y1=yy1 x1=xb; x2=x1+xi; z1=zf+th+.01; z2=z1+.1 i=1 e=xqp loop when i>e; exit a=at(str(i),opn) if a=0 $ box { <[x1],[y1],[z1]>,<[x2],[y2],[z2]> } endif x1+xi; x2+xi; i+1 endl $// base below windows opn= " 1 10 5 6 " y2=yy1+4 y1=yy1 x1=xb; x2=x1+xi; z1=zf+th+.01; z2=z1+.1 i=1 e=xqp loop when i>e; exit a=at(str(i),opn) if a=0 $ box { <[x1],[y1],[z1]>,<[x2],[y2],[z2]> } endif x1+xi; x2+xi; i+1 endl y1=yy1 y2=yy2 // North upper side opn=" " e=zqp m="n"; th=1 z0=zf x1=0 z1=0+xb x2=xi z2=th+xb y1=yy3; y2=yy2 zbox (1) // North lower side opn=" 8 " e=zqp m="t"; th=1 // t z0=zf y1=yy1 y2=yy3 x1=0 x2=xi z1=xb-th z2=th+z1 zbox (1) $ // North internal wall x=xb+th; xn=x+.1; i=1 z0=zf; z1=z0+xi loop a=at(str(i),opn) if a=0 $ box { $ <[x],[y1],[z0]>,<[xn],[y2],[z1]> $ texture { pigment { colour <0.9,0.9,0.9> }} $ } endif z0+xi; z1+xi; i+1 when i>e; exit endl y1=yy1 y2=yy2 // south side fstyle=0 //south top panes opn=" " e=zqp m="n"; th=1 z0=zf x1=0 x2=xi z1=0+xb+xw z2=th+xb+xw y1=yy3; y2=yy2 zbox (-1) // south mid panels y2=yy4 y1=yb+4 opn=" 7 8 " e=zqp m="t"; th=1 // t z0=zf x1=0 ; z1=0+xb+xw x2=xi ; z2=th+xb+xw zbox (-1) // south base opn=" 7 8 " m="n" y1=yb y2=y1+4 fstyle=4 x1=0; x2=xi; z1=0+xb+xw; z2=th+xb+xw zbox (-1) fstyle=0 y1=yb y2=yy4 $ // South internal wall x=xb+xw-th; xn=x-1 z0=zf; z1=z0+xi e= zqp; do zshelving y1=yy1 y2=yy2 end def interior.wall.x1 do white x1=xb+th; x2=xw/2+xb; z4=zf+th+.1-30; z5=z4+.1 //$ box { <[x1],[y1],[z4]>, <[x2],[y3],[z5]> } // West interior wall x2=x1+.1; z5=zf+40 $ box { <[x1],[y1],[z4]>, <[x2],[y3],[z5]> } // North interior wall end def tub do cedar y=y1; yn=y1+6 $ difference { r=2.0; rn=2.7 $ cone { < [x],[y],[z] >,[r], <[x],[yn],[z] >, [rn] } r-0.2; rn-0.2; yn+.1 $ cone { < [x],[y],[z] >,[r], <[x],[yn],[z] >, [rn] } $ } $ end def east.face print ('interface to main building') x=xb+moff // shift y=yb z=108 yn=y2+4-yb xn=xw-moff $ difference { $ box { <0,0,0>, <[xn],[yn],.25> } // east panelling $ box { <32,0 ,-10>, <41,21,9> } // doorway void $ box { <50, 06, -1>, < 58.5, 28, 9> } // window right void $ box { <20, 06, -1>, < 28, 28, 9> } // window left void $ translate <[x],[y],[z]> $ texture { pigment { color White } } $ finish { ambient 0.3 } $ } $ end def main.house new pnx,pnz,x4,x5,x6,x7,y4,y5,y6,y7,z3,z4,z5,z6,z7 print ('main building') // main body $ //Mooncoyne px=12; pz=77 $ // bay stucture with window voids $ #declare mbay1= $ difference { $ box { <0,0,0>,<6, 8.5, -3> } $ box { <1,8,1>,<5, 28.5, -4> } $ rotate -45*y $ translate <[px], 0, [pz]> $ } // 45 degrees px=6*.707+px pz=6*.707+pz x5=px; z5=pz-2 x6=px+12; z6=pz-2 $ #declare mbay2= $ difference { $ box { <0,0,0>,<12, 8.5, -3> } $ box { <1,8,1>,<11, 28.5, -4> } $ rotate 0*y $ translate <[px], 0, [pz]> $ } px=12+px $ #declare mbay3= $ difference { $ box { <0,0,0>,<6, 8.5, -3> } $ box { <1,8,1>,<5, 28.5, -4> } $ rotate 45*y $ translate < [px], 0, [pz] > $ } $ #declare mbay= $ union { $ object {mbay1} $ object {mbay2} $ object {mbay3} $ // Bay Window posts $ cylinder { <[x5],8.5,[z5]>,<[x5],28.5,[z5]>,1 $ texture { pigment { color White }} $ } $ cylinder { <[x6],8.5,[z6]>,<[x6],28.5,[z6]>,1 $ texture { pigment { color White }} $ } $ translate <0,0,0> $ } // end union $ $ #declare m01= $ union { $ box { <0,0,0>, <77,62,77> } // main exterior $ box { <-14.5,0,15>, <0,27,47> } // porch exterior $ box { <-14.5,0,15>, <-12.5,15,-40> } // wall $ object { mbay } // bay walls and window voids x=77+moff y=y1+62 z=10; do chimney z=51; do chimney $ translate <0,0,0> $ } // end union $ x=xb+moff // shift y=yb z=110 $ $ difference { $ object { m01 } // main body $ box { <3,0,3>, <74, 61, 74> } // main interior void $ box { <-11.5,0,18>, <-2, 26, 44> } // porch interior void $ box { <-15.5,11,25>, <-11, 25, 39> } // porch window void $ box { <-1,3,43>, <-9, 26, 47.5> } // porch door void // $ box { <32,0 ,-10>, <41,21,9> } // doorway void $ box { <50, 06, -1>, < 58.5, 28, 9> } // window right void $ box { <20, 06, -1>, < 28, 28, 9> } // window left void //West upper $ box { <50, 06, -1>, < 58.5, 28, 9> } // window right void $ box { <34, 46, -1>, < 39, 55, 9> } // window centre void $ box { <13, 38, -1>, < 21.5, 58, 9> } // window left void $ box { <52, 38, -1>, < 61, 58, 9> } // window right void //East Upper $ box { <14, 40.5, 73>, < 30, 59.5, 78> } // window right void $ box { <49, 40.5, 73>, < 65.5, 59.5, 78> } // window left void //East Lower $ box { <12, 8.5, 73>, < 32, 28.5, 78> } // bay right void $ box { <49, 8, 73>, < 65.5, 28.5, 78> } // window left void //South $ box { <72, 38, 31>, < 77.1, 58, 39> } // window south void $ box { <72, 06, 31>, < 77.1, 28, 39> } // window south void // North $ box { <-5, 12, 5>, < 4, 20, 10> } // window north void $ box { <-5, 36, 22>, < 4, 55, 30> } // window north void $ translate <[x],[y],[z]> do pebbledash_white $ } $ $ // interior partitions //$ box { <3,0,20>, <74,62,21> translate <[x],[y],[z]> } //$ box { <3,0,30>, <74,62,31> translate <[x],[y],[z]> } ry=0 // west windows window1 ( 13, 38, 2, 21.5, 58, 2.5, 3, 2, .2 ) // upper window1 ( 20, 06, 2, 28, 28, 2.5, 3, 2, .2 ) // lower window1 ( 52, 38, 2, 61, 58, 2.5, 3, 2, .2 ) // upper window1 ( 50, 06, 2, 58.5, 28, 2.5, 3, 2, .2 ) // lower // east windows window1 ( 14, 40.5, 75, 18, 59.5, 75.5, 2, 2, .2 ) // upper right 1 window1 ( 18, 40.5, 75, 26, 59.5, 75.5, 4, 2, .2 ) // upper right 2 window1 ( 26, 40.5, 75, 30, 59.5, 75.5, 2, 2, .2 ) // upper right 3 window1 ( 49, 40.5, 75, 53, 59.5, 75.5, 2, 2, .2 ) // upper left 1 window1 ( 53, 40.5, 75, 61, 59.5, 75.5, 4, 2, .2 ) // upper left 2 window1 ( 61, 40.5, 75, 65, 59.5, 75.5, 2, 2, .2 ) // upper left 3 window1 ( 49, 8, 75, 53, 28.5, 75.5, 2, 2, .2 ) // lower left 1 window1 ( 53, 8, 75, 61, 28.5, 75.5, 4, 2, .2 ) // lower left 2 window1 ( 61, 8, 75, 65, 28.5, 75.5, 2, 2, .2 ) // lower left 3 // bay windows ry=-45 //75.707 window1 ( 12.707, 8, 77, 17.83, 28.5, 77, 2, 2, .2 ) // lower bay 1 ry=0 px=.707*6+12+1; pnx=px+10 pz=.707*6+75; pnz=pz+0.5 window1 ( [px], 8, [pz], [pnx], 28.5, [pnz], 5, 2, .2 ) // lower bay 2 px=11.707+px; pnx=px+4 ry=45 window1 ( [px], 8, [pz], [pnx] , 28.5, [pnz], 2, 2, .2 ) // lower bay 3 ry=0 // bay roof $ union { $ prism { $ linear_sweep linear_spline $ 0,1 $ 5 // points $ <11,77>,<15.95,81.95>,<27.95,81.95>,<32.9,77>,<11,77> $ } $ prism { $ linear_sweep linear_spline $ 1,2 $ 5 // points $ <10,77>,<16.95,82.95>,<28.95,82.95>,<33.9,77>,<10,77> $ } $ texture { pigment { color rgb < .7,.7,.7 > } } n=y+28.5 $ translate <[x],[n],[z]> $ } // end union // south windows //$ box { <72, 38, 31>, < 77.1, 58, 39> } // window south void ry=-90 window1 ( 75, 38, 31, 83, 58, 31.5 , 3, 2, .2 ) window1 ( 75, 06, 31, 83, 28, 31.5 , 3, 2, .2 ) // north windows // $ box { <-15.5,11,25>, <11, 25, 39> } // porch window void window1 (-12,11,25,2, 25, 25, 4,1,.2) // porch window // $ box { <-5, 36, 22>, < 4, 55, 30> } // window north void window1 ( 2, 36, 22, 10, 55, 22, 1,1,.2 ) // upper north window ry=0 $ // House roof $ union { $ triangle { <78.5,62.0,-1.5>,<43.5,96.0,38.5>,<78.5,62.0,78.5> } // south face $ triangle { <-1.5,62.0,-1.5>,<31.0,96.0,38.5>,<-1.5,62.0,78.5> } // north face $ triangle { <-1.5,62.0,-1.5>,<78.5,62.0,-1.5>,<31.0,96.0,38.5> } // west face 1 $ triangle { <43.5,96.0,38.5>,<78.5,62.0,-1.5>,<31.0,96.0,38.5> } // west face 2 $ triangle { <-1.5,62.0,78.5>,<78.5,62.0,78.5>,<31.0,96.0,38.5> } // east face 1 $ triangle { <43.5,96.0,38.5>,<78.5,62.0,78.5>,<31.0,96.0,38.5> } // east face 2 $ // Porch roof $ triangle { <-16,27,13>,<0,35,25>,<0,27,13> } // west $ triangle { <00,35,25>,<00,35,37>,<-16,27,30> } // north 1 $ triangle { <-16,27,13>,<0,35,25>,<-16,27,30> } // north 2 $ triangle { <-16,27,30>,<0,35,37>,<-16,27,49> } // north 3 $ triangle { <-16,27,49>,<0,35,37>,<0,27,49> } // east $ translate < [x],[y],[z] > $ texture { pigment { color rgb < .35, .35, .38 > } } $ finish { ambient 0.3 } $ normal { bumps 0.8 scale 0.01 } $ } $ end def window1 x1,y1,z1,x2,y2,z2,xq,yq,gg new xo, yo, zo,xg,yg,lx,ly xo=x1; yo=y1; zo=z1 x1=0; y1=0; z1=0 x2-xo; y2-yo; z2-zo $ difference { $ box { <[x1],[y1],[z1]>, < [x2],[y2],[z2]> } // window frame solid x1+gg+gg; x2-gg-gg; y1+gg; y2-gg // for outer frame // row of panes z3=z1-0.001 z4=z2+0.001 lx=x2-x1/ xq //ly=-lx*1.41 ly=-3 // fixed size when xq=1; ly=y1-y2/2 yg=-gg xg=gg y4=y2 j=0 loop x4=x1; y5=y4+ly; y6=y4+yg; y7=y5-yg; do wrow j+1; when j>=yq; exit y4=y5 endl y6=y5+yg; y7=y1-yg; x6=x1+xg; x7=x2-yg $ box { < [x6],[y6],[z3] >, < [x7],[y7],[z4] > } // lower window pane void $ $ texture { pigment { color White } } // rotate windows for north/south and bays $ rotate [ry]*y xo+x; yo+y; zo+z $ translate < [xo],[yo],[zo] > //$ finish { ambient 0.3 } $ } $ end def wrow i=0 loop x5=x4+lx; x6=x4+xg; x7=x5-xg $ box { < [x6],[y6],[z3] >, < [x7],[y7],[z4] > } // upper window pane voids i+1; when i>=xq; exit x4=x5 endl end def chimney $// chimney $ union { $ box { <0,0,0>,<6,27,8> } $ box { <-0.5,27,-0.5>,<6.5,29,8.5> } $// twin stack $ cylinder { <3,29,2>,<3,35,2>,1.5 pigment { color rgb < .8,.5,.4> } } $ cylinder { <3,29,6>,<3,35,6>,1.5 pigment { color rgb < .8,.5,.4> } } $ translate <[x],[y],[z]> $ } $ end def house.interior $ // house floors and partitions x=xb+moff+1; y=-1; z=110+1 xn=75+x; yn=1+y; zn=75+z $ union { $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 00*y } // ground $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 30*y } // first $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 61*y } // attick $ // partitions yn=y+62; z=z+15; zn=z+1 $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 00*y } // partition 1 yn=y+62; z=z+20; zn=z+1 $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 00*y } // partition 2 x=xb+40; xn=x+1; z=110+1; zn=z+75 $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> translate 00*y } // partition 3 $ $ texture { pigment { color < .8, .8, .8> } } $ normal { bumps 0.1 scale 0.1 } $ } end def crossbeam zn=z+1 // +th // cross beam $ box { < [x], [y], [z]>, < [xn], [yn], [zn] > } end def ornaments r=2; s=.666 x=-30; y=r+s+y1+6.5+.5 material="brass" z=55 do torus z=60 y=y1+r+6.5+.5 material="silver" do sphere z=65 y=y1+6.5+.5 material="brass" do cylinder $ // mirror z=53; zn=67; x=xb+1.5; xn=x+.1; y=9; yn=17 $ // frame $ // box { <[x],[y],[z]>,<[xn],[yn],[zn]> $ // texture { pigment { color rgb < 0, 0, 0.1 > } } finish { ambient 0 } $ // } $ // mirror surface $ intersection { x=xn+0.01; xn+3; y+0.5; yn-0.5; z+0.5; zn-0.5 $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> } $ // spherical surface r=3.5 x=xn-r+3 y=y+yn /2 z=z+zn /2 $ sphere { < [x],[y],[z] >, [r] } do silver $ } end def cylinder $ cylinder { $ <0,0,0>, <0,5,0>, [r] $ scale 1 $ translate < [x], [y], [z] > do [material] $ } end def sphere $ sphere { $ <0,0,0>, [r] $ scale 1 $ translate < [x], [y], [z] > do [material] $ } end def torus $ torus { $ [r], [s] $ scale 1 $ rotate < 90, 30, 0 > $ translate < [x], [y], [z] > do [material] $ } end def silver $ texture { pigment { color rgb < .1, .1, .1 > } } $ finish { $ ambient 0.0 $ // phong 0.7 $ // brilliance 0.9 $ // diffuse 0.9 $ // metallic .9 $ reflection rgb <0.80, 0.80, 0.80> $ } end def brass $ texture { pigment { color rgb < .2, .2, .1 > } } $ finish { $ ambient 0.0 $ // phong 0.7 $ // brilliance 0.9 $ // diffuse 0.9 $ // metallic .9 $ reflection rgb <0.8,0.8,0.5> $ } end def chair $ union { $ box { < -2.25, 4.5, -2.25>, < 2.25, 4.8, 2.25> $ texture { pigment { color rgb <.2,.5,.2>}} $ } // legs $ box { < -2.25, 0, -2.25>, < -1.75, 4.8, -1.75> } $ box { < 2.25, 0, -2.25>, < 1.75, 4.8, -1.75> } $ box { < -2.25, 0, 2.25>, < -1.75, 4.8, 1.75> } $ box { < 2.25, 0, 2.25>, < 1.75, 4.8, 1.75> } $ rotate <0,[r],0> $ translate <[x],[y1],[z]> $} end def workbench $ union { $ box { < -5.00, 7.5, -2.50>, < 5.00,09.0, 2.50> $ texture { pigment { color rgb < .8, .8, .8> } } $ } // legs $ box { < -5.00, 0, -2.50>, < -4.20, 7.5, -1.70> } $ box { < 5.00, 0, -2.50>, < 4.20, 7.5, -1.70> } $ box { < -5.00, 0, 2.50>, < -4.20, 7.5, 1.70> } $ box { < 5.00, 0, 2.50>, < 4.20, 7.5, 1.70> } $ rotate <0,[r],0> $ translate <[x],[y1],[z]> $} end def kitchen.unit $ union { $ box { < -5.00, 1.0, -2.50>, < 5.00,09.0, 2.50> } // legs $ box { < -5.00, 0, -2.50>, < -4.20, 1.0, -1.70> } $ box { < 5.00, 0, -2.50>, < 4.20, 1.0, -1.70> } $ box { < -5.00, 0, 2.50>, < -4.20, 1.0, 1.70> } $ box { < 5.00, 0, 2.50>, < 4.20, 1.0, 1.70> } $ rotate <0,[r],0> $ translate <[x],[y1],[z]> $ texture { pigment { color rgb <0.7,0.6,0 > } } $} end def wood pigment { wood turbulence 0.04 octaves 3 scale <0.05, .05, 1> } end def table do cedar //top x=xx; y=y1+6.5; z=zf+zz-40 xn=x+10; zn=z+20; yn=y+.5 $ box { $ <[x], [y], [z]>, < [xn], [yn], [zn]> //map $ texture { $ pigment { $ wood $ turbulence .1 $ octaves 3 $ color_map { // macro off $ [ 0.0 color rgb < 0.65, 0.35, 0.2> ] $ [ 0.3 color rgb < 0.60, 0.50, 0.2> ] $ [ 0.6 color rgb < 0.40, 0.35, 0.1> ] macro on // $ } // end color map $ } // end pigment $ scale < 0.2, 0.2, 20 > $ finish { reflection rgb < 0.5,0.4,0.2 > ambient 0.45 } $ } // end texture $ } // end top //legs x=xx+1; z=zf+zz+1-40; y=y1+6.5 xn=x+.5; zn=z+.5; yn=y1 $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } x=xx+8; z=zf+zz+1-40; y=y1+6.5 xn=x+.5; zn=z+.5; yn=y1 $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } x=xx+1; z=zf+zz+18-40; y=y1+6.5 xn=x+.5; zn=z+.5; yn=y1 $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } x=xx+8; z=zf+zz+18-40; y=y1+6.5 xn=x+.5; zn=z+.5; yn=y1 $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } end def small.round.roof new sb,eb,arc,panl,zo,raft,capping, rposts,segwidth,porch print ('roof supports') is raft th=2 arc=60; sb=0; eb=arc if front.roofover no panl no rposts is capping segwidth=7 zo=-segwidth z=zf+zo; roof.seg () endif zo=0 segwidth=70/10 is rposts z=zf+zo; roof.seg () is panl z=zf+zo; roof.seg () z=zf+zo; roof.seg () z=zf+zo; roof.seg () no panl is rposts segwidth=0 z=zf+zo; roof.seg () end def round.roof new sb,eb,arc,panl,zo,raft,capping, rposts,segwidth,porch print ('roof supports') is raft th=2 arc=50; sb=0; eb=arc if front.roofover no panl no rposts is capping segwidth=7 zo=-segwidth z=zf+zo; roof.seg () endif zo=0 segwidth=70/10 is rposts z=zf+zo; roof.seg () is panl z=zf+zo; roof.seg () z=zf+zo; roof.seg () z=zf+zo; roof.seg () z=zf+zo; roof.seg () z=zf+zo; roof.seg () no porch z=zf+zo; roof.seg () z=zf+zo; roof.seg () no porch z=zf+zo; roof.seg () z=zf+zo; roof.seg () no panl segwidth=0; no rposts z=zf+zo-th; roof.seg () end def roof.seg new aa,ee,ea,ni,nx,ln,ic,xt,yt,base,pct new aw,ym,gx,gth new rad,q,ai,el,bn // arc beams rad=ll /sin(arc/2) aa=sb; ee=eb a=arc /2; aa=aa+90-a i=sb ic=ee / xqp base=sin(aa)*rad // baseline for circular arcs loop x=-cos(aa); y=sin(aa) xt=x; yt=y aa+ic xn=-cos(aa); yn=sin(aa) a=atn(yn-y/(xn-x)); // perpendicular b=pyth(xn-x,yn-y,1)*rad +.5 x=x*rad+xc; y=y*rad+y2-base g=2; th=1 when raft; do beam1; // curved beam segment i+ic; when i>=ee; exit endl i=0 // down posts with regular spacing q=10 // number of panels xi=xw/q g=1; th=.5; a=90; y=y2 // first posts i=xi; el=0 when sb=0; i=-xw/2 el=xw/2 pct=0 loop x=xc+i b=pyth(rad,i,-1) -base if panl=0 when rposts; $ box { < 0,0,0 >,< 1, [b], [th] > translate < [x],[y],[z] > } // post external else // panels pct+1; p=panl // when pct=3; p=0 // open section // when pct=8; p=0 // open section if p if i,< 1, [b], [th] > } // internal post bn=pyth(rad,ni,-1) -base $ triangle { < 0,0,0>,< 0, [b],0>, <[nx], [bn],0> } // invert left panel 1 $ triangle { < [nx],0,0 >,< [nx], [bn],0>, <0,0,0> } // normal right panel 1 $ triangle { < 0,0,1>,< 0, [b],1>, <[nx], [bn],1> } // invert left panel 2 $ triangle { < [nx],0,1 >,< [nx], [bn],1>, <0,0,1> } // normal right panel 2 // ply.gus () $ translate < [x],[y],[z] > $ } endif // p endif // i endif // panl i+xi; when i>=el; exit endl if segwidth ai=arc/ xqp a=arc/2 i=90-a e=i+arc j=1 loop // longi // longitudinals and roof windows x=cos(i)*rad+xc; yn=sin(i)*rad-base+y2-.5 y=y2 $ union { if (rposts+panl) $ box { < 0, 0, 0 >, < 1, .5, [segwidth] > translate [y]*y } // lower longitudinal endif $ box { < 0, 0.0, 0 >, < 1, .5, [segwidth] > translate [yn]*y }// upper longitudinal c=0 when j>1; c=1 when porch; c=1 aw=i-90-(0.5*ai) // glass angle o=1 // glazing offset r=rad+o // extend radius for glazing ym=yn+o // glazing offset gx=sin(ai/2)*2*r // glass x gth=0.2 // glass panel thickness if c $ // glazing $ box { $ < 0, 0, 0 >, < [gx], [gth], [segwidth] > rotate [aw]*z translate [ym]*y $ texture { pigment { color rgbt < .5, .5, .5, .7 > } } $ } if capping $// lateral capping $ cylinder { $ < 0, 0, .5 >, < [gx], [gth], .5 >,.5 rotate [aw]*z translate [ym]*y $ texture { pigment { color rgbt < .9, .9, .9, 0 > } } $ } endif // capping endif // c $ // rotate [ea]*x $ translate < [x], 0, [z] > $ pigment { color rgb < .9, .9, .9 > } $ } // end union j+1; i+ai; when i>e; exit endl // longi endif // segwidth zo+segwidth end def ply.gus new b1,b2 // reinforcements using ply gussetts b1=b b2=b1-1 $ triangle { < 1,[b1], 0 >,< 2, [b1],0>, <1, [b2],0> } // gusset $ triangle { < 0,[b1], 0 >,< -1, [b1],0>, <0, [b2],0> } // gusset b1=1 b2=b1+1 $ triangle { < 1,[b1], 0 >,< 2, [b1],0>, <1, [b2],0> } // gusset $ triangle { < 0,[b1], 0 >,< -1, [b1],0>, <0, [b2],0> } // gusset b1=b b2=b1-1 $ triangle { < 1,[b1], 1 >,< 2, [b1],1>, <1, [b2],1> } // gusset $ triangle { < 0,[b1], 1 >,< -1, [b1],1>, <0, [b2],1> } // gusset b1=1 b2=b1+1 $ triangle { < 1,[b1], 1 >,< 2, [b1],1>, <1, [b2],1> } // gusset $ triangle { < 0,[b1], 1 >,< -1, [b1],1>, <0, [b2],1> } // gusset $ triangle { < 0 ,0, 0 >,< 1, 0,0>, <7,[b],0> } // rib panel $ triangle { < 0 ,0, 0 >,< 7, [b],0>, <0,[b],0> } // rib panel $ triangle { < 0 ,0, 0 >,< 7, 0,0>, <7,[b],[th]> } // rib panel $ triangle { < 0 ,0, 0 >,< 7, [b],0>, <0,[b],[th]> } // rib panel end def beam1 $ box { < 0, 0, 0>, < [b], [th], 1> $ rotate < 0, 0, [a]> $ translate < [x], [y], [z] > $ } end def copper macro off // dome patinated copper surface $ #default { $ texture { $ pigment { $ agate $ agate_turb 0.6 $ lambda 1.5 $ omega 0.75 $ octaves 8 $ color_map { $ [ 1 color rgb < .40, .55, .55 > ] $ [ 0.7 color rgbft < .35 .65, .65, 0 , 0 > ] $ } $ } // end pigment $ } $ finish { $ phong .05 $ phong_size .9 $ ambient 0.5 $ brilliance .4 $ diffuse 0.5 $ } //$ normal { bumps 0.1 scale .2 } $ } macro on end def xbox new zs,ze,xk,yk,x11,y11,x12,y12,ga,z3,z4 // frontways i=1 zs=z1+z0; ze=z2+z0 loop // beware -ve coords xk=g; when x2, < [k], [y12], [ze] > } k=j+w-ga zs-(th/2) $box { < [j], [y11], [zs] >, < [k], [y12], [ze] > } do tex $ } // union j+w; when j>=x12; exit endl endif x1+xi; x2+xi i+1; when i>e ; exit endl end def zbox ori new zs,ze,xk,yk,x11,y11,x12,y12,ga,z3,z4,z5,z6,k1,k2 // sideways i=1 loop xk=g; when x20 k=j+w-ga; z2-t $ box { < [z1], [y11], [j] >, < [z2], [y12], [k] > } k=j+w; z2+t; z1+t $ box { < [z1], [y11], [j] >, < [z2], [y12], [k] > } z1-(th/2) else k=j+w; z2-t $ box { < [z1], [y11], [j] >, < [z2], [y12], [k] > } k=j+w-ga; z2+t; z1+t $ box { < [z1], [y11], [j] >, < [z2], [y12], [k] > } z1-t endif j+w; when j>=ze; exit endl do tex //$ texture { pigment { color rgb <1,0,0> }} $ } // union endif // x1+xi; x2+xi i+1; when i>e ; exit endl end def frames.x new xkk,ykk,xf,yf,z11,x12,y12,z12,x13,y13,z13,xd,yd,ipanel do [frame] // given x1 x2 y1 y2 z1 z2 // xk yk frame thickness //slightly larger than panels xkk=xk*.99 ykk=yk*.99 xf=x1+xkk if fstyle=0 // verticals $ box { < [x1], [y1], [zs] >, < [xf], [y2], [ze] > } xf=x2-xkk $ box { < [x2], [y1], [zs] >, < [xf], [y2], [ze] > } //horizontals yf=y1+ykk $ box { < [x1], [y1], [zs] >, < [x2], [yf], [ze] > } yf=y2-ykk $ box { < [x1], [y2], [zs] >, < [x2], [yf], [ze] > } elseif fstyle=1 // clear window voids $ difference { $ box { < [x1], [y1], [zs] >, < [x2], [y2], [ze] > } z11=-5; z12=5 x13=x1; y13=y1; z13=zs nx=1; ny=1 xd=x2-x1; yd=y2-y1 x11=xkk y11=ykk x12=xd/ nx-xkk y12=yd/ ny-ykk do boxf when nx>1; x13+(xd/ nx); do boxf if ny>1 y13+(yd/ ny); do boxf when nx>1; x13-(xd/ nx); do boxf endif $ } ipanel=1 // interior panel // buff if ipanel=1 z11=1; z12=1.5 $ box { < [x11], [y11], [z11] >, < [x12], [y12], [z12] > translate <[x13],[y13],[z13]> $ texture { pigment { color rgb <0.4,0.4,0.3> } } $ } z11=1.5; z12=2 $ box { < [x11], [y11], [z11] >, < [x12], [y12], [z12] > translate <[x13],[y13],[z13]> $ texture { pigment { color rgb <0.9,0.9,0.9> } } $ } endif elseif fstyle=2 // exterior panel white $ box { < [x1], [y1], [zs] >, < [x2], [y2], [ze] > $ texture { pigment { color rgb <0.9,0.9,0.9> } } $ } elseif fstyle=3 // exterior panel rendered $ box { < [x1], [y1], [zs] >, < [x2], [y2], [ze] > do pebbledash_white $ } elseif fstyle=4 // exterior panel stone clad z11=zs-2; z12=ze+.1 $ box { < [x1], [y1], [z11] >, < [x2], [y2], [z12] > do stone $ } endif end def boxf $ box { < [x11], [y11], [z11] >, < [x12], [y12], [z12] > translate <[x13],[y13],[z13]> } end def frames.z new xkk,ykk,xf,yf,z11,z12 do [frame] // given x1 x2 y1 y2 z1 z2 //slightly larger than panels zs=x1+z0; ze=x2+z0 //$ box { < [z1], [y1], [zs] >, < [z2], [y2], [ze] > } // verticals xkk=xk*.99 ykk=yk*.99 xf=zs+xkk if fstyle=0 // verticals // left $box { < [z1], [y1], [zs] >, < [z2], [y2], [xf] > } // right xf=ze-xkk $box { < [z1], [y1], [ze] >, < [z2], [y2], [xf] > } //horizontals yf=y1+ykk // bottom $box { < [z1], [y1], [zs] >, < [z2], [yf], [ze] > } yf=y2-ykk // top $box { < [z1], [y2], [zs] >, < [z2], [yf], [ze] > } elseif fstyle=1 // window voids to do elseif fstyle=2 // exterior panel white $ box { < [z1], [y1], [zs] >, < [z2], [y2], [ze] > $ texture { pigment { color rgb <0.9,0.9,0.9> } } $ } elseif fstyle=3 // exterior panel rendered $ box { < [z1], [y1], [zs] >, < [z2], [y2], [ze] > do pebbledash_white $ } elseif fstyle=4 // exterior panel stone clad z11=zs-2; z12=ze+.1 $ box { < [z1], [y1], [z11] >, < [z2], [y2], [ze] > texy=90; do stone; texy=0 $ } endif end def modular_panel ( x,y,z,xw,yw,zw,ry, mat, frame, clad, quw ) new zz=zw+0.1, zt=zw/2, i, j, q=0 $ union { loop q+1; when q>~quw; exit when mid(quw,q,1)=" "; x+xw; reloop if frame $ // inner frame $ union { $ // void $ difference { endif $ union { // of int + ext panels $ union { // of exterior panels if clad i=0 loop when i>=xw; exit i+1; j=i+0.8 $ box { <[i],0,0>,<[j],[yw],[zt]>} j+0.2 $ box { <[i],0,[zt]>,<[j],[yw],[zw]>} endl else // not clad $ box { <0,0,0>,<[xw],[yw],[zw]> // no clad endif if mat texy=ry do [mat] // stone texy=0 else // no mat $ texture { pigment { color rgb < 0.9,0.9,0.9 > }} endif $ translate [x]*x $ } // union of exterior panels $ box { // int panel $ <0,0,[zw]>,<[xw],[yw],[zz]> $ texture { pigment { color rgb < 0.9,0.9,0.9 > }} $ translate [x]*x $ } // box int panel $ } // union ext and int panels if frame // make hole xw-1; yw-1; zw+0.2 $ box { <1,1,-0.1>,<[xw],[yw],[zw]> $ translate [x]*x $ } // hole $ } // end difference $ difference { // inner frame $ box { <1,1,0.2>,<[xw],[yw],0.7> } // make inner hole $ box { <1.5,1.5,-0.1>,<[xw],[yw],[zw]> } xw-0.5; yw-0.5; zw-0.2 $ texture { pigment { color rgb < 0.9,0.9,0.9 > }} $ translate [x]*x $ } // inner frame $ } // union with inner frame xw+1.5; yw+1.5 endif x+xw endl // quw $ rotate [ry]*y $ translate < 0,[y],[z] > $ } // panel unit end def tex if m="g" $ texture { pigment { Clear } } elseif m="t" $ texture { pigment { color rgb < 0.8, 0.8, 0.8 > } } // white //$ texture { pigment { color rgb < 0.55, 0.40, 0.35 > } } // cedar painted $ normal { bumps 0.1 scale .1 } endif end def vegetation $ texture { $ pigment { $ agate $ turbulence .7 $ color_map { // macro off $ [ 0.0 color rgb < 0.2, 0.2, 0.1> ] $ [ 0.2 color rgb < 0.7, 0.9, 0.6> ] $ [ 0.9 color rgb < 0.4, 0.9, 0.5> ] macro on // $ } // end color map $ } // end pigment $ scale < .3, 3, .3 > $ finish { ambient 0.2 } $ normal { bumps 3.9 scale 0.5 } $ } // end texture end def grass $ texture { $ pigment { $ agate $ turbulence .7 $ color_map { // macro off $ [ 0.0 color rgb < 0.2, 0.2, 0.1> ] $ [ 0.2 color rgb < 0.7, 0.9, 0.6> ] $ [ 0.9 color rgb < 0.4, 0.9, 0.5> ] macro on $ } // end color map // $ } // end pigment $ scale < .3, 3, .3 > $ finish { ambient 0.2 } $ normal { bumps 3.9 scale 0.15 } $ } // end texture end def stem (amb,blue,scale) new s $ texture { $ pigment { $ wood $ octaves 3 $ turbulence .7 $ color_map { s=\91+" 0.3 color rgb < 0.6, 0.4, [blue] > "+\93+\13+\10 macro off $ [ 0.0 color rgb < 0.3, 0.2, 0.1 > ] out s $ [ 0.6 color rgb < 0.6, 0.6, 0.4 > ] macro on $ } // end color map $ } // end pigment $ scale < .3, 20, .3 > $ finish { ambient [amb] } $ normal { bumps 0 scale [scale] } $ } // end texture end def herbage (amb,blue,scale) new s $ texture { $ pigment { $ agate $ turbulence .8 octaves 3 $ color_map { s=\91+" 0.2 color rgb < 0.4, 0.9, [blue] > "+\93+\13+\10 macro off $ [ 0.0 color rgb < 0.4, 0.2, 0.1 > ] out s $ [ 0.8 color rgb < 0.8, 0.9, 0.4 > ] $ [ 0.9 color rgb < 0.2, 0.2, 0.2 > ] macro on $ } // end color map $ } // end pigment $ scale < .3, 3, .3 > $ finish { ambient [amb] } $ normal { bumps 4 scale [scale] } $ } // end texture end def rocks $ texture { $ pigment { $ bozo $ turbulence .7 $ color_map { // macro off //$ [ 0.0 color rgb < 0.2, 0.2, 0.2> ] $ [ 0.0 color rgbt < 1, 1, 1, 1 > ] $ [ 0.7 color rgb < 0.5, 0.5, 0.5> ] $ [ 0.9 color rgb < 0.8, 0.8, 0.8> ] macro on $ } // end color map $ } // end pigment $ scale 8 //< 90, 90, 90 > $ finish { ambient 0.1 } $ normal { bumps 3 scale 1.0 } $ } // end texture end def privet.hedge $ box { < [x],[y],[z] >, < [xn],[yn],[zn] > do vegetation $ } end def stone.wall $ box { < [x],[y],[z] >, < [xn],[yn],[zn] > do rocks $ } end def lawn $ box { < [x],[y],[z] >, < [xn],[yn],[zn] > do grass $ } end def wall ym=yn-1 $ box { <0,0,0>, < [xn],[ym],[zn] > do [material] $ rotate [a]*y $ translate < [x],[y],[z] > $ } texx=0; texz=0 $ box { <0,[ym],0>, < [xn],[yn],[zn] > texx=90; do [material] $ rotate [a]*y $ translate < [x],[y],[z] > $ } texx=0; texy=0; texz=0 end def long.grass $ texture { $ pigment { $ agate $ turbulence .7 $ color_map { // macro off $ [ 0.0 color rgb < 0.2, 0.1, 0.1> ] $ [ 0.2 color rgb < 0.7, 0.9, 0.6> ] $ [ 0.9 color rgb < 0.4, 0.9, 0.5> ] macro on $ } // end color map // $ } // end pigment $ scale < .3, 3, .3 > $ finish { ambient 0.2 } $ normal { bumps 4 scale < 0.07, 0.9, 0.07 > } $ } // end texture end def gravel.path $// gravel path $ box { $ < [x], [y], [z] >, < [xn], [yn], [zn] > do gravel $ } end def rockery $ box { $ < [x], [y], [z] >, < [xn], [yn], [zn] > herbage (0.1,0.7,5) // amb blue scale $ } end def gravel $ texture { $ pigment { $ granite $ turbulence 0.5 $ color_map { macro off $ [ 0.0 color rgb < 0.8, 0.8, 0.85 > ] $ [ 0.7 color rgb < 0.4, 0.4, 0.44 > ] macro on $ } // color_map $ } // texture $ normal { granite .9 scale .5 } $ finish { ambient .3 } $ } // end texture end def ground $ texture { $ pigment { $ color rgb < 0.5, 0.4, 0.4 > $ } // end pigment $ normal { bumps .9 scale .2 } $ } // end texture end def info_text t $ //info "[t]" $ text { ttf "arial.ttf" title .1,0 $ #if (ortho=1) $ scale 10 $ translate <-60, 40, 0> $ #else $ scale .05 $ translate <-0.3, 0.2, 0> $ #end $ rotate < (my_elev*180/3.14159), (-(my_angle-0.75)*360), 0 > // scene.pov $ translate < (tx_dist*cos(radn)+look_x), (tx_radius*sin(my_elev)+look_y), (tx_dist*sin(radn)+look_z) > $ pigment { color rgb < 1,1,1 > } $ finish { ambient .7 } $ } end def text $#if (dimens) xt=x; yt=y; zt=z when rz=0; xt=ln/2+x when rz=90; yt=ln/2+y when ry=90; zt=ln/2+z num ###.## $ text { ttf "arial.ttf" "[t]" .1,0 num #####.### $ scale [s] rotate <[rx],[ry],[rz]> translate <[xt],[yt],[zt]> if c=1 $ pigment { color rgb < 1,1,1 > } elseif c=2 $ pigment { color rgb < .9,.9,.2 > } else $ pigment { color rgb < .1,.1,.0 > } endif $ finish { ambient .7 } $ } $#end end def ruler $#if (dimens) xt=0 $ union { loop $ cylinder { 0*x, 5*x, .3 translate [xt]*x $ pigment { color rgb <.8,.8,0> } finish { ambient 1 } } xt+5; when xt>=ln; exit $ cylinder { 0*x, 5*x, .3 translate [xt]*x pigment { Black } } xt+5; when xt>=ln; exit endl $ rotate < [rx],[ry],[rz] > translate < [x],[y],[z] > $ } $#end end def gutter $ difference { $ cylinder { 0*x, [ln]*x, 1 } ln+.1 $ box { <-0.1, 0,-1.1 >,<[ln], 1.1, 1.1 > } ln-.1 $ rotate < [rx],[ry],[rz] > translate < [x],[y],[z] > $ texture { Bronze_Metal } $ finish { ambient .5 metallic .8 } $ } // end difference end def pipe $ cylinder { 0*x, [ln]*x, [r] $ rotate < [rx],[ry],[rz] > translate < [x],[y],[z] > $ texture { Bronze_Metal } $ finish { ambient .5 metallic .8 } $ } // end difference end def floral (am,r,g,b,scale) new s // $ texture { $ pigment { $ agate $ turbulence .5 $ color_map { // s=\91+" 0.1 color rgbt < [r], [g], [b], 0.1 > "+\93+\13+\10 out s macro off //$ [ 0.1 color rgbt < 1.0, 0.0, 1.0, 0 > ] $ [ 0.3 color rgbt < 1.0, 1.0, 1.0, 1 > ] macro on // $ } // end color map $ } // end pigment $ scale [scale] $ finish { ambient [am] } $ } // end texture end def frond // vegetation $ texture { $ pigment { $ agate $ turbulence .7 $ color_map { // macro off // $ [ 0.1 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.2 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.3 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.4 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.5 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.6 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.7 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.8 color rgbt < 1.0, 1.0, 1.0, 1 > ] $ [ 0.90 color rgbt < 0.6, 0.9, 0.4, 0 > ] $ [ 0.94 color rgbt < 0.6, 0.9, 0.3, 0 > ] $ [ 0.95 color rgbt < 0.2, 0.2, 0.2, 0 > ] macro on // $ } // end color map $ } // end pigment $ scale < 10, 10, 10 > //$ normal { bumps 9 scale 0.5 } $ finish { ambient [am] } $ } // end texture end def tier //for tree $ union { $ cone { 0,[r], -20*y, .1 } $ sphere { 0, [r] } $ scale < 1, .3, 2 > $ rotate < 0,[a],0> $ translate <[xo],[yo],[zo] > do frond $ } end def tree1 new xo,yo,rn $ union { // trunk r=1; rn=0.4 $ cone { < 0,0,0 >,[r], <0,[yn],0 >, [rn] $ pigment { color rgb < .6,.5, .5 > } $ } $ yo=yn+10; r=10; a=0 // fronds xo=0 yo-5; a+10; zo=-2; r=07; do tier yo-5; a-10; zo=+2; r=08; do tier yo-5; a+10; zo=-2; r=09; do tier yo-5; a-10; zo=+2; r=10; do tier yo-5; a+10; zo=-2; r=11; do tier yo-5; a-10; zo=+2; r=12; do tier yo-5; a+10; zo=-2; r=12; do tier yo-5; a-10; zo=+2; r=12; do tier $ // whole tree $ scale [sct] $ translate < [x],[y],[z] > $ } // end union tree end def landscape new yp,zp,am,hv,hw,sct print ('landscape') yp=yb-2-5.5 $// ground plane $ cylinder { $ <0,-9,0>,<0,[yp],0>,1000 $ rotate 1.5 * z do ground $ } yp=yb-2 zp=6100 $ box { < -1000,[yb],-200>,<1000,[yp],[zp]> $ rotate <1.5,0,1.5> // 4% slope do ground $ } // mat over garage floor recess //x=xb; z=zf+10; xn=x+40; y=yb; yn=y+0.1; zn=z+75 //$ box { < [x], [y], [z] >, < [xn], [yn], [zn] > //$ texture {pigment{color rgb < 0.4, 0.6, 0.6> } } //$ } //gravel path south side x=xb+77+moff; xn=x+10; y=yb; yn=yb+.25; z=100; zn=ebdry; do gravel.path // long path x=xb+xw; xn=x+10; z=30; zn=110; do gravel.path // side of extn x=xb; xn=x+xw+10; z=30; zn=40; do gravel.path // entrance area xn=sbdry; x=xn-10; y=y1; yn=y+16; z=0; zn=ebdry; do privet.hedge // south ry=-90; y=y2; ln=ebdry; do ruler; ry=0 x=sbdry+30; xn=x+70; y=yb; yn=y+.25; z=40; zn=220; do lawn // south Glenda x=xb+moff; xn=x+77; y=yb; yn=yb+2; z=187; zn=207; do rockery // front of house x=xb+moff; xn=x+87; y=yb; yn=yb+.25; z=207; zn=217; do gravel.path // front of house $ difference { // terrace x=nbdry+10; xn=sbdry-40; y=y1-2; yn=y+2; z=217; zn=297; do lawn // east 1 Charles x=-14; y-0.1; z=260; r=24 $ // void for rotunda $ cylinder { $ <0, -1, 0>, <0, 3, 0> ,[r] $ translate < [x],[y],[z] > $ } $ } // end difference $ // Hydrangea 1 $ union { $ sphere { <0,0,0>, 10 herbage (0.25,0.4,2.5) // amb blue scale $ } $ sphere { <0,0,0>, 11 floral (0.8,0.7,0.7,0.7,4) // amb r g b sc $ } $ scale < 1, 1.4, 1.0 > xn=sbdry-50; yn=yb; zn=240 $ scale 0.85 $ translate < [xn],[yn],[zn] > $ } $ // Hydrangea 2 $ union { $ sphere { <0,0,0>, 10 herbage (0.25,0.4,2.5) // amb blue scale $ } $ sphere { <0,0,0>, 11 floral (0.8,0.6,0.6,0.8,4) // amb r g b sc $ } $ scale < 1, 1.4, 1.0 > xn=sbdry-50; yn=yb; zn=280 $ translate < [xn],[yn],[zn] > $ } $ // Hydrangea 3 $ union { $ sphere { <0,0,0>, 10 herbage (0.25,0.4,2.5) // amb blue scale $ } $ sphere { <0,0,0>, 11 floral (0.8,0.6,0.6,0.8,4) // amb r g b sc $ } $ scale < 1, 1.4, 1.0 > xn=sbdry-50; yn=yb; zn=330 $ translate < [xn],[yn],[zn] > $ } $ // terrace wall x=nbdry+10; xn=sbdry-50-x; y=y1-2-5; yn=8; z=300; zn=10; $ box { $ < 0,0,0>, <[xn],[yn],[zn]> $ rotate 20*x $ translate <[x],[y],[z]> texx=20; do stone $ } // lawn below terrace x=nbdry+10; xn=sbdry-40; y=y1-2-5; yn=y+2; z=310; zn=ebdry $ box { $ < [x],[y],[z] >, < [xn],[yn],[zn] > do long.grass $ } // east 2 Charles lawn //x=nbdry+10; xn=sbdry; y=y1-2; yn=y+2; z=zf-5; zn=zf-35; do lawn // west Charles x=nbdry-40; xn=nbdry-80; y=y1-2; yn=y+2; z=210; zn=ebdry; do lawn // north Gwen x=nbdry; xn=xb+70; y=y1; yn=y+16; z=ebdry-5; zn=ebdry+5; do privet.hedge // east / lampit way // gap for front gate x=xb+80; xn=sbdry; y=y1; yn=y+16; z=ebdry-5; zn=ebdry+5; do privet.hedge // east / lampit way xn=sbdry y=y1+lht; yn=y+10; z=-15; zn=z+8 xn-0 ; x=xn-40; //do stone.wall // west xn+50; x=xn-40; xn=300; yn=6; zn=8 x=sbdry; y=y1+7; z=-17 a=atn(2/12) // lane and hedge skew a=-a material="long.grass"; do wall // west x=sbdry-30-1; xn=30 zn=7; yn=5 material="stone"; do wall x=0; y=y1+lht; z=-30; do lane // private lane ln=y; n=ln/10; s=3; x=0; y=y1; z=z-25-2; rz=90; c=1; t="[n]M"; do text; x+1; z+1; do ruler a=0 // no skew x=0; y=y1; z=ebdry+14+25; do lane // Lampit way // x=-300; y=y1; z=ebdry+14+25; xn=300; yn=y+2; zn=z+30; do lawn // east verge Lampit way // boundary dims hw=10 n=hw /10; s=4; x=nbdry; y=y1+18; z=zf+30; rz=0; c=1 t="<-[n]->"; do text n=hw /10; s=4; x=sbdry-hw; y=y1+18; z=zf+30; rz=0; c=1 t="<-[n]->"; do text n=xb-nbdry-hw /10; s=4; x=nbdry+10; y=y1+10; z=zf-1; rz=0; c=1 t="<-[n]->"; do text n=sbdry-xb-xw-hw-th /10; s=4; x=xb+xw+1; y=y1+10; z=zf+30; rz=0; c=1 t="<-[n]->"; do text x=nbdry; xn=x+hw; y=y1; yn=y+17; z=30; zn=70; do privet.hedge // north west wbdry=-20 x=nbdry; xn=hw; y=y1; yn=10; z=wbdry; zn=30-z; material="stone"; a=0; do wall; texy=90; do wall // north west base $ // sloping ground $ box { $ <0,0,0>,<-200,1,-150> do ground x=nbdry-10 z=110 $ rotate < 3,0,0 > $ translate < [x],[y1],[z] > $ } x=nbdry; xn=x+hw; y=y1; yn=y+17; z=158; zn=ebdry; do privet.hedge // north east // need wooden fence plants () $#if (trees=1) trees () $#end end //landscape def plants $ union { $ // trunk $ union { $ cone { < -10,0,0 >,2,<-10,30,0>, 1 } // branches $ cone { < -10,10,0 >,1,<-05,25, 10>, .5 } $ cone { < -10,10,0 >,1,<-10,25, 00>, .5 } $ cone { < -10,10,0 >,1,<-05,25,-10>, .5 } stem (0.3, 0.6, 1) // amb blue scale $ translate <-20,0,0> $ } // trunk union $ $ // clumps $ union { $ sphere { <0,0,0>, 15 herbage (0.4,0.4,2.5) // amb blue scale $ scale < 1.0, 0.3, 0.5 > $ } $ sphere { <28,0,0>, 15 herbage (0.5,0.9,4) $ scale < 1.0, 0.2, 0.5 > $ } // $ sphere { <28,0,20>, 15 herbage (0.2,0.4,4) $ scale < 1.0, 0.2, 0.5 > $ } $ sphere { <28,0,20>, 17 floral (0.5,0,0,1,5) // amb r g b sc $ scale < 1.0, 0.2, 0.5 > $ } $ translate < -30,0,0 > $ } // clumps union $ translate <0,0,15> $ } // plants union end def trees // by south side of house y=y1 x=55 yn=50 z=155 am=0.05 sct=1 tree1 () y=y1 x=55 z=170 yn=63 am=0.2 sct=1 tree1 () // Gwen / Magnolia y=y1 x=-80 z=85 yn=55 am=0.3 sct=1 tree1 () // tree by lane y=y1+5 x=100 z=10 yn=50 am=0.05 sct=1 tree1 () // tree by front gate y=y1 x=15 z=500 yn=50 // 160 am=0.2 sct=2.3 tree1 () end // trees def furniture new zz print ('furniture') zz=60; xx=10; do table zz=50; xx=-35; do table z=zf+45; x=xb+25; r=45; do chair z=zf+55; x=xb+25; r=22; do chair z=zf+65; x=xb+25; r=0; do chair z=zf+65; x=xb+5; r=90; do workbench // z=zf+45; x=xb+5; r=90; do kitchen.unit // more things to create: // washing machine // lighting and electrics // round table do ornaments x=xb+xw-2 ; z=zf-5; do tub x=xb+xw-10 ; z=zf-5; do tub end def internal.partitions print ('internal partitions') do white z=zf+60; zn=z+2 y=y1; yn=y2 x=xb+2; xn=xb+10 $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> } x=xb+30; xn=xw/2+xb $ box { <[x],[y],[z]>,<[xn],[yn],[zn]> } end def wall.plates print ('wall plates') y=y2; yn=y+.5 x=xw+xb-1; xn=x+2; z=zf; zn=zqp*zi+z $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } // south x=xb; xn=x+2 $ box { < [x], [y], [z]>, < [xn], [yn], [zn]> } // north end def cross.beams new xo,xm,ym print ('cross beams') xo=5; xm=0 x=xc-ll; xn=xc; y=y2; yn=y2+th xo=0; xm=0 xo=0; xm=0 x=xc-ll; xn=xc+ll; y=y2; yn=y2+1 // +th z=zf; do crossbeam z=zf z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam z+7; do crossbeam end def lane $ box { $ < -300,0,0 >, < 300,-3, -25 > $ rotate [a]*y $ translate < [x],[y],[z] > $ texture { $ pigment { $ color rgb < 0.60, 0.6, 0.65 > $ } // end pigment $ normal { bumps .9 scale .12 } $ } // end texture $ } end def pebbledash_white $ texture { pigment { color White } } $ finish { ambient 0.3 } $ normal { bumps 0.9 scale 0.1 } end def stone $ texture { pigment { image_map { png "rubble2.png" } } rotate <[texx],[texy],[texz]> scale 15 } $ normal { bumps 0.8 scale 9 } $ finish { ambient 0.4 } end def building $ #declare roof_outer=sphere { <0,24,20>,60 scale < 1, 0.5, 1 > } $ #declare roof_inner=sphere { <0,24,20>,57 scale < 1, 0.5, 1 > } $ #declare roof_envelope=box { <-45,24,-05>,<45,104,45> } $ #declare clip_walls=difference { object{ roof_envelope } object{ roof_inner } } $ $ #declare curved_roof= $ intersection { $ object { roof_envelope } $ difference { object { roof_outer } object { roof_inner } } $ texture { pigment { color rgbt <0.5, 0.5, 0.8, 0.5> } } $ finish { ambient 0.8 } $ } // end intersection $ $ union { $ object { curved_roof } $ // walls $ difference { $ prism { $ linear_sweep $ linear_spline $ 0,100, $ 9, $ $<-40, 0>, $<-20, 0>, $<-20, 10>, $< 20, 10>, $< 20, 0>, $< 40, 0>, $< 40, 40>, $<-40, 40>, $<-40, 0> $ } // prism $ $ box { <-35,05,-1>,<-25,18,3 > } // window void $ box { < 35,05,-1>,< 25,18,3 > } // window void $ box { <-35,05,37>,<-25,18,41> } // window void back $ box { < 35,05,37>,< 25,18,41> } // window void back $ box { < -5,05,37>,< 05,18,41> } // window void back centre $ $ box { <-41,05,10>,<-37,18,20> } // window void side $ box { < 41,05,10>,< 37,18,20> } // window void side $ $ box { <-05,-1,09>,< 05,21,13> } // door void $ cylinder { <0,30,09>,< 0,30,13>,4.5 } // upper window void $ cylinder { <0,30,37>,< 0,30,41>,4.5 } // upper window void back $ cylinder { <-8,30,09>,<-10,30,13>,3.5 } // upper window void $ cylinder { < 8,30,09>,< 10,30,13>,3.5 } // upper window void $ $ prism { $ linear_sweep $ linear_spline $ -1,101, $ 9, $ $<-38, 2>, $<-22, 2>, $<-22, 12>, $< 22, 12>, $< 22, 2>, $< 38, 2>, $< 38, 38>, $<-38, 38>, $<-38, 2> $ } // prism $ object { clip_walls } $ } // difference translate 40*z do pebbledash_white $ finish { ambient 0.5 } $ } // union end def prism // extrude a closed 2-D shape along an axis $ prism { $ linear_sweep // or conic_sweep for tapering to a point $ linear_spline // linear_spline | quadratic_spline | cubic_spline $ -0.5, // height 1 $ 0.5, // height 2 $ 10, // number of points $ // the points $ < 0.2, -1.0>, $ < 0.2, 0.2>, $ < 1.0, -0.2>, $ < 1.0, 0.2>, $ < 0.2, 1.0>, $ <-0.2, 1.0>, $ <-1.0, 0.2>, $ <-1.0, -0.2>, $ <-0.2, 0.2>, $ <0.2, -1.0> $ // [open] $ // [sturm] $ scale 5 $ translate <0,50,0> $ } // difference $ } // union def helix ( ao, rs, re, Rs, Re, l, n, ai ) new e, y, R, r, rn, v, vi, a, i, j, k, s, sn,rc,yc, olp, vg, vh, va i=0; e=n; y=0; r=1 // set increments v=ai/n/360; k=0 vi=l*v // ai=10; vi=0.1 loop R=Re-Rs*k+Rs // taper major r=re-rs*k+rs // taper minor b=ai/2+a+ao; x=cos(b)*R; z=sin(b)*R a+ai; k+v R=Re-Rs*k+Rs // taper major rn=re-rs*k+rs // taper minor olp=sin(ai/2)*r*2 // overlap // olp=0 vg= l / n * ai / 360 / 2; vh=-vg yn= pyth ( vg, sin(ai)*R/2+olp, 1 ); yc=-yn va=atn( vg * 2 / ( sin (ai/2) *R *2 ) ) + 90 b=-90-b //$ difference { if rs=re $ cylinder {<[yc],[vh],0>,<[yn],[vg],0>,[r] rotate [b]*y translate <[x],[y],[z]> } else $ cone {<[yc],[vh],0>,[r],<[yn],[vg],0>,[rn] rotate [b]*y translate <[x],[y],[z]> } endif y+vi when a>=360; a=0; i+1 when i>=e; exit endl end $ prism { $ linear_sweep $ cubic_spline $ [yc], [yn], 7 $ <-1,-1> $ <-1,-1> $ <-1, 1> $ < 1, 1> $ < 1,-1> $ <-1,-1> $ <-1,-1> $ scale <[r],1,[r]> $ rotate [va]*z $ rotate [b]*y $ translate <[x],[y],[z]> $ } def cup (x,y,z,ya) $union { $ torus { 7,1.7 rotate 90*x scale <0.6,1,1> translate <-15.5,12,0> } $ $ lathe { $ cubic_spline $ 11, $<0,0>, $<0,0>, $<10,0>, $<11,1>, $<12,2>, $<12,21>, $<10,21>, $<10,4>, $<9,3>, $<0,3>, $<0,3> $} $scale < 1, 1, 1> $ texture { pigment { color rgb <0.9, 0.9, 0.9 > } } $ finish { ambient 0.4 reflection rgb <0.3,0.3,0.3> } $ rotate [ya]*y $ translate <[x],[y],[z]> $ } end def jug (x,y,z,ya) $ #declare jug_form= $ lathe { $ cubic_spline $ 12, $<0,0>, $<0,0>, $<0,0>, $<10,0>, $<11,1>, $<12,2>, $<12,21>, $<10,21>, $<10,4>, $<9,3>, $<0,3>, $<0,0> $} // end lathe $ $ #declare jug_void= $ cylinder {<0,0,0>,<0,25,0>,11} $ $ #declare spout_form1= $ difference { $ cone {<0,0,0>,0,<0,7,0>,5 } $ cone {<0,2,0>,0,<0,9,0>,5 } $ scale <1, 1, 0.5> $ translate <11,15,0> $ } $ #declare spout_form= $ lathe { $ cubic_spline $ 8, $ <1,0>, $ <1,0>, $ <5,6>, $ <6,6>, $ <4,5>, $ <0,0>, $ <1,0>, $ <1,0> $ scale <1, 1, 0.5> $ translate <11,15,0> $ } // end lathe $ #declare spout_void= $ cone {<0,0,0>,0,<0,7,0>,5 $ scale <1, 1, 0.5> $ translate <11,15,> $ } $ #declare spout_void1= $ lathe { $ cubic_spline $ 7, $ <1,0>, $ <1,0>, $ <5,6.01>, $ <6,6.01>, $ <6,0>, $ <6,0>, $ <1,0> $ scale <1, 1, 0.5> $ translate <11,15,> $ } // end lathe $ #declare jug= $union { $ // handle $ torus { 7,1.7 rotate 90*x scale <0.6,0.5,1> translate <-15.5,16,0> } $ difference { object { jug_form } object { spout_void } } $ difference { object { spout_form } object { jug_void } } $ // hole for spout $ // cylinder { <9,21,0>,<15,21,0>,5 scale <1,1,0.5> } $ } $ object { jug $ scale < 1, 2, 1> $ texture { pigment { color rgb <0.9, 0.9, 0.9 > } } $ finish { ambient 0.4 reflection rgb <0.3,0.3,0.3> } $ rotate [ya]*y $ translate <[x],[y],[z]> $ } end def silver_jug (x,y,z,ya) $ object { jug $ scale < 1, 2.2, 1> $ rotate [ya]*y $ translate <[x],[y],[z]> silver () $ } end def circular_top $ cylinder { $ <0,0,0>,<0,-3,0>,80 $ texture { pigment { color rgbt <0.25, 0.2, 0.5 ,0.6 > } } $ finish { ambient 0.3 reflection rgb <0.2,0.2,0.2> } $ } end $ union { helix (000, 2, .2, 2, 1, 20, 1, 3) //brass () $ scale 4 $ }