-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQuickReflect.py
More file actions
105 lines (80 loc) · 3.66 KB
/
QuickReflect.py
File metadata and controls
105 lines (80 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import copy
from UniversalClasses import System, AffinityRule, TransitionRule
def reflect_across_x(currentSystem):
global tempSystem
tempSystem = copy.deepcopy(currentSystem)
# Note: Since this is a reflection across the X-axis...
# then only vertical affinities and transitions change.
# Still have to reset tempSystem's dictionaries
tempSystem.clearVerticalAffinityDict()
tempSystem.clearHorizontalAffinityDict()
tempSystem.clearVerticalTransitionDict()
tempSystem.clearHorizontalTransitionDict()
# But only reset tempSystem's vertical lists
tempSystem.clearVerticalAffinityList()
tempSystem.clearVerticalTransitionList()
# Shallow copies of currentSystem's vertical lists
currentVAffinityList = currentSystem.returnVerticalAffinityList()
currentVTransitionList = currentSystem.returnVerticalTransitionList()
# Shallow copies of the tempSystem's vertical lists
tempVAffinityList = tempSystem.returnVerticalAffinityList()
tempVTransitionList = tempSystem.returnVerticalTransitionList()
# Reflect Vertical Affinities for tempSystem
for rule in currentVAffinityList:
label1 = rule.returnLabel1()
label2 = rule.returnLabel2()
dir = "v"
strength = rule.returnStr()
tempRule = AffinityRule(label2, label1, dir, strength)
tempVAffinityList.append(tempRule)
# Reflect Vertical Transitions for tempSystem
for rule in currentVTransitionList:
label1 = rule.returnLabel1()
label2 = rule.returnLabel2()
label1Final = rule.returnLabel1Final()
label2Final = rule.returnLabel2Final()
dir = "v"
tempRule = TransitionRule(
label2, label1, label2Final, label1Final, dir)
tempVTransitionList.append(tempRule)
# Translate tempSystem's lists into dictionaries
tempSystem.translateListsToDicts()
def reflect_across_y(currentSystem):
global tempSystem
tempSystem = copy.deepcopy(currentSystem)
# Note: Since this is a reflection across the Y-axis...
# then only horizontal affinities and transitions change.
# Still have to reset tempSystem's dictionaries
tempSystem.clearVerticalAffinityDict()
tempSystem.clearHorizontalAffinityDict()
tempSystem.clearVerticalTransitionDict()
tempSystem.clearHorizontalTransitionDict()
# But only reset tempSystem's horizontal lists
tempSystem.clearHorizontalAffinityList()
tempSystem.clearHorizontalTransitionList()
# Shallow copies of currentSystem's horizontal lists
currentHAffinityList = currentSystem.returnHorizontalAffinityList()
currentHTransitionList = currentSystem.returnHorizontalTransitionList()
# Shallow copies of the tempSystem's horizontal lists
tempHAffinityList = tempSystem.returnHorizontalAffinityList()
tempHTransitionList = tempSystem.returnHorizontalTransitionList()
# Reflect Horizontal Affinities for tempSystem
for rule in currentHAffinityList:
label1 = rule.returnLabel1()
label2 = rule.returnLabel2()
dir = "h"
strength = rule.returnStr()
tempRule = AffinityRule(label2, label1, dir, strength)
tempHAffinityList.append(tempRule)
# Reflect Horizontal Transitions for tempSystem
for rule in currentHTransitionList:
label1 = rule.returnLabel1()
label2 = rule.returnLabel2()
label1Final = rule.returnLabel1Final()
label2Final = rule.returnLabel2Final()
dir = "h"
tempRule = TransitionRule(
label2, label1, label2Final, label1Final, dir)
tempHTransitionList.append(tempRule)
# Translate tempSystem's lists into dictionaries
tempSystem.translateListsToDicts()