cubenet_defs.html


001| '''Cube Nets Definitions.
001| 
001| Object IDs:
001|     0       -Cube
001|     1-11    -Cube Nets
001|     40      -Tesseract
001|     41      -Tesscross
001|     61-67   -Soma Cube
001|     7x      -Tetris
001|     99      -Matrix Demo
001| 
001| Matrix Rotations (looking in minus direction along axis):
001|     X: XP=CCW, XN=CW
001|     Y: YP=CW , YN=CCW   <<< note difference!
001|     Z: ZP=CCW, ZN=CW
001| 
001| Cube Nets:
001|     CN#                 -The eleven unique Cube Net objects, #=[0-11].
001|     CubeNets            -A dictionary of the shapes listed directly below
001| 
001|     Tesseract           -Tesseract shape
001|     Tesscross           -Tesscross shape
001|     Soma#               -Soma Cube shapes, #=[1-7]
001|     Tetris#             -Tetris shapes, #=[1-5]
001|     MatrixDemo          -Matrix Demo shape
001| 
001| Other Data:
001|     Rot?$$$             -Rotation matrix selector codes, ?=[X|Y|Z], $$$=[pos|neg].
001| 
001|     net_#                   -Cube Net definition, #=net-id [0-11]
001|     net_#_props             -Cube Net properties, #=net-id [0-11]
001|     rot_#_a#_m#             -Cube Net rotation definition, #=net-id, #=index
001| 
001|     net_tesseract           -Tesseract object definition (s/a net_#)
001|     net_tesscross           -Tesscross object definition
001|     net_tesseract_props     -Tesseract object properties (s/a net_#_props)
001|     net_tesscross_props     -Tesscross object properties
001| 
001|     net_soma_#              -Soma Cube object definition, #=[1-7]
001|     net_soma_#_props        -Soma Cube object properties, #=[1-7]
001| 
001|     net_tetris_#            -Tetris object definition, #=[1-5]
001|     net_tetris_#_props      -Tetris object properties, #=[1-5]
001| 
001|     net_matrix_demo         -matrix-driven rotation demo object definition
001|     net_matrix_demo_props   -matrix-driven rotation demo object properties
001|     rot_matrix_demo         -matrix-driven rotation demo object rotation definition
001| 
001| Functions:
001|     parse_face_string(s) - convert "[abcd [defg ..." to facedef tuples
001| 
001| '''

