/* POVRAY PROGRAM TO CREATE THE SIMPLE TORUS SHELL WITH A PENTAGONAL FORM OF INTERNAL DIVISION OF THE UNIVERSAL TERRESTRIAL DWELLING By: ROBERT JOHN MORTON YE572246C COMMAND LINE: povray -visual DirectColor torus.pov +W640 +H480 */ #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 /* CAMERA ----------------------------------------------------------------------------------------- VIEW LOCATION LOOK-AT ANGLE ROTATE TRANSLATE FILENAME Horizontal 0, 4, 350 0, 0, 0 13 0,-103,0 6,0,0 hor_med Near Angled 0,130,260 0, 0, 0 13 0,-103,0 6,0,-10 near_ang_med Far Angled 0,350,700 0,0,0 13 0,-103,0 6,0,10 far_ang_med Close Plan 0,225,20 0, 0, -1.5 13 0,-103,0 0,,1.5 Medium Plan 0,480,30 0, 0, 0 13 0,-103,0 0,0,3 plan_med Gleba Plan 0,1100,20 -6, 0, -4 13 0,-103,0 0,0,0 trigleb Floor Plan 0,402,5 0,0,0 13 1280x960 Floor Plan 0,201,5 0,0,0 13 1280x960 View20-320 Picture sizes: small = 320 by 240, med = 640 by 480, big = 1280 by 960 */ camera { location <0,110,5> look_at <0, 0, 0> angle 13 } /* ------------------------------------------------------------------------------------------------ Large-scale floor plan = 3.637681159 x small-scale floor plan x=0, y=110.509960159, z=5 */ // LIGHTING --------------------------------------------------------------------------------------- // light_source { <15, 200, 30> color rgb <1, 1, 1> } // for quick tests // light_source { <7.25, 1.1, 8> color rgb <1, 1, 1> } // for quick tests // 1) Simulate the sun #declare sun_white = light_source { // WHITE SUN IS ON THE HORIZON DUE SOUTH <0, 0, 1000> // located at south horizon color rgb <.4,.5,.3> // white light cylinder // confined to a cylindrical beam radius 100 // of radius 100 units diameter at full intensity falloff 200 // 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, 0, 1000> // located at south horizon color rgb <.8,.7,.6> // yellow light cylinder // confined to a cylindrical beam radius 100 // of radius 100 units diameter at full intensity falloff 200 // 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 */ union { object { sun_white } object { sun_yellow } rotate <-80,0,-30> } // 2) simulate light from the horizon #declare luz = light_source { <0, -1.6, 500> color rgb <.15, .25, .3> } // horizon light #declare horizonglow = union { #declare iii = 0; #while(iii < 360) object { luz rotate <0,iii,0> } #declare iii=iii + 51.428571429; #end } object { horizonglow rotate <0,0,0> } // rotate the 7 horizon lights to best position // 3) RING OF LIGHTS AROUND THE TOP OF THE LIFT-SHAFT TO LIGHT THE STAIRS FROM ABOVE #declare upper_light = light_source { <1.5, 1.6, 0> color rgb <.25, .25, .2> } #declare upper_stair_lights = union { object { upper_light } object { upper_light rotate <0, 72,0> } object { upper_light rotate <0,144,0> } object { upper_light rotate <0,216,0> } object { upper_light rotate <0,288,0> } } // 4) RING OF LIGHTS AROUND THE BOTTOM OF THE LIFT-SHAFT TO LIGHT THE STAIRS FROM BENEATH #declare lower_light = light_source { <0, -3.95, 1.5> color rgb <.15, .15, .1> } #declare lower_stair_lights = union { object { lower_light } object { lower_light rotate <0, 72,0> } object { lower_light rotate <0,144,0> } object { lower_light rotate <0,216,0> } object { lower_light rotate <0,288,0> } } // BACKGROUND ------------------------------------------------------------------------------------- plane { y, -4 // CREATE A GROUND PLANE texture { // define its texture that comprises: pigment { color rgb <0.85, 1.0, 0.6> } finish { diffuse 0.2 ambient 0.5 } } } 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 } } /* 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_Colour = texture { pigment { color rgb <0.50, 0.52, 0.49> } // 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 } } // OBJECTS -------------------- Dimensions in Metres ---------------------------------------------- #declare ground_level = -4; // depth of the ground below the co-ordinate origin // GLEBA CIRCLE ----------------------------------------------------------------------------------- #declare gleba_height = .002; // gleba is 5 mm above ground level #declare fr = 79.788456088; // radius of a 2-hectare gleba (in metres) #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 // TORUS VERSION: BASIC FLOORS -------------------------------------------------------------------- #declare G = 1.6180339887; //golden ratio #declare R2 = 2.5; //radius of smaller circular floor #declare R1 = R2 * G; //radius of larger circular floor (4.045084972) #declare D1 = 2 * R1; //8.090169943 #declare D2 = 2 * R2; //5 #declare k = G + 1; //clearance between cylinders and outer skin of torus 2.6180339887 #declare p = R1 * (1 + sqrt(3)) + k; // 13.669411653 #declare q = 2 * G + 1; // 4.236067977 #declare r = R2 + k; // 5.118033989 #declare a = q * q - 1; // 16.944271906 #declare b = -2 * (p + q * r); // -70.699503078 #declare c = r * r - R1 * R1 - p * p; //-177.021255457 #declare o = (sqrt(b * b - 4 * a * c) - b) / (2 * a); //minimum radius 5.35690306 #declare T1 = o * G; //semi ring-width (Torus's outer minor radius) 8.667651225 #declare T2 = o + T1; //Torus's major radius 14.024554285 #declare H = o + k + R1; //radial shift that must be applied to the floors 12.020022021 #declare Rring = H + R1; //outer radius of the ring floor 16.065106993 #declare S = o / (T1*G*G); //vertical scaling to give torus the right external half-height #declare N = 5; //number of "petal" units #declare A = 360 / N; //resulting angle occupied by each petal #declare B = A / 2; //half the above angle (used a lot later) #declare o = -1.5; //height of the bottom of the outer surface of the shell #declare Q = -1.001; //height of the floor of the inner surface of the shell #declare q = -.001; //thickness of the shell surface skin #declare W = degrees(atan2(R1,(p + o))); //half-angle between pair of sidelights at centre of torus #declare w = asind(R1/(T1 + T2 - R2 - k)); /* Total radius of torus = 22.69220551 metres So, area occupied by torus = 1617.719754121 square metres = 0.161771975 hectare. The physical area of the torus ring = 1617.719754121 - 90.152432062 = 1527.567322059 square metres. */ //FLOORS ------------------------------------------------------------------------------------------ #declare f = -0.999; //floor height of rooms #declare smallFloor = merge{ cylinder{<0,f,-D1>, <0,3,-D1>, R2} //cylindrical ante-room box{<-.75,f,0>,<+.75,1,2> translate<0,0,-R1-1.75>} //doorway corridor } #declare largeFloor = cylinder{ <0,f,0>, <0,3,0>, R1 } //cylindrical main-room #declare floors = union { object{largeFloor} object{smallFloor rotate<0,+30,0> } object{smallFloor rotate<0,-30,0> } translate<0,0,-H> } #declare ringFloor = difference { union{ cylinder{ <0,f,0>, <0,3,0>, Rring } cylinder{ <0,f,0>, <0,3,0>, Rring-2 } } cylinder{ <0,-1.01,0>, <0,3.01,0>, Rring - 2.01 pigment{color rgbt<1,1,1,1>} } } #declare CL = light_source{<0, 0, Rring-1> color rgb <.3, .3, .2>} //mid-corridor light #declare lights = union{ #declare a = 0; #while(a < 360) object{CL rotate<0,a,0>} #declare a = a + A; #end } // SUPPORT PLINTHS -------------------------------------------------------------------------------- #declare plinth = difference{ difference{ difference{ cylinder{<0,-4, 0>, <0,-1.001,0>, Rring} //large cylinder cylinder{<0,-4.01,0>, <0,-1 ,0>, Rring-2} //punch its centre out } box{<0,-4.01,-30>, <-30,-1,30>} //chop it in half diametrically leaving solid ends rotate<0,180-B,0> //rotate it half a module } box{<0,-4.01,-30>, <-30,-1,30>} //chop again to leave a half-module arc } #declare plinths = union{ //form a group of 5 arranged in a circle #declare a = A/4; #while(a < 360) object{plinth rotate<0,a,0>} #declare a = a + A; #end texture{GLASS1} } // ROADS ------------------------------------------------------------------------------------------ #declare road = box{<-1,-4,2>,<+1,-3.99,50>} //one road #declare roads = union{ //5 roads arranged radially #declare a = 0; #while(a < 360) object{road rotate<0,a,0>} #declare a = a + A; #end texture{ROAD} } // WINDOWS ---------------------------------------------------------------------------------------- #declare sidelight = cylinder{<0,0,T1+T2-2>, <0,0,T1+T2+1>, 0.75 scale<1,1/G,1>} #declare sidelight2 = object{sidelight rotate<0,0,90>} #declare smallSkylight = cylinder{<0,1.5,0>, <0,2.5,0>, 1.0} #declare largeSkylight = cylinder{<0,1.5,0>, <0,2.5,0>, 1.5} #declare Skylight = union { object{largeSkylight} object{smallSkylight translate<0,0,-D1> rotate<0,+30,0> } object{smallSkylight translate<0,0,-D1> rotate<0,-30,0> } translate<0,0,-H> } #declare smallLight = cylinder{<0,1.5,1-Rring>, <0,2.5,1-Rring>, .75 } //corridor skylight #declare cLights = union{ object{sidelight} object{smallLight rotate<0,B,0>} } #declare skyLight = union{ object{cLights rotate<0,-B/4,0> } object{cLights } object{cLights rotate<0,+B/4,0> } } #declare SKYLIGHTS = union{ object{skyLight} object{Skylight} object{sidelight2 rotate<0,B-w,0>} object{sidelight2 rotate<0,B+w,0>} } #declare skylights = union{ //form a group of 5 arranged in a circle #declare a = 0; #while(a < 360) object{SKYLIGHTS rotate<0,a,0>} #declare a = a + A; #end } // MAIN TORUS SHELL ---------------------------------------- #declare T = torus{ T2, T1 - 1 scale<1,S,1> } //for inner surface of shell #declare shell = union{ difference{ torus{ T2, T1 scale<1,S,1> } //outer surface of shell cylinder{<0,-3,0>, <0,-1.5,0>, T2+T1} //to give outer surface a flat botton } difference{ object{T} //inner surface torus cylinder{<0,-1,0>, <0,-3,0>, T2+T1-1} //gives inner ssurface flat bottom at floor level } } #declare Shell = union{ merge{ difference{ object{shell texture{Shell_Colour}} object{skylights pigment{color rgbt<1,1,1,1>}} } object{shell clipped_by{object{skylights}} texture{GLASS1}} } merge{ object{ringFloor} //corridor that goes all the way round torus object{lights} #declare a = 0; #while(a < 360) object{floors rotate<0,a,0>} //the 5 triple-circular-room structures #declare a = a + A; #end clipped_by{object{T}} //clip to fit inner surface of shell texture{Inner_Colour} //surface texture of the inner walls } } // CREATE THE COMPLETE LANDSHARE ------------------------------------------------------------------ #declare landshare = union { // object{ownership} // transparent ellipsoid showing extent of "ownership" space // object{gleba} // circular area with radial colour gradient // object{roads} // object{plinths} object{Shell} // the buildings } object{landshare clipped_by{box{<-100,-4,-100>,<100,-.8,100>}} //to create floor-plan view translate<0,0,14.024554285> //to create a good angled view // rotate<90,0,0> } // END OF PROGRAM ---------------------------------------------------------------------------------