/* POVRAY PROGRAM TO CREATE THE MERGED ELLIPSOIDS SHELL VERSION OF THE UNIVERSAL TERRESTRIAL DWELLING By: ROBERT JOHN MORTON YE572246C COMMAND LINE: povray -visual DirectColor ellipsoids.pov +W640 +H480 set width and height of picture in /etc/povray/3.6/povray.ini */ #include "colors.inc" #include "shapes.inc" #include "textures.inc" #include "metals.inc" #include "stones.inc" #include "glass.inc" global_settings { max_trace_level 256 } // max possible is 256 #declare G = 1.6180339887; //golden ratio // HORIZON CALCULATION----------------------------------------------------------------------------- #declare oh = 200; //observer's eye height above the gound #declare rd = 220; //hiponenuse distance from observer to ninho #declare oz = sqrt(rd * rd - oh * oh); //horizontal distance observer is in front of //the co-ordinate origin #declare HZ = -(sqrt(oh*(12756280 + oh)) - oz); //horizon distance from observer #declare Height = 120; #declare Dist = 300; camera{ location<0,Height,Dist> //00,223,10 for plan view // location <0, oh - 4, oz> // look_at <0, -4, HZ> look_at <0, 0, 0> angle 13 } #declare fr = 79.788456088; // radius of a 2-hectare gleba (in metres) /* LIGHTING --------------------------------------------------------------------------------------- 1) Simulate the sun: */ #declare sun_white = light_source { // WHITE SUN IS ON THE HORIZON DUE SOUTH <0, 1000, 0> // located at south horizon color rgb <.4,.5,.3> // reddish-yellow light cylinder // confined to a cylindrical beam radius fr // of radius 100 units diameter at full intensity falloff 10000 // falling off to zero brightness at 70 units diameter area_light <1,0,0>, <0,0,1>, 20,20 // lighting element is a 20 x 20 array of pixels adaptive 1 // the normal of which is determined by the vectors jitter // adaptive = minimise number of test rays required point_at <0, 0, 0> // the light beam is aimed at the co-ordinate origin } // jitter softens shadows #declare sun_yellow = light_source { //YELLOW SUN IS ON THE HORIZON DUE SOUTH <0, 1000, 0> // located at south horizon color rgb <.8,.7,.6> // reddish light cylinder // confined to a cylindrical beam radius fr // of radius 100 units diameter at full intensity falloff 10000 // falling off to zero brightness at 70 units diameter area_light <1,0,0>, <0,0,1>, 20,20 // lighting element is a 20 x 20 array of pixels adaptive 1 // the normal of which is determined by the vectors jitter // adaptive = minimise number of test rays required point_at <0, 0, 0> // the light beam is aimed at the co-ordinate origin } // jitter softens shadows /* rotate the sun to its desired elevation eg -60 means the sun is 60 degrees above the horizon due south. Rotate it round the z-axis to simulate time of day eg -15 means 15 degrees (one hour) before noon. Sun: ascention 80 degrees, declination 30 degrees */ object { sun_white rotate <-30,0,-15> } object { sun_yellow rotate <-30,0,-15> } // 2) simulate light from the horizon #declare luz = light_source { <0, 500, 500> color rgb <.1, .1, .1> } // horizon light #declare horizonglow = union { #declare iii = 0; #while(iii < 360) object { luz rotate <0,iii,0> } #declare iii=iii + 90; #end } object{horizonglow} /* SPECIAL TEXTURES USED IN THIS PROJECT ---------------------------------------------------------- Shell Deep Magenta 0.53, 0.40, 0.80 Shell Light Magenta 0.53, 0.47, 0.80 (magentaish grey) Shell Light Green 0.53, 0.80, 0.47 (yellowish grey) Shell Light Pink 0.80, 0.53, 0.47 Shell Light Brown 0.80, 0.47, 0.53 */ #declare Shell_Colour1 = texture { pigment { color rgb <0.55, 0.51, 0.47>} //, 0.15> } // greeny-red finish { phong 0.8 ambient 0.6 } } #declare Shell_Colour2 = texture { pigment { color rgb <0.47, 0.55, 0.51>} //, 0.15> } // bluey-green finish { phong 0.8 ambient 0.6 } } #declare Shell_Colour3 = texture { pigment { color rgb <0.47, 0.51, 0.55>} //, 0.15> } // greeny-blue finish { phong 0.8 ambient 0.6 } } #declare Shell_Snow = texture { pigment { color rgb <.6, .65, .7> } // grey with a suggestion of light green finish { phong 0.8 ambient 0.6 } } #declare Inner_Colour = texture { pigment { color rgb <0.57, 0.55, 0.53> } // grey with a hint of red finish { phong 0.8 ambient 0.9 } } #declare YELLOW = texture { pigment { color rgb <0.82, 0.78, 0.29> } // crop corn colour finish { phong 0.8 ambient 0.4 } } #declare CYAN = texture { pigment { color rgb <0.58, 0.55, 0.30> } // crop ploughed colour finish { phong 0.8 ambient 0.4 } } #declare ROAD = texture { pigment { colour rgb <0.52, 0.49, 0.50> } // light grey tarmac. finish { phong 0.8 ambient 0.4 } } #declare LAKE = texture { pigment { color rgb <0.46, 0.54, 0.97> } // water blue finish { diffuse 0.3 ambient 0.3 phong .95 } } #declare GLASS = texture{pigment{color Col_Glass_General}} #declare GLASS1 = texture { pigment { color Col_Glass_General } finish { F_Glass8 } } #declare GLASS2 = texture { pigment { color Col_Glass_Green } finish { F_Glass8 } } //ENVIRONMENT ------------------------------------------------------------------------------------- #declare ground_level = -4; //amount ground is below the co-ordinate origin #declare md = -7000; //mountains are 5km away #declare rp = 6378140; //Earth radius #declare mountain = cone{<0, rp+40, 0>, 40 <0, rp, 0>, 100} merge{ sphere{<0,0,0>, rp} //create spherical planet object{mountain rotate<-.005,-20,0>} object{mountain rotate<-.005,+20,0>} object{mountain rotate<-.010,-10,0>} object{mountain rotate<-.010,+10,0>} object{mountain rotate<-.015,-05,0>} object{mountain rotate<-.015,+05,0>} object{mountain rotate<-.020,-01,0>} texture { //define its ground texture that comprises: pigment {color rgb <0.85, 1.0, 0.6> } finish { diffuse 0.2 ambient 0.5 } } translate<0,ground_level - rp,0> //translate it downwards to ground level } sky_sphere{ pigment{ gradient y color_map{ [(1 - cos(radians( 30))) / 2 color White ] [(1 - cos(radians(120))) / 2 color Blue ] } scale 2 translate -1 } } // GLEBA CIRCLE --------------------------------------------------------------------------------- #declare gleba_height = .002; // gleba is 5 mm above ground level #declare gleb = cylinder { <0, 0, 0>, <0, gleba_height, 0>, 1 // thin cylinder of unit radius texture { // define its texture that comprises: pigment { onion color_map { [0.0 color Yellow] // starts at yellow, then blend through to [1.0 color rgb <0.815, 1.015, 0.51>] // field-green rgb <0.8, 1.0, 0.5> } } finish { // with surface characteristics: diffuse 0.2 // diffusion ambient 0.5 // effective ambient lighting (brightness) } } translate <0,ground_level,0> // move the gradiented circle down to ground level } #declare gleba = object{gleb scale} // rescale to the size of the 2-hectare gleba // ------------------------------------------------------------------------------------------------ #declare mgr = sqrt(20000/(3*3.141592653)); // mini-gleba radius #declare glebshift = mgr * (1/cosd(30)-1); #declare minigleb = object { gleb scale clipped_by { cylinder { <0, -5, mgr>, <0, -3, mgr>, mgr } } translate <0, 0, glebshift> } #declare trigleb = union { #declare k = 30; #while (k < 390) object { minigleb rotate <0, k, 0> } #declare k = k + 120; #end } #declare ownership = sphere{<0,-4,0>, fr scale<1,1.5,1> texture{GLASS}} //ownership sphere /* CREATE THE BASIC PATIO SHELL ------------------------------------------------------------------- The shell has to have an inner height clearance of 2 metres at a radius of 5*cos(30) = 4.33012702 metres in order to provide adequate doorway height. The maximun inner height at the centre of the shell must be 2.7 metres. H = 1.7 Y = 2.0 F - b = 4.33012702 F = 4.33012702 + b F^2 = 18.75000001 + b^2 + 8.66025404*b R^2 = F^2 + H^2 2.89*b^2 - 5.78*Fb - 4*F^2 + 3.2079 = 0 2.89*b^2 - 5.78*(4.33012702 + b)*b - 4*(18.75000001 + b^2 + 8.66025404*b) + 3.2079 = 0 2.89*b^2 - 5.78*b^2 + 25.02813418*b - 4*(18.75000001 + b^2 + 8.66025404*b) + 3.2079 = 0 -2.89*b^2 + 25.02813418*b - 4*b^2 - 34.64101616*b - 75.00000004 + 3.2079 = 0 6.89*b^2 + 9.61288198*b + 71.79210004 = 0 For the quadratic formula: a = 6.89 b = 9.61288198 b^2 = 92.40749996 c = 71.79210004 4*a*c = 1978.5902771 x = (-9.61288198 + Sqrt(-92.40749996 + 1978.5902771)/(2 * 6.89) */ #declare RO = 5.0 * G; //outer radius of ellipsoid, in metres #declare RI = 4.626813959 * G; //inner radius of ellipsoid, in metres #declare OH = 2.0; //outer vertical radius #declare IH = 1.7; //inner vertical radius #declare SO = OH/RO; //outer vertical scaling factor #declare SI = IH/RI; //inner vertical scaling factor #declare so = sphere{<0,0,0>, RO scale<1,SO,1>} //outer skin of the ellipsoid #declare si = sphere{<0,0,0>, RI scale<1,SI,1>} //inner skin of the ellipsoid #declare od = cylinder{<0,0,0>, <0,0,5.002>, RO * sind(30) open rotate<0,60,0> scale<1,SO,1>} //outer doorway #declare id = cylinder{<0,0,0>, <0,0,5.002>, RO * sind(30) open rotate<0,60,0> scale<1,SI,1>} //inner doorway #declare sodo = merge{ //shell (outer surface, outer ring) with doorway object{so} object{od} object{od rotate<0,60,0>} } #declare sodi = merge{ //shell (outer surface , inner ring) with doorway object{sodo} object{od rotate<0,180,0>} object{od rotate<0,-120,0>} } #declare sido = merge{ //shell (inner surface, outer ring) with doorway object{si} object{id} object{id rotate<0,60,0>} } #declare sidi = merge{ //shell (inner surface, inner ring) with doorway object{sido} object{id rotate<0,180,0>} object{id rotate<0,-120,0>} } #declare r = 5/G; //radius of roof hole = 3.090169944 metres #declare f1 = union{ //flat-bottomed double skin circular ellipsoid difference{ object{sodi} cylinder{<0,-0.999,0>, <0,-2.5,0>, r pigment{color rgbt<1,1,1,1>}} //invisible cutter } object{ //domed bottom so clipped_by{cylinder{<0,0.5,0>, <0,2.5,0>, r}} translate<0,-3.14460551,0> } object{sidi clipped_by{cylinder{<0,-1,0>, <0,4,0>, RI + 1}}} cylinder{<0,-1,0>, <0,-1.001,0>, RI + 1 clipped_by{object{si}}} } #declare f2 = union{ //flat-bottomed double skin circular ellipsoid difference{ object{sodo} cylinder{<0,-0.999,0>, <0,-2.5,0>, r pigment{color rgbt<1,1,1,1>}} //invisible cutter } object{ //domed bottom so clipped_by{cylinder{<0,0.5,0>, <0,2.5,0>, r}} translate<0,-3.14460551,0> } object{sido clipped_by{cylinder{<0,-1,0>, <0,4,0>, RI + 1}}} cylinder{<0,-1,0>, <0,-1.001,0>, RI + 1 clipped_by{object{si}}} } #declare dr = 0.001; //fraction of a metre larger or smaller #declare patio1 = union{ //create the patio shell with the simple roof hole difference{ object{f1} //double-skinned dome-bottom ellipsoid cylinder{<0,1,0>, <0,2.5,0>, r pigment{color rgbt<1,1,1,1>}} //invisible cutter } merge{ //form the rim of the roof hole object{si} cylinder{<0,1,0>, <0,2.01,0>, r+dr} clipped_by{cylinder{<0,1,0>, <0,2.01,0> r+dr+dr}} clipped_by{object{so}} } } #declare patio2 = union{ //create the patio shell with the simple roof hole difference{ object{f2} //double-skinned dome-bottom ellipsoid cylinder{<0,1,0>, <0,2.5,0>, r pigment{color rgbt<1,1,1,1>}} //invisible cutter } merge{ //form the rim of the roof hole object{si} cylinder{<0,1,0>, <0,2.01,0>, r+dr} clipped_by{cylinder{<0,1,0>, <0,2.01,0> r+dr+dr}} clipped_by{object{so}} } } //LARGE CUTTER----------------------------------------------------------------------------- #declare da = 0.150; //fraction of a degree larger or smaller #declare sf = 1 - 1 / G; //vertical scaling factor of the ellipsoid 0.381966011 #declare cb = box{<0,-1,-10>, <10,6,10>} //box for slicing anulus into segments #declare sl = difference{ //form the large skylight wedge cutter difference{ difference{ cylinder{<0,1,0>, <0,3,0> r+dr} // big cylinder cylinder{<0,.999,0>, <0,3.001,0>, (r-dr)*sf} //little cylinder } object{cb} rotate<0,150-da-da,0> } object{cb} rotate<0,15+da,0> //to centre the cutter's position } #declare SL = union{ //create a circle of 6 skylight cutter segments #declare a = 0; #while(a < 360) object{sl rotate<0,a,0>} #declare a = a + 60; #end } //MEDIUM CUTTER------------------------------------------------------------------------------------ #declare sm = difference{ //single skylight window (anular segment) difference{ difference{ cylinder{<0,1,0>, <0,3,0> r} // big cylinder cylinder{<0,.999,0>, <0,3.001,0>, r*sf} //little cylinder radius = 1.18033989 } object{cb} rotate<0,150,0> } object{cb} rotate<0,15,0> //to centre the cutter's position } #declare SM = union{ //create a circle of 6 skylight cutter segments #declare a = 0; #while(a < 360) object{sm rotate<0,a,0>} #declare a = a + 60; #end } // CREATE THE ENCLOSED SHELL BY PUTTING THE SKYLIGHT ASSEMBLY IN A PATIO SHELL --------------------- #declare shell1 = union{ difference{ //CUT THE HOLES IN THE MAIN SHELL object{f1} //flat-bottom ellipsoidal shell object{SM pigment{color rgbt<1,1,1,1>}} //medium 6-segment aperture cutter } merge{ //CREATE THE RIMS OF THE APERTURES object{SL} //medium 6-segment aperture cutter object{si pigment{color rgbt<1,1,1,1>}} clipped_by{object{so}} clipped_by{cylinder{<0,1.5,0>, <0,3,0> r+.05}} } } #declare shell2 = union{ difference{ //CUT THE HOLES IN THE MAIN SHELL object{f2} //flat-bottom ellipsoidal shell object{SM pigment{color rgbt<1,1,1,1>}} //medium 6-segment aperture cutter } merge{ //CREATE THE RIMS OF THE APERTURES object{SL} //medium 6-segment aperture cutter object{si pigment{color rgbt<1,1,1,1>}} clipped_by{object{so}} clipped_by{cylinder{<0,1.5,0>, <0,3,0> r+.05}} } } #declare skylights = union{ //FORM THE UPPER AND LOWER PANELS OF THE SKYLIGHTS object{si} object{so} clipped_by{object{SM}} //small 6-segment aperture cutter texture{GLASS} } //ASSEMBLE THE NINHO ------------------------------------------------------------------------------ #declare Shell11 = union{object{shell1 texture{Shell_Colour1}} object{skylights}} #declare Shell21 = union{object{shell1 texture{Shell_Colour2}} object{skylights}} #declare Shell31 = union{object{shell1 texture{Shell_Colour3}} object{skylights}} #declare Shell12 = union{object{shell2 texture{Shell_Colour1}} object{skylights}} #declare Shell22 = union{object{shell2 texture{Shell_Colour2}} object{skylights}} #declare Shell32 = union{object{shell2 texture{Shell_Colour3}} object{skylights}} #declare Patio11 = object{patio1 texture{Shell_Colour1}} #declare Patio21 = object{patio1 texture{Shell_Colour2}} #declare Patio31 = object{patio1 texture{Shell_Colour3}} #declare Patio12 = object{patio2 texture{Shell_Colour1}} #declare Patio22 = object{patio2 texture{Shell_Colour2}} #declare Patio32 = object{patio2 texture{Shell_Colour3}} #declare expander = 1.1; //factor to expand the radius of the ellipsoidal modules #declare D = 10; /* separation diameter of ellipsoid 2*5*cos(30) = 2*4.33012702 = 8.66025404 */ #declare d = D/0.577350269; /* D/tan(30) - radius of circle on which centres of outer ellipsoids rest */ #declare S1 = merge{ object{Shell11 translate<0,0,D>} //inner shell colour 1 object{Shell12 rotate<0,90,0> translate<0,0,d> rotate<0,30,0>} //outer shell colour 1 } #declare S2 = merge{ object{Shell21 translate<0,0,D>} //inner shell colour 2 object{Shell22 rotate<0,90,0> translate<0,0,d> rotate<0,30,0>} //outer shell colour 2 } #declare P2 = merge{ object{Patio21 translate<0,0,D>} //inner patio colour 2 object{Patio22 rotate<0,90,0> translate<0,0,d> rotate<0,30,0>} //outer patio colour 2 } #declare SP = merge{ object{Shell31 translate<0,0,D>} //inner shell colour 3 object{Patio32 rotate<0,90,0> translate<0,0,d> rotate<0,30,0>} //outer patio colour 3 } #declare ninho = merge{ merge{ object{S1} object{S1 rotate<0, 60,0>}} merge{ object{P2 rotate<0,120,0>} object{S2 rotate<0,180,0>}} merge{ object{SP rotate<0,240,0>} object{SP rotate<0,300,0>}} } // GLASS SUPPORTS --------------------------------------------------------------------------------- #declare bw = r + dr + dr; //box width #declare gc = difference{ //create a glass segment difference{ difference{ //form cylindrical annulus cylinder{<0,-4.000,0>, <0,-1.250,0>, r - dr} //create cylinder cylinder{<0,-4.001,0>, <0,-1.249,0>, r*(1-1/G)} //then cut the centre out } box{<0,-4.001,-bw>, } //cut off half of the circular annulus rotate<0,150,0> //rotate all but 30 degrees of it out } box{<0,-4.001,-bw>, } //then kill what has been rotates out rotate<0,15,0> //to centre the its position } #declare support = union{ //create a ring of 6 equally-spaced 30-degree segments #declare a = 0; #while(a < 360) object{gc rotate<0,a,0>} #declare a = a + 60; #end rotate<0,30,0> //to align the supports with the skylights } #declare pair = union{ //form an inner-outer pair 30 degrees apart object{support translate<0,0,D>} object{support rotate<0,30,0> translate<0,0,d> rotate<0,30,0>} } #declare supports = union{ //form 6 pairs to support the whole ninho #declare a = 0; #while(a < 360) object{pair rotate<0,a,0>} #declare a = a + 60; #end texture{GLASS} } // ROADS ------------------------------------------------------------------------------------------ #declare rise = 0; //number of metres the road is raised above the ground #declare road = box{<-1,ground_level+rise,RO+D>,<+1,ground_level+rise+0.01,fr>} //one road #declare roads = union{ //roads arranged radially #declare a = 0; #while(a < 360) object{road rotate<0,a,0>} #declare a = a + 120; #end texture{ROAD} } // CREATE THE COMPLETE LANDSHARE ------------------------------------------------------------------ union { // object{crater} //set the gleba inside a shallow crater object{gleba} //circular area with radial colour gradient object{roads} object{ninho} //clipped_by{cylinder{<0,-4,0>, <0,0,0>, 100}}} //for open floor view object{supports} //to lift the shells to first-floor level // object{ownership} //transparent ellipsoid showing extent of "ownership" space rotate<0,5,0> //give it a slight twist to make it look cute }