002| ####################################################################################################
003| from cubenet import cubenet
004| ####################################################################################################
005| 
006| ##------------------------------------------------------------------------------------------------##
007| '''List of the number of moves for each net animation.'''
008| NbrMoves = [
009|     3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3,    # animation series 1
010|     3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    # animation series 2
011| ]
012| 
013| ##------------------------------------------------------------------------------------------------##
014| '''Rotation Matrices Codes.'''
015| RotXpos = 'xp'      # XP: CCW when facing -X
016| RotXneg = 'xn'      # XN: CW when facing +X
017| 
018| RotYpos = 'yp'      # YP: CW when facing -Y <<< note difference from X & Z
019| RotYneg = 'yn'      # YN: CCW when facing +Y <<< note difference from X & Z
020| 
021| RotZpos = 'zp'      # ZP: CCW when facing -Z
022| RotZneg = 'zn'      # ZN: CW when facing +Z
023| 
024| ####################################################################################################
025| ## Net Definitions
026| ##------------------------------------------------------------------------------------------------##
027| net_0 = {
028|     'a': (-1,+1,+2, ['b','c','e']),
029|     'b': (+1,+1,+2, ['a','d','f']),
030|     'c': (-1,-1,+2, ['a','d','g']),
031|     'd': (+1,-1,+2, ['b','c','h']),
032|     'e': (-1,+1, 0, ['a','f','g']),
033|     'f': (+1,+1, 0, ['b','e','h']),
034|     'g': (-1,-1, 0, ['c','e','h']),
035|     'h': (+1,-1, 0, ['d','f','g']),
036| }
037| net_1 = { # 1
038|     'a': (-3,+3,0, ['b','c']),
039|     'b': (-1,+3,0, ['a','d']),
040|     'c': (-3,+1,0, ['a','d','h']),
041|     'd': (-1,+1,0, ['b','c','e','i']),
042|     'e': (+1,+1,0, ['d','f','j']),
043|     'f': (+3,+1,0, ['e','g','k']),
044|     'g': (+5,+1,0, ['f','l']),
045|     'h': (-3,-1,0, ['c','i','m']),
046|     'i': (-1,-1,0, ['d','h','j','n']),
047|     'j': (+1,-1,0, ['e','i','k']),
048|     'k': (+3,-1,0, ['f','j','l']),
049|     'l': (+5,-1,0, ['g','k']),
050|     'm': (-3,-3,0, ['h','n']),
051|     'n': (-1,-3,0, ['i','m']),
052| }
053| net_2 = { # was 4
054|     'a': (-3,+3,0, ['b','c']),
055|     'b': (-1,+3,0, ['a','d']),
056|     'c': (-3,+1,0, ['a','d','h']),
057|     'd': (-1,+1,0, ['b','c','e','i']),
058|     'e': (+1,+1,0, ['d','f','j']),
059|     'f': (+3,+1,0, ['e','g','k']),
060|     'g': (+5,+1,0, ['f','l']),
061|     'h': (-3,-1,0, ['c','i']),
062|     'i': (-1,-1,0, ['d','h','j','m']),
063|     'j': (+1,-1,0, ['e','i','k','n']),
064|     'k': (+3,-1,0, ['f','j','l']),
065|     'l': (+5,-1,0, ['g','k']),
066|     'm': (-1,-3,0, ['i','n']),
067|     'n': (+1,-3,0, ['j','m']),
068| }
069| net_3 = { # was 5
070|     'a': (-3,+3,0, ['b','c']),
071|     'b': (-1,+3,0, ['a','d']),
072|     'c': (-3,+1,0, ['a','d','h']),
073|     'd': (-1,+1,0, ['b','c','e','i']),
074|     'e': (+1,+1,0, ['d','f','j']),
075|     'f': (+3,+1,0, ['e','g','k']),
076|     'g': (+5,+1,0, ['f','l']),
077|     'h': (-3,-1,0, ['c','i']),
078|     'i': (-1,-1,0, ['d','h','j']),
079|     'j': (+1,-1,0, ['e','i','k','m']),
080|     'k': (+3,-1,0, ['f','j','l','n']),
081|     'l': (+5,-1,0, ['g','k']),
082|     'm': (+1,-3,0, ['j','n']),
083|     'n': (+3,-3,0, ['k','m']),
084| }
085| net_4 = { # was 6
086|     'a': (-3,+3,0, ['b','c']),
087|     'b': (-1,+3,0, ['a','d']),
088|     'c': (-3,+1,0, ['a','d','h']),
089|     'd': (-1,+1,0, ['b','c','e','i']),
090|     'e': (+1,+1,0, ['d','f','j']),
091|     'f': (+3,+1,0, ['e','g','k']),
092|     'g': (+5,+1,0, ['f','l']),
093|     'h': (-3,-1,0, ['c','i']),
094|     'i': (-1,-1,0, ['d','h','j']),
095|     'j': (+1,-1,0, ['e','i','k']),
096|     'k': (+3,-1,0, ['f','j','l','m']),
097|     'l': (+5,-1,0, ['g','k','n']),
098|     'm': (+3,-3,0, ['k','n']),
099|     'n': (+5,-3,0, ['l','m']),
100| }
101| net_5 = { # was 2
102|     'a': (-1,+3,0, ['b','d']),
103|     'b': (+1,+3,0, ['a','e']),
104|     'c': (-3,+1,0, ['d','h']),
105|     'd': (-1,+1,0, ['a','c','e','i']),
106|     'e': (+1,+1,0, ['b','d','f','j']),
107|     'f': (+3,+1,0, ['e','g','k']),
108|     'g': (+5,+1,0, ['f','l']),
109|     'h': (-3,-1,0, ['c','i']),
110|     'i': (-1,-1,0, ['d','h','j','m']),
111|     'j': (+1,-1,0, ['e','i','k','n']),
112|     'k': (+3,-1,0, ['f','j','l']),
113|     'l': (+5,-1,0, ['g','k']),
114|     'm': (-1,-3,0, ['i','n']),
115|     'n': (+1,-3,0, ['j','m']),
116| }
117| net_6 = { # was 3
118|     'a': (-1,+3,0, ['b','d']),
119|     'b': (+1,+3,0, ['a','e']),
120|     'c': (-3,+1,0, ['d','h']),
121|     'd': (-1,+1,0, ['a','c','e','i']),
122|     'e': (+1,+1,0, ['b','d','f','j']),
123|     'f': (+3,+1,0, ['e','g','k']),
124|     'g': (+5,+1,0, ['f','l']),
125|     'h': (-3,-1,0, ['c','i']),
126|     'i': (-1,-1,0, ['d','h','j']),
127|     'j': (+1,-1,0, ['e','i','k','m']),
128|     'k': (+3,-1,0, ['f','j','l','n']),
129|     'l': (+5,-1,0, ['g','k']),
130|     'm': (+1,-3,0, ['j','n']),
131|     'n': (+3,-3,0, ['k','m']),
132| }
133| net_7 = { # 7
134|     'a': (+1,+3,0, ['b','f']),
135|     'b': (+3,+3,0, ['a','c','g']),
136|     'c': (+5,+3,0, ['b','h']),
137|     'd': (-3,+1,0, ['e','i']),
138|     'e': (-1,+1,0, ['d','f','j']),
139|     'f': (+1,+1,0, ['a','e','g','k']),
140|     'g': (+3,+1,0, ['b','f','h','l']),
141|     'h': (+5,+1,0, ['c','g']),
142|     'i': (-3,-1,0, ['d','j','m']),
143|     'j': (-1,-1,0, ['e','i','k','n']),
144|     'k': (+1,-1,0, ['f','j','l']),
145|     'l': (+3,-1,0, ['g','k']),
146|     'm': (-3,-3,0, ['i','n']),
147|     'n': (-1,-3,0, ['j','m']),
148| }
149| net_8 = { # 8
150|     'a': (+1,+3,0, ['b','f']),
151|     'b': (+3,+3,0, ['a','c','g']),
152|     'c': (+5,+3,0, ['b','h']),
153|     'd': (-3,+1,0, ['e','i']),
154|     'e': (-1,+1,0, ['d','f','j']),
155|     'f': (+1,+1,0, ['a','e','g','k']),
156|     'g': (+3,+1,0, ['b','f','h','l']),
157|     'h': (+5,+1,0, ['c','g']),
158|     'i': (-3,-1,0, ['d','j']),
159|     'j': (-1,-1,0, ['e','i','k','m']),
160|     'k': (+1,-1,0, ['f','j','l','n']),
161|     'l': (+3,-1,0, ['g','k']),
162|     'm': (-1,-3,0, ['j','n']),
163|     'n': (+1,-3,0, ['k','m']),
164| }
165| net_9 = { # 9
166|     'a': (+1,+3,0, ['b','f']),
167|     'b': (+3,+3,0, ['a','c','g']),
168|     'c': (+5,+3,0, ['b','h']),
169|     'd': (-3,+1,0, ['e','i']),
170|     'e': (-1,+1,0, ['d','f','j']),
171|     'f': (+1,+1,0, ['a','e','g','k']),
172|     'g': (+3,+1,0, ['b','f','h','l']),
173|     'h': (+5,+1,0, ['c','g']),
174|     'i': (-3,-1,0, ['d','j']),
175|     'j': (-1,-1,0, ['e','i','k']),
176|     'k': (+1,-1,0, ['f','j','l','m']),
177|     'l': (+3,-1,0, ['g','k','n']),
178|     'm': (+1,-3,0, ['k','n']),
179|     'n': (+3,-3,0, ['l','m']),
180| }
181| net_10 = { # A
182|     'a': (-3,+3,0, ['b','d']),
183|     'b': (-1,+3,0, ['a','c','e']),
184|     'c': (+1,+3,0, ['b','f']),
185|     'd': (-3,+1,0, ['a','e']),
186|     'e': (-1,+1,0, ['b','d','f','h']),
187|     'f': (+1,+1,0, ['c','e','g','i']),
188|     'g': (+3,+1,0, ['f','j']),
189|     'h': (-1,-1,0, ['e','i']),
190|     'i': (+1,-1,0, ['f','h','j','l']),
191|     'j': (+3,-1,0, ['g','i','k','m']),
192|     'k': (+5,-1,0, ['j','n']),
193|     'l': (+1,-3,0, ['i','m']),
194|     'm': (+3,-3,0, ['j','l','n']),
195|     'n': (+5,-3,0, ['k','m']),
196| }
197| net_11 = { # B
198|     'a': (-5,+3,0, ['b','e']),
199|     'b': (-3,+3,0, ['a','c','f']),
200|     'c': (-1,+3,0, ['b','d','g']),
201|     'd': (+1,+3,0, ['c','h']),
202|     'e': (-5,+1,0, ['a','f']),
203|     'f': (-3,+1,0, ['b','e','g']),
204|     'g': (-1,+1,0, ['c','f','h','k']),
205|     'h': (+1,+1,0, ['d','g','i','l']),
206|     'i': (+3,+1,0, ['h','j','m']),
207|     'j': (+5,+1,0, ['i','n']),
208|     'k': (-1,-1,0, ['g','l']),
209|     'l': (+1,-1,0, ['h','k','m']),
210|     'm': (+3,-1,0, ['i','l','n']),
211|     'n': (+5,-1,0, ['j','m']),
212| }
213| 
214| ####################################################################################################
215| ## Net Properties
216| ## facedefs: CW when looking along negative axis
217| ##------------------------------------------------------------------------------------------------##
218| left = -18
219| top = 8
220| hspace = 12
221| vspace = 10
222| 
223| net_0_props = {
224|     'nid': 0,
225|     'name': 'Cube',
226|     'translate': 0,
227|     'offset': (left-4, top-(1*vspace), 0),
228|     'rotate': 1,
229|     'angles': (-20, -33, 0),
230|     'facedefs': [
231|         ('a','b','d','c'), ('e','f','h','g'), # top/bot
232|         ('d','c','g','h'), ('b','a','e','f'), # south/north
233|         ('d','b','f','h'), ('c','a','e','g')] # east/west
234| }
235| net_1_props = {
236|     'nid': 1, # 1
237|     'name': 'Cube Net #1',
238|     'translate': 0,
239|     'offset': (left+(0*hspace), top-(0*vspace), 0),
240|     'rotate': 0,
241|     'angles': (0, 0, 0),
242|     'facedefs': [
243|         ('a','b','d','c'),('h','i','n','m'),
244|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
245| }
246| net_2_props = {
247|     'nid': 2, # was 4
248|     'name': 'Cube Net #2',
249|     'translate': 0,
250|     'offset': (left+(1*hspace), top-(0*vspace), 0),
251|     'rotate': 0,
252|     'angles': (0, 0, 0),
253|     'facedefs': [
254|         ('a','b','d','c'),('i','j','n','m'),
255|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
256| }
257| net_3_props = {
258|     'nid': 3, # was 5
259|     'name': 'Cube Net #3',
260|     'translate': 0,
261|     'offset': (left+(2*hspace), top-(0*vspace), 0),
262|     'rotate': 0,
263|     'angles': (0, 0, 0),
264|     'facedefs': [
265|         ('a','b','d','c'),('j','k','n','m'),
266|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
267| }
268| net_4_props = {
269|     'nid': 4, # was 6
270|     'name': 'Cube Net #4',
271|     'translate': 0,
272|     'offset': (left+(3*hspace), top-(0*vspace), 0),
273|     'rotate': 0,
274|     'angles': (0, 0, 0),
275|     'facedefs': [
276|         ('a','b','d','c'),('k','l','n','m'),
277|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
278| }
279| net_5_props = {
280|     'nid': 5, # was 2
281|     'name': 'Cube Net #5',
282|     'translate': 0,
283|     'offset': (left+(1*hspace), top-(1*vspace), 0),
284|     'rotate': 0,
285|     'angles': (0, 0, 0),
286|     'facedefs': [
287|         ('a','b','e','d'),('i','j','n','m'),
288|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
289| }
290| net_6_props = {
291|     'nid': 6, # was 3
292|     'name': 'Cube Net #6',
293|     'translate': 0,
294|     'offset': (left+(2*hspace), top-(1*vspace), 0),
295|     'rotate': 0,
296|     'angles': (0, 0, 0),
297|     'facedefs': [
298|         ('a','b','e','d'),('j','k','n','m'),
299|         ('c','d','i','h'),('d','e','j','i'),('e','f','k','j'),('f','g','l','k')],
300| }
301| net_7_props = {
302|     'nid': 7, # 7
303|     'name': 'Cube Net #7',
304|     'translate': 0,
305|     'offset': (left+(0*hspace), top-(2*vspace), 0),
306|     'rotate': 0,
307|     'angles': (0, 0, 0),
308|     'facedefs': [
309|         ('a','b','g','f'),('b','c','h','g'),
310|         ('d','e','j','i'),('e','f','k','j'),('f','g','l','k'),
311|         ('i','j','n','m')],
312| }
313| net_8_props = {
314|     'nid': 8, # 8
315|     'name': 'Cube Net #8',
316|     'translate': 0,
317|     'offset': (left+(1*hspace), top-(2*vspace), 0),
318|     'rotate': 0,
319|     'angles': (0, 0, 0),
320|     'facedefs': [
321|         ('a','b','g','f'),('b','c','h','g'),
322|         ('d','e','j','i'),('e','f','k','j'),('f','g','l','k'),
323|         ('j','k','n','m')],
324| }
325| net_9_props = {
326|     'nid': 9, # 9
327|     'name': 'Cube Net #9',
328|     'translate': 0,
329|     'offset': (left+(2*hspace), top-(2*vspace), 0),
330|     'rotate': 0,
331|     'angles': (0, 0, 0),
332|     'facedefs': [
333|         ('a','b','g','f'),('b','c','h','g'),
334|         ('d','e','j','i'),('e','f','k','j'),('f','g','l','k'),
335|         ('k','l','n','m')],
336| }
337| net_10_props = {
338|     'nid': 10, # A
339|     'name': 'Cube Net #10',
340|     'translate': 0,
341|     'offset': (left+(3*hspace)+2, top-((2*vspace)+0), 0),
342|     'rotate': 0,
343|     'angles': (0, 0, 90),
344|     'facedefs': [
345|         ('a','b','e','d'),('b','c','f','e'),
346|         ('e','f','i','h'),('f','g','j','i'),
347|         ('i','j','m','l'),('j','k','n','m')],
348| }
349| net_11_props = {
350|     'nid': 11, # B
351|     'name': 'Cube Net #11',
352|     'translate': 0,
353|     'offset': (left+(3*hspace)+2, top-((1*vspace)+0), 0),
354|     'rotate': 0,
355|     'angles': (0, 0, 90),
356|     'facedefs': [
357|         ('a','b','f','e'),('b','c','g','f'),('c','d','h','g'),
358|         ('g','h','l','k'),('h','i','m','l'),('i','j','n','m')],
359| }
360| 
361| ####################################################################################################
362| ## Move Definitions
363| ##------------------------------------------------------------------------------------------------##
364| rot_1_a1_m1 = { # 1
365|     'a':{'pivot':'c', 'matrix':RotXpos},
366|     'b':{'pivot':'c', 'matrix':RotXpos},
367|     'm':{'pivot':'h', 'matrix':RotXneg},
368|     'n':{'pivot':'h', 'matrix':RotXneg},
369|     'f':{'pivot':'e', 'matrix':RotYpos},
370|     'g':{'pivot':'e', 'matrix':RotYpos},
371|     'k':{'pivot':'e', 'matrix':RotYpos},
372|     'l':{'pivot':'e', 'matrix':RotYpos},
373| }
374| rot_1_a1_m2 = {
375|     'a':{'pivot':'d', 'matrix':RotYneg},
376|     'b':{'pivot':'d', 'matrix':RotYneg},
377|     'c':{'pivot':'d', 'matrix':RotYneg},
378|     'h':{'pivot':'d', 'matrix':RotYneg},
379|     'm':{'pivot':'d', 'matrix':RotYneg},
380|     'n':{'pivot':'d', 'matrix':RotYneg},
381| }
382| rot_1_a1_m3 = {
383|     'g':{'pivot':'f', 'matrix':RotYpos},
384|     'l':{'pivot':'f', 'matrix':RotYpos},
385| }
386| ##------------------------------------------------------------------------------------------------##
387| rot_2_a1_m1 = { # was 4
388|     'a':{'pivot':'c', 'matrix':RotXpos},
389|     'b':{'pivot':'c', 'matrix':RotXpos},
390|     'm':{'pivot':'i', 'matrix':RotXneg},
391|     'n':{'pivot':'i', 'matrix':RotXneg},
392|     'g':{'pivot':'f', 'matrix':RotYpos},
393|     'l':{'pivot':'f', 'matrix':RotYpos},
394| }
395| rot_2_a1_m2 = {
396|     'a':{'pivot':'d', 'matrix':RotYneg},
397|     'b':{'pivot':'d', 'matrix':RotYneg},
398|     'c':{'pivot':'d', 'matrix':RotYneg},
399|     'h':{'pivot':'d', 'matrix':RotYneg},
400|     'f':{'pivot':'e', 'matrix':RotYpos},
401|     'g':{'pivot':'e', 'matrix':RotYpos},
402|     'k':{'pivot':'e', 'matrix':RotYpos},
403|     'l':{'pivot':'e', 'matrix':RotYpos},
404| }
405| ##------------------------------------------------------------------------------------------------##
406| rot_3_a1_m1 = { # was 5
407|     'a':{'pivot':'d', 'matrix':RotYneg},
408|     'b':{'pivot':'d', 'matrix':RotYneg},
409|     'c':{'pivot':'d', 'matrix':RotYneg},
410|     'h':{'pivot':'d', 'matrix':RotYneg},
411|     'f':{'pivot':'e', 'matrix':RotYpos},
412|     'g':{'pivot':'e', 'matrix':RotYpos},
413|     'k':{'pivot':'e', 'matrix':RotYpos},
414|     'l':{'pivot':'e', 'matrix':RotYpos},
415|     'm':{'pivot':'e', 'matrix':RotYpos},
416|     'n':{'pivot':'e', 'matrix':RotYpos},
417| }
418| rot_3_a1_m2 = {
419|     'a':{'pivot':'d', 'matrix':RotZneg},
420|     'b':{'pivot':'d', 'matrix':RotZneg},
421|     'g':{'pivot':'f', 'matrix':RotYpos},
422|     'l':{'pivot':'f', 'matrix':RotYpos},
423|     'm':{'pivot':'j', 'matrix':RotZneg},
424|     'n':{'pivot':'j', 'matrix':RotZneg},
425| }
426| ##------------------------------------------------------------------------------------------------##
427| rot_4_a1_m1 = { # was 6
428|     'a':{'pivot':'d', 'matrix':RotYneg},
429|     'b':{'pivot':'d', 'matrix':RotYneg},
430|     'c':{'pivot':'d', 'matrix':RotYneg},
431|     'h':{'pivot':'d', 'matrix':RotYneg},
432|     'g':{'pivot':'f', 'matrix':RotYpos},
433|     'l':{'pivot':'f', 'matrix':RotYpos},
434|     'm':{'pivot':'f', 'matrix':RotYpos},
435|     'n':{'pivot':'f', 'matrix':RotYpos},
436| }
437| rot_4_a1_m2 = {
438|     'a':{'pivot':'d', 'matrix':RotZneg},
439|     'b':{'pivot':'d', 'matrix':RotZneg},
440|     'm':{'pivot':'k', 'matrix':RotZneg},
441|     'n':{'pivot':'k', 'matrix':RotZneg},
442| }
443| rot_4_a1_m3 = {
444|     'f':{'pivot':'e', 'matrix':RotYpos},
445|     'g':{'pivot':'e', 'matrix':RotYpos},
446|     'k':{'pivot':'e', 'matrix':RotYpos},
447|     'l':{'pivot':'e', 'matrix':RotYpos},
448|     'm':{'pivot':'e', 'matrix':RotYpos},
449|     'n':{'pivot':'e', 'matrix':RotYpos},
450| }
451| ##------------------------------------------------------------------------------------------------##
452| rot_5_a1_m1 = { # was2
453|     'a':{'pivot':'d', 'matrix':RotXpos},
454|     'b':{'pivot':'d', 'matrix':RotXpos},
455|     'm':{'pivot':'i', 'matrix':RotXneg},
456|     'n':{'pivot':'i', 'matrix':RotXneg},
457|     'c':{'pivot':'d', 'matrix':RotYneg},
458|     'h':{'pivot':'d', 'matrix':RotYneg},
459|     'f':{'pivot':'e', 'matrix':RotYpos},
460|     'k':{'pivot':'e', 'matrix':RotYpos},
461|     'g':{'pivot':'e', 'matrix':RotYpos},
462|     'l':{'pivot':'e', 'matrix':RotYpos},
463| }
464| rot_5_a1_m2 = {
465|     'g':{'pivot':'f', 'matrix':RotYpos},
466|     'l':{'pivot':'f', 'matrix':RotYpos},
467| }
468| ##------------------------------------------------------------------------------------------------##
469| rot_6_a1_m1 = { # was3
470|     'a':{'pivot':'d', 'matrix':RotXpos},
471|     'b':{'pivot':'d', 'matrix':RotXpos},
472|     'c':{'pivot':'d', 'matrix':RotYneg},
473|     'h':{'pivot':'d', 'matrix':RotYneg},
474|     'f':{'pivot':'e', 'matrix':RotYpos},
475|     'g':{'pivot':'e', 'matrix':RotYpos},
476|     'k':{'pivot':'e', 'matrix':RotYpos},
477|     'l':{'pivot':'e', 'matrix':RotYpos},
478|     'm':{'pivot':'e', 'matrix':RotYpos},
479|     'n':{'pivot':'e', 'matrix':RotYpos},
480| }
481| rot_6_a1_m2 = {
482|     'g':{'pivot':'f', 'matrix':RotYpos},
483|     'l':{'pivot':'f', 'matrix':RotYpos},
484|     'm':{'pivot':'j', 'matrix':RotZneg},
485|     'n':{'pivot':'j', 'matrix':RotZneg},
486| }
487| ##------------------------------------------------------------------------------------------------##
488| rot_7_a1_m1 = { # 7
489|     'b':{'pivot':'f', 'matrix':RotYpos},
490|     'c':{'pivot':'f', 'matrix':RotYpos},
491|     'g':{'pivot':'f', 'matrix':RotYpos},
492|     'h':{'pivot':'f', 'matrix':RotYpos},
493|     'l':{'pivot':'f', 'matrix':RotYpos},
494|     'd':{'pivot':'e', 'matrix':RotYneg},
495|     'i':{'pivot':'e', 'matrix':RotYneg},
496|     'm':{'pivot':'e', 'matrix':RotYneg},
497|     'n':{'pivot':'e', 'matrix':RotYneg},
498| }
499| rot_7_a1_m2 = {
500|     'a':{'pivot':'f', 'matrix':RotZpos},
501|     'b':{'pivot':'f', 'matrix':RotZpos},
502|     'c':{'pivot':'f', 'matrix':RotZpos},
503|     'm':{'pivot':'j', 'matrix':RotZpos},
504|     'n':{'pivot':'j', 'matrix':RotZpos},
505| }
506| rot_7_a1_m3 = {
507|     'c':{'pivot':'b', 'matrix':RotXpos},
508|     'h':{'pivot':'b', 'matrix':RotXpos},
509| }
510| ##------------------------------------------------------------------------------------------------##
511| rot_8_a1_m1 = { # 8
512|     'a':{'pivot':'f', 'matrix':RotXpos},
513|     'b':{'pivot':'f', 'matrix':RotXpos},
514|     'c':{'pivot':'f', 'matrix':RotXpos},
515|     'd':{'pivot':'e', 'matrix':RotYneg},
516|     'i':{'pivot':'e', 'matrix':RotYneg},
517|     'm':{'pivot':'j', 'matrix':RotXneg},
518|     'n':{'pivot':'j', 'matrix':RotXneg},
519| }
520| rot_8_a1_m2 = {
521|     'a':{'pivot':'f', 'matrix':RotYpos},
522|     'b':{'pivot':'f', 'matrix':RotYpos},
523|     'c':{'pivot':'f', 'matrix':RotYpos},
524|     'g':{'pivot':'f', 'matrix':RotYpos},
525|     'h':{'pivot':'f', 'matrix':RotYpos},
526|     'l':{'pivot':'f', 'matrix':RotYpos},
527| }
528| rot_8_a1_m3 = {
529|     'c':{'pivot':'b', 'matrix':RotXpos},
530|     'h':{'pivot':'b', 'matrix':RotXpos},
531| }
532| ##------------------------------------------------------------------------------------------------##
533| rot_9_a1_m1 = { # 9
534|     'c':{'pivot':'b', 'matrix':RotYpos},
535|     'h':{'pivot':'b', 'matrix':RotYpos},
536|     'd':{'pivot':'e', 'matrix':RotYneg},
537|     'i':{'pivot':'e', 'matrix':RotYneg},
538|     'm':{'pivot':'k', 'matrix':RotXneg},
539|     'n':{'pivot':'k', 'matrix':RotXneg},
540| }
541| rot_9_a1_m2 = {
542|     'a':{'pivot':'f', 'matrix':RotXpos},
543|     'b':{'pivot':'f', 'matrix':RotXpos},
544|     'c':{'pivot':'f', 'matrix':RotXpos},
545|     'h':{'pivot':'f', 'matrix':RotXpos},
546| }
547| rot_9_a1_m3 = {
548|     'a':{'pivot':'f', 'matrix':RotYpos},
549|     'b':{'pivot':'f', 'matrix':RotYpos},
550|     'c':{'pivot':'f', 'matrix':RotYpos},
551|     'g':{'pivot':'f', 'matrix':RotYpos},
552|     'h':{'pivot':'f', 'matrix':RotYpos},
553|     'l':{'pivot':'f', 'matrix':RotYpos},
554|     'm':{'pivot':'f', 'matrix':RotYpos},
555|     'n':{'pivot':'f', 'matrix':RotYpos},
556| }
557| ##------------------------------------------------------------------------------------------------##
558| rot_10_a1_m1 = { # A
559|     'a':{'pivot':'e', 'matrix':RotYneg},
560|     'd':{'pivot':'e', 'matrix':RotYneg},
561|     'k':{'pivot':'j', 'matrix':RotYpos},
562|     'n':{'pivot':'j', 'matrix':RotYpos},
563| }
564| rot_10_a1_m2 = {
565|     'a':{'pivot':'e', 'matrix':RotXpos},
566|     'b':{'pivot':'e', 'matrix':RotXpos},
567|     'c':{'pivot':'e', 'matrix':RotXpos},
568|     'd':{'pivot':'e', 'matrix':RotXpos},
569|     'k':{'pivot':'j', 'matrix':RotXneg},
570|     'l':{'pivot':'j', 'matrix':RotXneg},
571|     'm':{'pivot':'j', 'matrix':RotXneg},
572|     'n':{'pivot':'j', 'matrix':RotXneg},
573| }
574| rot_10_a1_m3 = {
575|     'g':{'pivot':'i', 'matrix':RotYpos},
576|     'j':{'pivot':'i', 'matrix':RotYpos},
577|     'k':{'pivot':'i', 'matrix':RotYpos},
578|     'l':{'pivot':'i', 'matrix':RotYpos},
579|     'm':{'pivot':'i', 'matrix':RotYpos},
580|     'n':{'pivot':'i', 'matrix':RotYpos},
581| }
582| ##------------------------------------------------------------------------------------------------##
583| rot_11_a1_m1 = { # B
584|     'a':{'pivot':'c', 'matrix':RotYneg},
585|     'b':{'pivot':'c', 'matrix':RotYneg},
586|     'e':{'pivot':'c', 'matrix':RotYneg},
587|     'f':{'pivot':'c', 'matrix':RotYneg},
588|     'i':{'pivot':'h', 'matrix':RotYpos},
589|     'j':{'pivot':'h', 'matrix':RotYpos},
590|     'm':{'pivot':'h', 'matrix':RotYpos},
591|     'n':{'pivot':'h', 'matrix':RotYpos},
592| }
593| rot_11_a1_m2 = {
594|     'a':{'pivot':'g', 'matrix':RotXpos},
595|     'b':{'pivot':'g', 'matrix':RotXpos},
596|     'c':{'pivot':'g', 'matrix':RotXpos},
597|     'd':{'pivot':'g', 'matrix':RotXpos},
598|     'e':{'pivot':'g', 'matrix':RotXpos},
599|     'f':{'pivot':'g', 'matrix':RotXpos},
600|     'j':{'pivot':'i', 'matrix':RotYpos},
601|     'n':{'pivot':'i', 'matrix':RotYpos},
602| }
603| rot_11_a1_m3 = {
604|     'a':{'pivot':'b', 'matrix':RotZpos},
605|     'e':{'pivot':'b', 'matrix':RotZpos},
606| }
607| 
608| ####################################################################################################
609| rot_1_a2_m1 = { # 1
610|     'a':{'pivot':'b', 'matrix':RotYneg},
611|     'c':{'pivot':'b', 'matrix':RotYneg},
612|     'h':{'pivot':'b', 'matrix':RotYneg},
613|     'm':{'pivot':'b', 'matrix':RotYneg},
614|     'g':{'pivot':'f', 'matrix':RotYpos},
615|     'l':{'pivot':'f', 'matrix':RotYpos},
616| }
617| rot_1_a2_m2 = {
618|     'a':{'pivot':'c', 'matrix':RotZneg},
619|     'b':{'pivot':'c', 'matrix':RotZneg},
620|     'm':{'pivot':'h', 'matrix':RotZpos},
621|     'n':{'pivot':'h', 'matrix':RotZpos},
622| }
623| rot_1_a2_m3 = {
624|     'f':{'pivot':'e', 'matrix':RotYpos},
625|     'g':{'pivot':'e', 'matrix':RotYpos},
626|     'k':{'pivot':'e', 'matrix':RotYpos},
627|     'l':{'pivot':'e', 'matrix':RotYpos},
628| }
629| 
630| 
631| ####################################################################################################
632| ## Cube Net Objects
633| ##------------------------------------------------------------------------------------------------##
634| '''The Eleven Unique Cube Nets.'''
635| CN0 = cubenet(net_0, net_0_props)
636| CN1 = cubenet(net_1, net_1_props)
637| CN2 = cubenet(net_2, net_2_props)
638| CN3 = cubenet(net_3, net_3_props)
639| CN4 = cubenet(net_4, net_4_props)
640| CN5 = cubenet(net_5, net_5_props)
641| CN6 = cubenet(net_6, net_6_props)
642| CN7 = cubenet(net_7, net_7_props)
643| CN8 = cubenet(net_8, net_8_props)
644| CN9 = cubenet(net_9, net_9_props)
645| CN10 = cubenet(net_10, net_10_props)
646| CN11 = cubenet(net_11, net_11_props)
647| 
648| 
649| 
650| ####################################################################################################
651| ## Tesseract and TessCross
652| ##------------------------------------------------------------------------------------------------##
653| net_tesseract = {
654|     'a': (-2,+2,-2, ['b','d','e','i']), # outer cube, front
655|     'b': (+2,+2,-2, ['a','c','f','j']),
656|     'c': (+2,-2,-2, ['d','b','g','k']),
657|     'd': (-2,-2,-2, ['c','a','h','l']),
658|     'e': (-2,+2,+2, ['f','h','a','m']), # outer cube, back
659|     'f': (+2,+2,+2, ['e','g','b','n']),
660|     'g': (+2,-2,+2, ['h','f','c','o']),
661|     'h': (-2,-2,+2, ['g','e','d','p']),
662|     'i': (-1,+1,-1, ['j','l','m','a']), # inner cube, front
663|     'j': (+1,+1,-1, ['i','k','n','b']),
664|     'k': (+1,-1,-1, ['l','j','o','c']),
665|     'l': (-1,-1,-1, ['k','i','p','d']),
666|     'm': (-1,+1,+1, ['n','p','i','e']), # inner cube, back
667|     'n': (+1,+1,+1, ['m','o','j','f']),
668|     'o': (+1,-1,+1, ['p','n','k','g']),
669|     'p': (-1,-1,+1, ['o','m','l','h']),
670| }
671| net_tesscross = {
672|     'a': (+1,+1,+1, ['m','e','u','c','2','b']), # center cube
673|     'b': (+1,+1,-1, ['n','f','v','d','a','6']),
674|     'c': (+1,-1,+1, ['o','g','a','y','3','d']),
675|     'd': (+1,-1,-1, ['p','h','b','z','c','7']),
676|     'e': (-1,+1,+1, ['a','i','w','g','4','f']),
677|     'f': (-1,+1,-1, ['b','j','x','h','e','8']),
678|     'g': (-1,-1,+1, ['c','k','e','0','5','h']),
679|     'h': (-1,-1,-1, ['d','l','f','1','g','9']),
680| 
681|     'i': (-3,+1,+1, ['e','k','j']), # -X -1 cube
682|     'j': (-3,+1,-1, ['f','l','i']),
683|     'k': (-3,-1,+1, ['g','i','l']),
684|     'l': (-3,-1,-1, ['h','j','k']),
685| 
686|     'm': (+3,+1,+1, ['q','a','o','n']), # +X +1 cube
687|     'n': (+3,+1,-1, ['r','b','p','m']),
688|     'o': (+3,-1,+1, ['s','c','m','p']),
689|     'p': (+3,-1,-1, ['t','d','n','o']),
690| 
691|     'q': (+5,+1,+1, ['m','s','r']), # +X +2 cube
692|     'r': (+5,+1,-1, ['n','t','q']),
693|     's': (+5,-1,+1, ['o','q','t']),
694|     't': (+5,-1,-1, ['p','r','s']),
695| 
696|     'u': (+1,+3,+1, ['w','a','v']), # +Y +1 cube
697|     'v': (+1,+3,-1, ['x','b','u']),
698|     'w': (-1,+3,+1, ['u','e','x']),
699|     'x': (-1,+3,-1, ['v','f','w']),
700|     'y': (+1,-3,+1, ['0','c','z']), # -Y +1 cube
701|     'z': (+1,-3,-1, ['1','d','y']),
702|     '0': (-1,-3,+1, ['y','g','1']),
703|     '1': (-1,-3,-1, ['z','h','0']),
704| 
705|     '2': (+1,+1,+3, ['4','3','a']), # +Z +1 cube
706|     '3': (+1,-1,+3, ['5','2','c']),
707|     '4': (-1,+1,+3, ['2','5','e']),
708|     '5': (-1,-1,+3, ['3','4','g']),
709|     '6': (+1,+1,-3, ['8','7','b']), # -Z +1 cube
710|     '7': (+1,-1,-3, ['9','6','d']),
711|     '8': (-1,+1,-3, ['6','9','f']),
712|     '9': (-1,-1,-3, ['7','8','h']),
713| }
714| net_tesseract_props = {
715|     'nid': 40,
716|     'name': 'Tesseract',
717|     'rotate': 1,
718|     'angles': (0,0,45),
719|     'translate': 1,
720|     'offset': (0, 0, +3),
721|     'facedefs': [
722|         ('i','j','k','l'),('m','n','o','p'), # inner top/bot
723|         ('j','i','m','n'),('k','l','p','o'), # inner north/south
724|         ('k','j','n','o'),('l','i','m','p'), # inner east/west
725|     ]
726| }
727| net_tesscross_props = {
728|     'nid': 41,
729|     'name': 'Tesscross',
730|     'rotate': 1,
731|     'angles': (0,0,-45),
732|     'translate': 1,
733|     'offset': (0, 0, +3),
734|     'facedefs': [
735|         ('4','2','3','5'),('w','u','a','e'),('i','e','g','k'),('a','m','o','c'),('m','q','s','o'),('g','c','y','0'), # top
736|         ('8','6','7','9'),('x','v','b','f'),('j','f','h','l'),('b','n','p','d'),('n','r','t','p'),('h','d','z','1'), # bot
737|         ('2','4','e','a'),('e','i','j','f'),('u','w','x','v'),('m','a','b','n'),('q','m','n','r'),('b','f','8','6'), # north
738|         ('3','5','g','c'),('g','k','l','h'),('y','0','1','z'),('o','c','d','p'),('s','o','p','t'),('d','h','9','7'), # south
739|         ('3','2','a','c'),('y','c','d','z'),('s','q','r','t'),('a','u','v','b'),('d','b','6','7'), # east
740|         ('5','4','e','g'),('0','g','h','1'),('k','i','j','l'),('e','w','x','f'),('h','f','8','9'), # west
741|     ]
742| }
743| 
744| Tesseract = cubenet(net_tesseract, net_tesseract_props)
745| Tesscross = cubenet(net_tesscross, net_tesscross_props)
746| 
747| 
748| ####################################################################################################
749| ## Soma Cube Shapes
750| ##------------------------------------------------------------------------------------------------##
751| net_soma_1 = {
752|     'a': (-1,+1,+2, ['b','d','i']), # top points
753|     'b': (+1,+1,+2, ['a','c','e','j']),
754|     'c': (+3,+1,+2, ['b','f','k']),
755|     'd': (-1,-1,+2, ['e','a','g','l']),
756|     'e': (+1,-1,+2, ['d','f','b','h','m']),
757|     'f': (+3,-1,+2, ['e','c','n']),
758|     'g': (-1,-3,+2, ['h','d','o']),
759|     'h': (+1,-3,+2, ['g','e','p']),
760|     'i': (-1,+1, 0, ['j','l','a']), # bottom points
761|     'j': (+1,+1, 0, ['i','k','m','b']),
762|     'k': (+3,+1, 0, ['j','n','c']),
763|     'l': (-1,-1, 0, ['m','i','o','d']),
764|     'm': (+1,-1, 0, ['l','n','j','p','e']),
765|     'n': (+3,-1, 0, ['m','k','f']),
766|     'o': (-1,-3, 0, ['p','l','g']),
767|     'p': (+1,-3, 0, ['o','m','h']),
768| }
769| net_soma_2 = {
770|     'a': (-1,+3,+2, ['b','d','k']), # top points
771|     'b': (+1,+3,+2, ['a','c','e','l']),
772|     'c': (+3,+3,+2, ['b','f','m']),
773|     'd': (-1,+1,+2, ['e','a','g','n']),
774|     'e': (+1,+1,+2, ['d','f','b','h','o']),
775|     'f': (+3,+1,+2, ['e','c','p']),
776|     'g': (-1,-1,+2, ['h','d','i','q']),
777|     'h': (+1,-1,+2, ['g','e','j','r']),
778|     'i': (-1,-3,+2, ['j','g','s']),
779|     'j': (+1,-3,+2, ['i','h','t']),
780|     'k': (-1,+3, 0, ['l','n','a']), # bottom points
781|     'l': (+1,+3, 0, ['k','m','o','b']),
782|     'm': (+3,+3, 0, ['l','p','c']),
783|     'n': (-1,+1, 0, ['o','k','q','d']),
784|     'o': (+1,+1, 0, ['n','p','l','r','e']),
785|     'p': (+3,+1, 0, ['o','m','f']),
786|     'q': (-1,-1, 0, ['r','n','s','g']),
787|     'r': (+1,-1, 0, ['q','o','t','h']),
788|     's': (-1,-3, 0, ['t','q','i']),
789|     't': (+1,-3, 0, ['s','r','j']),
790| }
791| net_soma_3 = {
792|     'a': (-1,+3,+2, ['b','c','k']), # top points
793|     'b': (+1,+3,+2, ['a','d','l']),
794|     'c': (-1,+1,+2, ['d','a','f','m']),
795|     'd': (+1,+1,+2, ['c','e','b','g','n']),
796|     'e': (+3,+1,+2, ['d','h','o']),
797|     'f': (-1,-1,+2, ['g','c','i','p']),
798|     'g': (+1,-1,+2, ['f','h','d','j','q']),
799|     'h': (+3,-1,+2, ['g','e','r']),
800|     'i': (-1,-3,+2, ['j','f','s']),
801|     'j': (+1,-3,+2, ['i','g','t']),
802|     'k': (-1,+3, 0, ['l','m','a']), # bottom points
803|     'l': (+1,+3, 0, ['k','n','b']),
804|     'm': (-1,+1, 0, ['n','k','p','c']),
805|     'n': (+1,+1, 0, ['m','o','l','q','d']),
806|     'o': (+3,+1, 0, ['n','r','e']),
807|     'p': (-1,-1, 0, ['q','m','s','f']),
808|     'q': (+1,-1, 0, ['p','r','n','t','g']),
809|     'r': (+3,-1, 0, ['q','o','h']),
810|     's': (-1,-3, 0, ['t','p','i']),
811|     't': (+1,-3, 0, ['s','q','j']),
812| }
813| net_soma_4 = {
814|     'a': (-1,+3,+2, ['b','c','k']), # top points
815|     'b': (+1,+3,+2, ['a','d','l']),
816|     'c': (-1,+1,+2, ['d','a','f','m']),
817|     'd': (+1,+1,+2, ['c','e','b','g','n']),
818|     'e': (+3,+1,+2, ['d','h','o']),
819|     'f': (-1,-1,+2, ['g','c','p']),
820|     'g': (+1,-1,+2, ['f','h','d','i','q']),
821|     'h': (+3,-1,+2, ['g','e','j','r']),
822|     'i': (+1,-3,+2, ['j','g','s']),
823|     'j': (+3,-3,+2, ['i','h','t']),
824|     'k': (-1,+3, 0, ['l','m','a']), # bottom points
825|     'l': (+1,+3, 0, ['k','n','b']),
826|     'm': (-1,+1, 0, ['n','k','p','c']),
827|     'n': (+1,+1, 0, ['m','o','l','q','d']),
828|     'o': (+3,+1, 0, ['n','r','e']),
829|     'p': (-1,-1, 0, ['q','m','f']),
830|     'q': (+1,-1, 0, ['p','r','n','s','g']),
831|     'r': (+3,-1, 0, ['q','o','t','h']),
832|     's': (+1,-3, 0, ['t','q','i']),
833|     't': (+3,-3, 0, ['s','r','j']),
834| }
835| net_soma_5 = {
836|     'a': (-1,+3,+4, ['b','c','e']), # top points
837|     'b': (+1,+3,+4, ['a','d','f']),
838|     'c': (-1,+1,+4, ['d','a','g']),
839|     'd': (+1,+1,+4, ['c','b','h']),
840|     'e': (-1,+3,+2, ['f','g','a','m']), # middle points
841|     'f': (+1,+3,+2, ['e','h','b','n']),
842|     'g': (-1,+1,+2, ['h','e','j','c','o']),
843|     'h': (+1,+1,+2, ['g','i','f','k','d','p']),
844|     'i': (+3,+1,+2, ['h','l','q']),
845|     'j': (-1,-1,+2, ['k','g','r']),
846|     'k': (+1,-1,+2, ['j','l','h','s']),
847|     'l': (+3,-1,+2, ['k','i','t']),
848|     'm': (-1,+3, 0, ['n','o','e']), # bottom points
849|     'n': (+1,+3, 0, ['m','p','f']),
850|     'o': (-1,+1, 0, ['p','m','r','g']),
851|     'p': (+1,+1, 0, ['o','q','n','s','h']),
852|     'q': (+3,+1, 0, ['p','t','i']),
853|     'r': (-1,-1, 0, ['s','o','j']),
854|     's': (+1,-1, 0, ['r','t','p','k']),
855|     't': (+3,-1, 0, ['s','q','l']),
856| }
857| net_soma_6 = {
858|     'a': (-1,+3,+4, ['b','c','e']), # top points
859|     'b': (+1,+3,+4, ['a','d','f']),
860|     'c': (-1,+1,+4, ['d','a','h']),
861|     'd': (+1,+1,+4, ['c','b','i']),
862|     'e': (-1,+3,+2, ['f','h','a','m']), # middle points
863|     'f': (+1,+3,+2, ['e','i','b','n']),
864|     'g': (-3,+1,+2, ['h','j','o']),
865|     'h': (-1,+1,+2, ['g','i','e','k','c','p']),
866|     'i': (+1,+1,+2, ['h','f','l','d','q']),
867|     'j': (-3,-1,+2, ['k','g','r']),
868|     'k': (-1,-1,+2, ['j','l','h','s']),
869|     'l': (+1,-1,+2, ['k','i','t']),
870|     'm': (-1,+3, 0, ['n','p','e']), # bottom points
871|     'n': (+1,+3, 0, ['m','q','f']),
872|     'o': (-3,+1, 0, ['p','r','g']),
873|     'p': (-1,+1, 0, ['o','q','m','s','h']),
874|     'q': (+1,+1, 0, ['p','n','t','i']),
875|     'r': (-3,-1, 0, ['s','o','j']),
876|     's': (-1,-1, 0, ['r','t','p','k']),
877|     't': (+1,-1, 0, ['s','q','l']),
878| }
879| net_soma_7 = {
880|     'a': (-1,+1,+4, ['b','c','e']), # top points
881|     'b': (+1,+1,+4, ['a','d','f']),
882|     'c': (-1,-1,+4, ['d','a','h']),
883|     'd': (+1,-1,+4, ['c','b','i']),
884|     'e': (-1,+1,+2, ['f','h','a','m']), # middle points
885|     'f': (+1,+1,+2, ['e','g','i','b','n']),
886|     'g': (+3,+1,+2, ['f','j','o']),
887|     'h': (-1,-1,+2, ['i','e','k','c','p']),
888|     'i': (+1,-1,+2, ['h','j','f','l','d','q']),
889|     'j': (+3,-1,+2, ['i','g','r']),
890|     'k': (-1,-3,+2, ['l','h','s']),
891|     'l': (+1,-3,+2, ['k','i','t']),
892|     'm': (-1,+1, 0, ['n','p','e']), # bottom points
893|     'n': (+1,+1, 0, ['m','o','q','f']),
894|     'o': (+3,+1, 0, ['n','r','g']),
895|     'p': (-1,-1, 0, ['q','m','s','h']),
896|     'q': (+1,-1, 0, ['p','r','n','t','i']),
897|     'r': (+3,-1, 0, ['q','o','j']),
898|     's': (-1,-3, 0, ['t','p','k']),
899|     't': (+1,-3, 0, ['s','q','l']),
900| }
901| net_soma_1_props = {
902|     'nid': 61,
903|     'name': 'Soma Cube Shape #1',
904|     'rotate': 0,
905|     'angles': (0,0,0),
906|     'translate': 0,
907|     'offset': (0, 0, 0),
908|     'facedefs': [
909|         ('a','b','e','d'),('b','c','f','e'),('d','e','h','g'), #top
910|         ('i','j','m','l'),('j','k','n','m'),('l','m','p','o'), #bot
911|         ('c','k','n','f'),('e','m','p','h'), ('a','i','l','d'),('d','l','o','g'), #e/w
912|         ('g','h','p','o'),('e','f','n','m'), ('a','b','j','i'),('b','c','k','j'), #s/n
913|     ]
914| }
915| net_soma_2_props = {
916|     'nid': 62,
917|     'name': 'Soma Cube Shape #2',
918|     'rotate': 0,
919|     'angles': (0,0,0),
920|     'translate': 0,
921|     'offset': (0, 0, 0),
922|     'facedefs': [
923|         ('a','b','e','d'),('b','c','f','e'),('d','e','h','g'),('g','h','j','i'), #top
924|         ('k','l','o','n'),('l','m','p','o'),('n','o','r','q'),('q','r','t','s'), #bot
925|         ('i','j','t','s'),('e','f','p','o'),('a','b','l','k'),('b','c','m','l'), #s/n
926|         ('a','k','n','d'),('d','n','q','g'),('g','q','s','i'), #west
927|         ('h','r','t','j'),('e','o','r','h'),('c','m','p','f'), #east
928|     ]
929| }
930| net_soma_3_props = {
931|     'nid': 63,
932|     'name': 'Soma Cube Shape #3',
933|     'rotate': 0,
934|     'angles': (0,0,0),
935|     'translate': 0,
936|     'offset': (0, 0, 0),
937|     'facedefs': [
938|         ('a','b','d','c'),('c','d','g','f'),('d','e','h','g'),('f','g','j','i'), #top
939|         ('k','l','n','m'),('m','n','q','p'),('n','o','r','q'),('p','q','t','s'), #bot
940|         ('i','j','t','s'),('g','h','r','q'),('a','b','l','k'),('d','e','o','n'), #s/n
941|         ('c','a','k','m'),('f','c','m','p'),('i','f','p','s'), #west
942|         ('d','b','l','n'),('h','e','o','r'),('j','g','q','t'), #east
943|     ]
944| }
945| net_soma_4_props = {
946|     'nid': 64,
947|     'name': 'Soma Cube Shape #4',
948|     'rotate': 0,
949|     'angles': (0,0,0),
950|     'translate': 0,
951|     'offset': (0, 0, 0),
952|     'facedefs': [
953|         ('a','b','d','c'),('c','d','g','f'),('d','e','h','g'),('g','h','j','i'), #top
954|         ('k','l','n','m'),('m','n','q','p'),('n','o','r','q'),('q','r','t','s'), #bot
955|         ('f','g','q','p'),('i','j','t','s'),('a','b','l','k'),('d','e','o','n'), #s/n
956|         ('c','a','k','m'),('f','c','m','p'),('i','g','q','s'), #west
957|         ('d','b','l','n'),('h','e','o','r'),('j','h','r','t'), #east
958| 
959| 
960|     ]
961| }
962| net_soma_5_props = {
963|     'nid': 65,
964|     'name': 'Soma Cube Shape #5',
965|     'rotate': 0,
966|     'angles': (0,0,0),
967|     'translate': 0,
968|     'offset': (0, 0, 0),
969|     'facedefs': [
970|         ('a','b','d','c'),('g','h','k','j'),('h','i','l','k'), #top
971|         ('m','n','p','o'),('o','p','s','r'),('p','q','t','s'), #bot
972|         ('d','c','g','h'),('k','j','r','s'),('l','k','s','t'), #south
973|         ('b','a','e','f'),('f','e','m','n'),('i','h','p','q'), #north
974|         ('c','a','e','g'),('g','e','m','o'),('j','g','o','r'), #west
975|         ('d','b','f','h'),('h','f','n','p'),('l','i','q','t'), #east
976|     ]
977| }
978| net_soma_6_props = {
979|     'nid': 66,
980|     'name': 'Soma Cube Shape #6',
981|     'rotate': 0,
982|     'angles': (0,0,0),
983|     'translate': 0,
984|     'offset': (0, 0, 0),
985|     'facedefs': [
986|         ('a','b','d','c'), ('g','h','k','j'), ('h','i','l','k'), #top
987|         ('m','n','q','p'), ('o','p','s','r'), ('p','q','t','s'), #bot
988|         ('d','c','h','i'), ('l','k','s','t'), ('k','j','r','s'), #south
989|         ('b','a','e','f'), ('f','e','m','n'), ('h','g','o','p'), #north
990|         ('c','a','e','h'), ('h','e','m','p'), ('j','g','o','r'), #west
991|         ('d','b','f','i'), ('i','f','n','q'), ('l','i','q','t'), #east
992|     ]
993| }
994| net_soma_7_props = {
995|     'nid': 67,
996|     'name': 'Soma Cube Shape #7',
997|     'rotate': 0,
998|     'angles': (0,0,0),
999|     'translate': 0,
1000|     'offset': (0, 0, 0),
1001|     'facedefs': [
1002|         ('a','b','d','c'),('f','g','j','i'),('h','i','l','k'), #top
1003|         ('m','n','q','p'),('n','o','r','q'),('p','q','t','s'), #bot
1004|         ('d','c','h','i'),('l','k','s','t'),('j','i','q','r'), #south
1005|         ('b','a','e','f'),('f','e','m','n'),('g','f','n','o'), #north
1006|         ('c','a','e','h'),('h','e','m','p'),('k','h','p','s'), #west
1007|         ('d','b','f','i'),('j','g','o','r'),('l','i','q','t'), #east
1008|     ]
1009| }
1010| 
1011| Soma1 = cubenet(net_soma_1, net_soma_1_props)
1012| Soma2 = cubenet(net_soma_2, net_soma_2_props)
1013| Soma3 = cubenet(net_soma_3, net_soma_3_props)
1014| Soma4 = cubenet(net_soma_4, net_soma_4_props)
1015| Soma5 = cubenet(net_soma_5, net_soma_5_props)
1016| Soma6 = cubenet(net_soma_6, net_soma_6_props)
1017| Soma7 = cubenet(net_soma_7, net_soma_7_props)
1018| 
1019| 
1020| ####################################################################################################
1021| ## Tetris Shapes
1022| ##------------------------------------------------------------------------------------------------##
1023| net_tetris_1 = {
1024|     'a': (-2, +4, +2, ['b','d','j']), # top (top)
1025|     'b': ( 0, +4, +2, ['a','c','e','k']),
1026|     'c': (+2, +4, +2, ['b','f','l']),
1027|     'd': (-2, +2, +2, ['e','a','g','m']), # (top,mid)
1028|     'e': ( 0, +2, +2, ['d','f','b','h','n']),
1029|     'f': (+2, +2, +2, ['e','c','i','o']),
1030|     'g': (-2,  0, +2, ['h','d','p']), # (top,bot)
1031|     'h': ( 0,  0, +2, ['g','i','e','q']),
1032|     'i': (+2,  0, +2, ['h','f','r']),
1033|     'j': (-2, +4,  0, ['k','m','a']), # bottom
1034|     'k': ( 0, +4,  0, ['j','l','n','b']),
1035|     'l': (+2, +4,  0, ['k','o','c']),
1036|     'm': (-2, +2,  0, ['n','j','p','d']),
1037|     'n': ( 0, +2,  0, ['m','o','k','q','e']),
1038|     'o': (+2, +2,  0, ['n','l','r','f']),
1039|     'p': (-2,  0,  0, ['q','m','g']), #
1040|     'q': ( 0,  0,  0, ['p','r','n','h']),
1041|     'r': (+2,  0,  0, ['q','o','i']),
1042| }
1043| net_tetris_2 = {
1044|     'a': (-2, +8, +2, ['b','c','k']), # top
1045|     'b': ( 0, +8, +2, ['a','d','l']),
1046|     'c': (-2, +6, +2, ['d','a','e','m']),
1047|     'd': ( 0, +6, +2, ['c','b','f','n']),
1048|     'e': (-2, +4, +2, ['f','c','g','o']),
1049|     'f': ( 0, +4, +2, ['e','d','h','p']),
1050|     'g': (-2, +2, +2, ['h','e','i','q']),
1051|     'h': ( 0, +2, +2, ['g','f','j','r']),
1052|     'i': (-2,  0, +2, ['j','g','s']),
1053|     'j': ( 0,  0, +2, ['i','h','t']),
1054|     'k': (-2, +8,  0, ['l','m','a']), # bottom
1055|     'l': ( 0, +8,  0, ['k','n','b']),
1056|     'm': (-2, +6,  0, ['n','k','o','c']),
1057|     'n': ( 0, +6,  0, ['m','l','p','d']),
1058|     'o': (-2, +4,  0, ['p','m','q','e']),
1059|     'p': ( 0, +4,  0, ['o','n','r','f']),
1060|     'q': (-2, +2,  0, ['r','o','s','g']),
1061|     'r': ( 0, +2,  0, ['q','p','t','h']),
1062|     's': (-2,  0,  0, ['t','q','i']),
1063|     't': ( 0,  0,  0, ['s','r','j']),
1064| }
1065| net_tetris_3 = {
1066|     'a': (-2, +6, +2, ['b','c','k']), # top
1067|     'b': ( 0, +6, +2, ['a','d','l']),
1068|     'c': (-2, +4, +2, ['d','a','e','m']),
1069|     'd': ( 0, +4, +2, ['c','b','f','n']),
1070|     'e': (-2, +2, +2, ['f','c','h','o']),
1071|     'f': ( 0, +2, +2, ['e','g','d','i','p']),
1072|     'g': (+2, +2, +2, ['f','j','q']),
1073|     'h': (-2,  0, +2, ['i','e','r']),
1074|     'i': ( 0,  0, +2, ['h','j','f','s']),
1075|     'j': (+2,  0, +2, ['i','g','t']),
1076|     'k': (-2, +6,  0, ['l','m','a']), # bottom
1077|     'l': ( 0, +6,  0, ['k','n','b']),
1078|     'm': (-2, +4,  0, ['n','k','o','c']),
1079|     'n': ( 0, +4,  0, ['m','l','p','d']),
1080|     'o': (-2, +2,  0, ['p','m','r','e']),
1081|     'p': ( 0, +2,  0, ['o','q','n','s','f']),
1082|     'q': (+2, +2,  0, ['p','t','g']),
1083|     'r': (-2,  0,  0, ['s','o','h']),
1084|     's': ( 0,  0,  0, ['r','t','p','i']),
1085|     't': (+2,  0,  0, ['s','q','j']),
1086| }
1087| net_tetris_4 = {
1088|     'a': (-2, +6, +2, ['b','c','k']), # top
1089|     'b': ( 0, +6, +2, ['a','d','l']),
1090|     'c': (-2, +4, +2, ['d','a','f','m']),
1091|     'd': ( 0, +4, +2, ['c','e','b','g','n']),
1092|     'e': (+2, +4, +2, ['d','h','o']),
1093|     'f': (-2, +2, +2, ['g','c','i','p']),
1094|     'g': ( 0, +2, +2, ['f','h','d','j','q']),
1095|     'h': (+2, +2, +2, ['g','e','r']),
1096|     'i': (-2,  0, +2, ['j','f','s']),
1097|     'j': ( 0,  0, +2, ['i','g','t']),
1098|     'k': (-2, +6,  0, ['l','m','a']), # top
1099|     'l': ( 0, +6,  0, ['k','n','b']),
1100|     'm': (-2, +4,  0, ['n','k','p','c']),
1101|     'n': ( 0, +4,  0, ['m','o','l','q','d']),
1102|     'o': (+2, +4,  0, ['n','r','e']),
1103|     'p': (-2, +2,  0, ['q','m','s','f']),
1104|     'q': ( 0, +2,  0, ['p','r','n','t','g']),
1105|     'r': (+2, +2,  0, ['q','o','h']),
1106|     's': (-2,  0,  0, ['t','p','i']),
1107|     't': ( 0,  0,  0, ['s','q','j']),
1108| }
1109| net_tetris_5 = {
1110|     'a': (-2, +6, +2, ['b','c','k']), # top
1111|     'b': ( 0, +6, +2, ['a','d','l']),
1112|     'c': (-2, +4, +2, ['d','a','f','m']),
1113|     'd': ( 0, +4, +2, ['c','e','b','g','n']),
1114|     'e': (+2, +4, +2, ['d','h','o']),
1115|     'f': (-2, +2, +2, ['g','c','p']),
1116|     'g': ( 0, +2, +2, ['f','h','d','i','q']),
1117|     'h': (+2, +2, +2, ['g','e','j','r']),
1118|     'i': ( 0,  0, +2, ['j','g','s']),
1119|     'j': (+2,  0, +2, ['i','h','t']),
1120|     'k': (-2, +6,  0, ['l','m','a']), # top
1121|     'l': ( 0, +6,  0, ['k','n','b']),
1122|     'm': (-2, +4,  0, ['n','k','p','c']),
1123|     'n': ( 0, +4,  0, ['m','o','l','q','d']),
1124|     'o': (+2, +4,  0, ['n','r','e']),
1125|     'p': (-2, +2,  0, ['q','m','f']),
1126|     'q': ( 0, +2,  0, ['p','r','n','s','g']),
1127|     'r': (+2, +2,  0, ['q','o','t','h']),
1128|     's': ( 0,  0,  0, ['t','q','i']),
1129|     't': (+2,  0,  0, ['s','r','j']),
1130| }
1131| net_tetris_1_props = {
1132|     'nid': 71,
1133|     'name': 'Tetris Shape #1',
1134|     'rotate': 0,
1135|     'angles': (0,0,0),
1136|     'translate': 0,
1137|     'offset': (0, 0, 0),
1138|     'facedefs': [
1139|         ('a','b','e','d'),('b','c','f','e'),('d','e','h','g'),('e','f','i','h'), #top
1140|         ('j','k','n','m'),('k','l','o','n'),('m','n','q','p'),('n','o','r','q'), #bot
1141|         ('g','h','q','p'),('h','i','r','q'),('a','b','k','j'),('b','c','l','k'), #s/n
1142|         ('f','c','l','o'),('i','f','o','r'),('d','a','j','m'),('g','d','m','p'), #e/w
1143|     ]
1144| }
1145| net_tetris_2_props = {
1146|     'nid': 72,
1147|     'name': 'Tetris Shape #2',
1148|     'rotate': 0,
1149|     'angles': (0,0,0),
1150|     'translate': 0,
1151|     'offset': (0, 0, 0),
1152|     'facedefs': [
1153|         ('a','b','d','c'),('c','d','f','e'),('e','f','h','g'),('g','h','j','i'), #top
1154|         ('k','l','n','m'),('m','n','p','o'),('o','p','r','q'),('q','r','t','s'), #bot
1155|         ('i','j','t','s'),('a','b','l','k'), # s/n
1156|         ('d','b','l','n'),('f','d','n','p'),('h','f','p','r'),('j','h','r','t'), #east
1157|         ('c','a','k','m'),('e','c','m','o'),('g','e','o','q'),('i','g','q','s'), #west
1158|     ]
1159| }
1160| net_tetris_3_props = {
1161|     'nid': 73,
1162|     'name': 'Tetris Shape #3',
1163|     'rotate': 0,
1164|     'angles': (0,0,0),
1165|     'translate': 0,
1166|     'offset': (0, 0, 0),
1167|     'facedefs': [
1168|         ('a','b','d','c'),('c','d','f','e'),('e','f','i','h'),('f','g','j','i'), #top
1169|         ('k','l','n','m'),('m','n','p','o'),('o','p','s','r'),('p','q','t','s'), #bot
1170|         ('h','i','s','r'),('i','j','t','s'),('a','b','l','k'),('f','g','q','p'), #s/n
1171|         ('d','b','l','n'),('f','d','n','p'),('j','g','q','t'), #east
1172|         ('c','a','k','m'),('e','c','m','o'),('h','e','o','r'), #west
1173|     ]
1174| }
1175| net_tetris_4_props = {
1176|     'nid': 74,
1177|     'name': 'Tetris Shape #4',
1178|     'rotate': 0,
1179|     'angles': (0,0,0),
1180|     'translate': 0,
1181|     'offset': (0, 0, 0),
1182|     'facedefs': [
1183|         ('a','b','d','c'),('c','d','g','f'),('d','e','h','g'),('f','g','j','i'), #top
1184|         ('k','l','n','m'),('m','n','q','p'),('n','o','r','q'),('p','q','t','s'), #bot
1185|         ('i','j','t','s'),('g','h','r','q'),('a','b','l','k'),('d','e','o','n'), #s/n
1186|         ('d','b','l','n'),('h','e','o','r'),('j','g','q','t'), #east
1187|         ('c','a','k','m'),('f','c','m','p'),('i','f','p','s'), #west
1188|     ]
1189| }
1190| net_tetris_5_props = {
1191|     'nid': 75,
1192|     'name': 'Tetris Shape #5',
1193|     'rotate': 0,
1194|     'angles': (0,0,0),
1195|     'translate': 0,
1196|     'offset': (0, 0, 0),
1197|     'facedefs': [
1198|         ('a','b','d','c'),('c','d','g','f'),('d','e','h','g'),('g','h','j','i'), #top
1199|         ('k','l','n','m'),('m','n','q','p'),('n','o','r','q'),('q','r','t','s'), #bot
1200|         ('b','a','k','l'),('e','d','n','o'),('g','f','p','q'),('j','i','s','t'), #n/s
1201|         ('d','b','l','n'),('h','e','o','r'),('j','h','r','t'), #east
1202|         ('c','a','k','m'),('f','c','m','p'),('i','g','q','s'), #west
1203|     ]
1204| }
1205| 
1206| Tetris1 = cubenet(net_tetris_1, net_tetris_1_props)
1207| Tetris2 = cubenet(net_tetris_2, net_tetris_2_props)
1208| Tetris3 = cubenet(net_tetris_3, net_tetris_3_props)
1209| Tetris4 = cubenet(net_tetris_4, net_tetris_4_props)
1210| Tetris5 = cubenet(net_tetris_5, net_tetris_5_props)
1211| 
1212| ####################################################################################################
1213| ## Matrix Operation Demo
1214| ##------------------------------------------------------------------------------------------------##
1215| net_matrix_demo = {
1216|     'O' : ( 0, 0, 0, ['X','Y','Z']),
1217|     'X' : ( 2, 0, 0, ['O','Xy','Xz']),
1218|     'Y' : ( 0, 2, 0, ['O','Yx','Yz']),
1219|     'Z' : ( 0, 0, 2, ['O','Zx','Zy']),
1220|     'Xy': ( 2.0, 1.5, 0.0, ['X']),
1221|     'Yx': ( 0.0, 2.0, 1.5, ['Y']),
1222|     'Zx': ( 1.5, 0.0, 2.0, ['Z']),
1223|     'Xz': ( 2.0, 0.0, 1.0, ['X']),
1224|     'Yz': ( 1.0, 2.0, 0.0, ['Y']),
1225|     'Zy': ( 0.0, 1.0, 2.0, ['Z']),
1226| }
1227| net_matrix_demo_props = {
1228|     'nid': 99,
1229|     'name': 'Matrix Demo',
1230|     'swing': 360.0,
1231|     'rotate': 0,
1232|     'translate': 0,
1233|     'offset': (0, 0, 0),
1234|     'angles': (0,0,0),
1235| }
1236| rot_matrix_demo = {
1237|     'Xy':{'pivot':'X', 'matrix':RotXpos},
1238|     'Xz':{'pivot':'X', 'matrix':RotXneg},
1239|     'Yx':{'pivot':'Y', 'matrix':RotYpos},
1240|     'Yz':{'pivot':'Y', 'matrix':RotYneg},
1241|     'Zx':{'pivot':'Z', 'matrix':RotZpos},
1242|     'Zy':{'pivot':'Z', 'matrix':RotZneg},
1243| }
1244| MatrixDemo = cubenet(net_matrix_demo, net_matrix_demo_props)
1245| 
1246| 
1247| ####################################################################################################
1248| '''A dictionary of all Cube Nets.'''
1249| CubeNets = {
1250|     0: CN0, 1:CN1, 2:CN2, 3:CN3, 4:CN4, 5:CN5, 6:CN6, 7:CN7, 8:CN8, 9:CN9, 10:CN10, 11:CN11,
1251| 
1252|     Tesseract('nid'): Tesseract,
1253|     Tesscross('nid'): Tesscross,
1254| 
1255|     Soma1('nid'): Soma1,
1256|     Soma2('nid'): Soma2,
1257|     Soma3('nid'): Soma3,
1258|     Soma4('nid'): Soma4,
1259|     Soma5('nid'): Soma5,
1260|     Soma6('nid'): Soma6,
1261|     Soma7('nid'): Soma7,
1262| 
1263|     Tetris1('nid'): Tetris1,
1264|     Tetris2('nid'): Tetris2,
1265|     Tetris3('nid'): Tetris3,
1266|     Tetris4('nid'): Tetris4,
1267|     Tetris5('nid'): Tetris5,
1268| 
1269|     MatrixDemo('nid'): MatrixDemo,
1270| }
1271| 
1272| ##================================================================================================##
1273| def parse_face_string (s_in):
1274|     '''Cube Net faces helper. s_in=" abcd, efgh, pqrs," as required.'''
1275|     cmap = {ord(' '):None, ord('\t'):None, ord('\n'):None, ord('-'):None, ord('.'):','}
1276|     out = []
1277|     for corners in s_in.translate(cmap).split(','):
1278|         cs = list(corners)
1279|         if 0 < len(cs):
1280|             out.append("('%s','%s','%s','%s')," % (*cs,))
1281| 
1282|     return '\n'.join(out)
1283| 
1284| 
1285| ####################################################################################################
1286| """eof"""
1287|