Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://commons.wikimedia.org/wiki/Category:Bilinski_dodecahedron_(gray)
- // for i in $(seq 0 7); do povray bilinski.pov +ua +fn +H2000 +W2000 -D -k$i -O$i; done
- #version 3.6;
- global_settings { assumed_gamma 1.0 }
- #default{ finish{ ambient 0.1 diffuse 0.9 conserve_energy } }
- #include "colors.inc"
- #include "math.inc"
- #include "RotateDirOnDir.inc"
- ///////////////////////////// values
- #declare RadVert = .15;
- #declare RadEdge = .045;
- #declare Factor = 1.5;
- #declare Phi = (1 + sqrt(5)) / 2;
- #declare C0 = Factor;
- #declare C1 = Factor * Phi;
- #declare C2 = Factor * Phi * Phi;
- #declare C3 = Factor * Phi * Phi * Phi;
- ///////////////////////////// points and arrays of points
- #declare P = array[16]{ // The last two entries are the inner points.
- <0, -C2, 0>, <0, C2, 0>,
- <0, -C0, -C0>, <0, -C0, C0>, <0, C0, -C0>, <0, C0, C0>,
- <-C1, -C1, 0>, <C1, -C1, 0>, <-C1, C1, 0>, <C1, C1, 0>,
- <-C1, 0, -C0>, <-C1, 0, C0>, <C1, 0, -C0>, <C1, 0, C0>,
- <0, -2*C1 + C2, 0>, <0, 2*C1 - C2, 0>
- }
- #declare EdgeArrays = array[24]{
- array[2]{0,2}, array[2]{0,3}, array[2]{4,1}, array[2]{5,1},
- array[2]{0,6}, array[2]{0,7}, array[2]{8,1}, array[2]{9,1},
- array[2]{2,10}, array[2]{2,12}, array[2]{3,11}, array[2]{3,13},
- array[2]{10,4}, array[2]{12,4}, array[2]{11,5}, array[2]{13,5},
- array[2]{6,10}, array[2]{6,11}, array[2]{7,12}, array[2]{7,13},
- array[2]{10,8}, array[2]{11,8}, array[2]{12,9}, array[2]{13,9}
- }
- #declare InnerEdgeArrays = array[8]{
- array[2]{6,14}, array[2]{7,14}, array[2]{15,8}, array[2]{15,9},
- array[2]{2,15}, array[2]{3,15}, array[2]{14,4}, array[2]{14,5}
- }
- #declare FaceArrays = array[12]{
- array[5]{0,2,10,6,0}, array[5]{0,2,12,7,0}, array[5]{0,3,11,6,0}, array[5]{0,3,13,7,0},
- array[5]{1,4,10,8,1}, array[5]{1,4,12,9,1}, array[5]{1,5,11,8,1}, array[5]{1,5,13,9,1},
- array[5]{2,10,4,12,2},
- array[5]{3,11,5,13,3},
- array[5]{6,10,8,11,6},
- array[5]{7,12,9,13,7}
- }
- #declare BlackVerticesArray = array[2]{ P[0], P[1] }
- #declare RedVerticesArray = array[4]{ P[2], P[3], P[4], P[5] }
- #declare GreenVerticesArray = array[4]{ P[6], P[7], P[8], P[9] }
- #declare BlueVerticesArray = array[4]{ P[10], P[11], P[12], P[13] }
- #declare InnerVerticesArray = array[2]{ P[14], P[15] }
- ///////////////////////////// parameters
- #declare ShowInner = false;
- #declare OrthoCameraLocation = 50 * vnormalize(<0, 0, -1>);
- #declare PerspCameraLocation = 50 * vnormalize(<13.2, 3, -45>);
- #if (clock=0)
- #declare Ortho = false;
- #end
- #if (clock=1)
- #declare ViewSolidFrom = <45, 0, 0>; // side
- #declare Ortho = true;
- #end
- #if (clock=2)
- #declare ViewSolidFrom = <0, 0, -45>; // front
- #declare Ortho = true;
- #end
- #if (clock=3)
- #declare ViewSolidFrom = <0, 45, 0>; // top
- #declare Ortho = true;
- #end
- #if (clock=4)
- #declare ViewSolidFrom = <0, -C2, -C1>;
- #declare Ortho = true;
- #end
- #if (clock=5)
- #declare ViewSolidFrom = <C3, -C2, 0>; // 1 behind 9
- #declare Ortho = true;
- #end
- #if (clock=6)
- #declare ViewSolidFrom = <C1, 0, -(C1-C0)>;
- #declare Ortho = true;
- #end
- #if (clock=7)
- #declare ViewSolidFrom = <C1, -C2, -C0>;
- #declare Ortho = true;
- #end
- ///////////////////////////// camera and light
- camera{
- #if (Ortho)
- orthographic
- location OrthoCameraLocation
- look_at <0, 0, 0>
- #else
- location PerspCameraLocation
- look_at <0, .022, 0>
- #end
- right x*image_width/image_height
- angle 9.5
- }
- light_source{ <-400, 500, -300> color White*0.9 shadowless}
- light_source{ <400, 200, 100> color White*0.4 shadowless}
- light_source{ PerspCameraLocation color rgb<0.9,0.9,1>*0.2 shadowless}
- sky_sphere{ pigment{ White } }
- ///////////////////////////// define elements
- #declare BlackVertices = union { // top and bottom
- #for( Index, 0, 1 )
- sphere{ BlackVerticesArray[Index], RadVert }
- #end
- pigment{ color rgb .1 }
- }
- #declare RedVertices = union { // x
- #for( Index, 0, 3 )
- sphere{ RedVerticesArray[Index], RadVert }
- #end
- pigment{ color Red }
- }
- #declare GreenVertices = union { // right-hand y (left-hand z)
- #for( Index, 0, 3 )
- sphere{ GreenVerticesArray[Index], RadVert }
- #end
- pigment{ color rgb<0, .5, 0> }
- }
- #declare BlueVertices = union { // right-hand z (left-hand y)
- #for( Index, 0, 3 )
- sphere{ BlueVerticesArray[Index], RadVert }
- #end
- pigment{ color rgb<.03, .03, 1> }
- }
- #declare InnerVertices = union {
- #for( Index, 0, 1 )
- sphere{ InnerVerticesArray[Index], RadVert }
- #end
- pigment{ color Orange }
- }
- #declare Edges = union {
- #for( Index, 0, 23 )
- #local EdgeArray = EdgeArrays[Index];
- cylinder{ P[EdgeArray[0]], P[EdgeArray[1]], RadEdge }
- #end
- pigment{ color rgb .5 }
- }
- #declare InnerEdges = union {
- #for( Index, 0, 7 )
- #local EdgeArray = InnerEdgeArrays[Index];
- cylinder{ P[EdgeArray[0]], P[EdgeArray[1]], RadEdge * 3/4 }
- #end
- pigment{ color rgb .9 }
- }
- #declare Faces = union {
- #for( Index, 0, 11 )
- #local FaceArray = FaceArrays[Index];
- polygon{ 4,
- #for(VertexIndexInFace, 0, 3)
- P[FaceArray[VertexIndexInFace]]
- #end
- }
- #end
- pigment{color rgbt<1, 1, 1, .5>}
- }
- ///////////////////////////// show
- union{
- object{BlackVertices}
- object{RedVertices}
- object{BlueVertices}
- object{GreenVertices}
- object{Edges}
- object{Faces}
- #if (ShowInner)
- object{InnerVertices}
- object{InnerEdges}
- #end
- #if (Ortho)
- RotateDirOnDir(ViewSolidFrom, OrthoCameraLocation)
- #end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement