# Rhombo in Bilinski

Sep 28th, 2019
668
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. // https://commons.wikimedia.org/wiki/Category:Golden_rhombohedra_in_Bilinski_dodecahedron_(brown)
2.
3. // for i in \$(seq -f "%03g" 0 719); do povray rhombo.pov +H600 +W445 -D -k\$i -O\$i; done
4.
5. #version 3.6;
6. global_settings { assumed_gamma 1.0 }
7. #default{ finish{ ambient 0.1 diffuse 0.9 conserve_energy } }
8.
9. #include "colors.inc"
10. #include "math.inc"
11.
12.
13. ///////////////////////////// values
14.
17.
18. #declare Factor = 1.5;
19. #declare Phi = (1 + sqrt(5)) / 2;
20. #declare C0 = Factor;
21. #declare C1 = Factor * Phi;
22. #declare C2 = Factor * Phi * Phi;
23. #declare C3 = Factor * Phi * Phi * Phi;
24.
25.
26. ///////////////////////////// poins and arrays of points
27.
28. #declare P = array[16]{  // The last two entries are the inner points.
29.     <0, -C2, 0>, <0, C2, 0>,
30.     <0, -C0, -C0>, <0, -C0, C0>, <0, C0, -C0>, <0, C0, C0>,
31.     <-C1, -C1, 0>, <C1, -C1, 0>, <-C1,  C1, 0>, <C1,  C1, 0>,
32.     <-C1, 0, -C0>, <-C1, 0, C0>, <C1, 0, -C0>, <C1, 0, C0>,
33.     <0, -2*C1 + C2, 0>, <0, 2*C1 - C2, 0>
34. }
35.
36. #declare Variant = "acute"
37. #if (Variant = "acute")
38.     #declare EdgeArrays = array[12]{
39.         array[2]{0,6}, array[2]{6,10}, array[2]{10,8}, array[2]{8,15}, array[2]{15,3}, array[2]{3,0},
40.         array[2]{2,0}, array[2]{2,10}, array[2]{2,15},
41.         array[2]{11,8}, array[2]{11,3}, array[2]{11,6}
42.     }
43.     #declare LightEdgeArrays = array[8]{
44.         array[2]{0,7}, array[2]{6,14}, array[2]{2,12}, array[2]{10,4},
45.         array[2]{3,13}, array[2]{11,5}, array[2]{15,9}, array[2]{8,1}
46.     }
47.     #declare FaceArrays = array[6]{
48.         array[5]{2,0,6,10,2}, array[5]{2,10,8,15,2}, array[5]{2,15,3,0,2},
49.         array[5]{11,3,0,6,11}, array[5]{11,6,10,8,11}, array[5]{11,8,15,3,11}
50.     }
51. #end
52. #if (Variant = "obtuse")
53.     #declare EdgeArrays = array[12]{
54.         array[2]{0,6}, array[2]{6,10}, array[2]{10,4}, array[2]{4,12}, array[2]{12,7}, array[2]{7,0},
55.         array[2]{2,0}, array[2]{2,10}, array[2]{2,12},
56.         array[2]{14,4}, array[2]{14,7}, array[2]{14,6}
57.     }
58.     #declare LightEdgeArrays = array[8]{
59.         array[2]{0,3}, array[2]{7,13}, array[2]{2,15}, array[2]{12,9},
60.         array[2]{6,11}, array[2]{14,5}, array[2]{10,8}, array[2]{4,1},
61.     }
62.     #declare FaceArrays = array[6]{
63.         array[5]{2,10,4,12,2}, array[5]{2,12,7,0,2}, array[5]{2,0,6,10,2},
64.         array[5]{14,7,0,6,14}, array[5]{14,6,10,4,14}, array[5]{14,4,12,7,14}
65.     }
66. #end
67.
68. #declare BlackVerticesArray = array[2]{ P[0], P[1] }
69. #declare RedVerticesArray = array[4]{ P[2], P[3], P[4], P[5] }
70. #declare GreenVerticesArray = array[4]{ P[6], P[7], P[8], P[9] }
71. #declare BlueVerticesArray = array[4]{ P[10], P[11], P[12], P[13] }
72. #declare InnerVerticesArray = array[2]{ P[14], P[15] }
73.
74.
75. ///////////////////////////// camera and light
76.
77. #declare PerspCameraLocation = 37 * vnormalize(<13.2, 3, -45>);
78.
79. camera{
80.     location PerspCameraLocation
81.     look_at  <0, .03, 0>
82.     right    x*image_width/image_height
83.     angle    9.5
84. }
85.
86. light_source{ <-400, 500, -300> color White*0.9 shadowless}
87. light_source{ <400, 200, 100> color White*0.4 shadowless}
88. light_source{ PerspCameraLocation  color rgb<0.9,0.9,1>*0.2 shadowless}
89. sky_sphere{ pigment{ White } }
90.
91.
92. ///////////////////////////// define elements
93.
94. #declare BlackVertices = union {  // top and bottom
95.     #for( Index, 0, 1 )
97.     #end
98.     pigment{ color rgb .1 }
99. }
100. #declare RedVertices = union {  // x
101.     #for( Index, 0, 3 )
103.     #end
104.     pigment{ color Red }
105. }
106. #declare GreenVertices = union {  // right-hand y (left-hand z)
107.     #for( Index, 0, 3 )
109.     #end
110.     pigment{ color rgb<0, .5, 0> }
111. }
112. #declare BlueVertices = union {  // right-hand z (left-hand y)
113.     #for( Index, 0, 3 )
115.     #end
116.     pigment{ color rgb<.03, .03, 1> }
117. }
118. #declare InnerVertices = union {
119.     #for( Index, 0, 1 )
121.     #end
122.     pigment{ color Orange }
123. }
124.
125. #declare LightEdges = union {
126.     #for( Index, 0, 7 )
127.         #local EdgeArray = LightEdgeArrays[Index];
128.         cylinder{ P[EdgeArray[0]], P[EdgeArray[1]], RadEdge }
129.     #end
130.     pigment{ color rgbt .7 }
131. }
132. #declare Edges = union {
133.     #for( Index, 0, 11 )
134.         #local EdgeArray = EdgeArrays[Index];
135.         cylinder{ P[EdgeArray[0]], P[EdgeArray[1]], RadEdge }
136.     #end
137. }
138.
139. #declare Faces = union {
140.     #for( Index, 0, 5 )
141.         #local FaceArray = FaceArrays[Index];
142.         polygon{ 4,
143.             #for(VertexIndexInFace, 0, 3)
144.                 P[FaceArray[VertexIndexInFace]]
145.             #end
146.         }
147.     #end
148. }
149.
150.
151. ///////////////////////////// show
152.
153. union{
154.     object{BlackVertices}
155.     object{RedVertices}
156.     object{BlueVertices}
157.     object{GreenVertices}
158.     object{InnerVertices}
159.
160.     object{LightEdges}
161.
162.     object{
163.         Edges
164.         pigment{ color rgb <189,143,91>/255 }
165.     }
166.     object{
167.         Edges
168.         scale -1
169.         pigment{ color rgb <132,100,63>/255 }
170.     }
171.
172.     object{
173.         Faces
174.         pigment{ color rgbt <189,143,91,100>/255 }
175.     }
176.     object{
177.         Faces
178.         scale -1
179.         pigment{ color rgbt <132,100,63,100>/255 }
180.     }
181.
182.     rotate y*clock/2
183. }
RAW Paste Data