11###
22# Polyhedrons after sketch by Chinchbug on openprocessing.org
33###
4-
54Vert = Struct . new ( :x , :y , :z ) do
65 def dist_sq ( v )
76 ( x - v . x ) * ( x - v . x ) + ( y - v . y ) * ( y - v . y ) + ( z - v . z ) * ( z - v . z )
@@ -16,7 +15,7 @@ def self.permutations(x, y, z)
1615PHI_SQ = PHI * PHI
1716PHI_CU = PHI * PHI * PHI
1817ROOT2 = sqrt ( 2 )
19- TYPE = "Type Archimedian\n Faces: %d "
18+ TYPE = "Type Archimedian\n Faces: "
2019
2120attr_reader :verts , :curr_id , :scayl , :ang , :spd , :name , :notes , :off_x , :off_y
2221attr_reader :off_z , :len_edge
@@ -164,70 +163,70 @@ def create_poly(id)
164163 @scayl = 46
165164 when 6
166165 @name = 'Cuboctahedron:'
167- @notes = " #{ TYPE } triangles, 6 squares\n Vertices 12\n Edges 24" % 8
166+ @notes = format ( "%s %d triangles, 6 squares\n Vertices 12\n Edges 24", TYPE , 8 )
168167 permutations ( 1 , 0 , 1 )
169168 @len_edge = ROOT2
170169 @scayl = 170
171170 when 7
172171 @name = 'Truncated Cube:'
173- @notes = " #{ TYPE } triangles, 6 octogons\n Vertices 24\n Edges 36" % 8
172+ @notes = format ( "%s %d triangles, 6 octogons\n Vertices 24\n Edges 36", TYPE , 8 )
174173 permutations ( ROOT2 - 1 , 1 , 1 )
175174 @len_edge = 2 * ( ROOT2 - 1 )
176175 @scayl = 155
177176 when 8
178177 @name = 'Truncated Octahedron:'
179- @notes = " #{ TYPE } squares, 8 hexagons\n Vertices 24\n Edges 36" % 6
178+ @notes = format ( "%s %d squares, 8 hexagons\n Vertices 24\n Edges 36", TYPE , 6 )
180179 permutations ( 0 , 1 , 2 )
181180 permutations ( 2 , 1 , 0 )
182181 @len_edge = ROOT2
183182 @scayl = 100
184183 when 9
185184 @name = 'Rhombicuboctahedron:'
186- @notes = " #{ TYPE } triangles, 18 squares\n Vertices 24\n Edges 48" % 8
185+ @notes = format ( "%s %d triangles, 18 squares\n Vertices 24\n Edges 48", TYPE , 8 )
187186 permutations ( ROOT2 + 1 , 1 , 1 )
188187 @len_edge = 2
189188 @scayl = 80
190189 when 10
191190 @name = 'Truncated Cuboctahedron:'
192- @notes = " #{ TYPE } squares, 8 hexagons, 6 octogons\n Vertices 48\n Edges 72" % 12
191+ @notes = format ( "%s %d squares, 8 hexagons, 6 octogons\n Vertices 48\n Edges 72", TYPE , 12 )
193192 permutations ( ROOT2 + 1 , 2 * ROOT2 + 1 , 1 )
194193 permutations ( ROOT2 + 1 , 1 , 2 * ROOT2 + 1 )
195194 @len_edge = 2
196195 @scayl = 50
197196 when 11
198197 @name = 'Icosidodecahedron:'
199- @notes = " #{ TYPE } triangles, 12 pentagons\n Vertices 30\n Edges 60" % 20
198+ @notes = format ( "%s %d triangles, 12 pentagons\n Vertices 30\n Edges 60", TYPE , 20 )
200199 permutations ( 0 , 0 , 2 * PHI )
201200 permutations ( 1 , PHI , PHI_SQ )
202201 @len_edge = 2
203202 @scayl = 70
204203 when 12
205204 @name = 'Truncated Dodecahedron:'
206- @notes = " #{ TYPE } triangles, 12 decagons\n Vertices 60\n Edges 90" % 20
205+ @notes = format ( "%s %d triangles, 12 decagons\n Vertices 60\n Edges 90", TYPE , 20 )
207206 permutations ( 0 , 1 / PHI , PHI + 2 )
208207 permutations ( 1 / PHI , PHI , 2 * PHI )
209208 permutations ( PHI , 2 , PHI_SQ )
210209 @len_edge = 2 * ( PHI - 1 )
211210 @scayl = 60
212211 when 13
213212 @name = 'Truncated Icosahedron:'
214- @notes = " #{ TYPE } pentagons, 20 hexagons\n Vertices 60\n Edges 90" % 12
213+ @notes = format ( "%s %d pentagons, 20 hexagons\n Vertices 60\n Edges 90", TYPE , 12 )
215214 permutations ( 0 , 1 , 3 * PHI )
216215 permutations ( 2 , 2 * PHI + 1 , PHI )
217216 permutations ( 1 , PHI + 2 , 2 * PHI )
218217 @len_edge = 2
219218 @scayl = 45
220219 when 14
221220 @name = 'Small Rhombicosidodecahedron:'
222- @notes = " #{ TYPE } triangles, 30 squares, 12 pentagons\n Vertices 60\n Edges 120" % 20
221+ @notes = format ( "%s %d triangles, 30 squares, 12 pentagons\n Vertices 60\n Edges 120", TYPE , 20 )
223222 permutations ( 1 , 1 , PHI_CU )
224223 permutations ( PHI_SQ , PHI , 2 * PHI )
225224 permutations ( PHI + 2 , 0 , PHI_SQ )
226225 @len_edge = 2
227226 @scayl = 50
228227 when 15
229228 @name = 'Great Rhombicosidodecahedron:'
230- @notes = " #{ TYPE } squares, 20 hexagons, 12 decagons\n Vertices 120\n Edges 180" % 30
229+ @notes = format ( "%s %d squares, 20 hexagons, 12 decagons\n Vertices 120\n Edges 180", TYPE , 30 )
231230 permutations ( 1 / PHI , 1 / PHI , PHI + 3 )
232231 permutations ( 2 / PHI , PHI , 2 * PHI + 1 )
233232 permutations ( 1 / PHI , PHI_SQ , 3 * PHI - 1 )
0 commit comments