generated from geometor/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
star.py
143 lines (103 loc) · 2.96 KB
/
star.py
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from geometor.utils import *
from geometor.model import *
from geometor.render import *
from geometor.pappus import *
from itertools import permutations
sp.init_printing()
BUILD = False
ANALYZE = True
GREEN = True
BLUE = True
PART1 = False
PART2 = False
PART3 = True
PART4 = False
if PART1:
print_log(f'\nPART1')
if PART2:
print_log('PART2')
if PART3:
print_log('PART3')
NAME = 'star-'
NAME += input(f'\nsession name: {NAME}')
log_init(NAME)
start_time = timer()
print_log(f'\nMODEL: {NAME}')
# add starting points
A, B = begin()
bisector(A, B)
Cw = pts[2]
Ce = pts[3]
Dn = pts[5]
Ds = pts[4]
O = pts[6]
add_element(circle(Ds, A))
add_element(circle(Dn, A))
add_element(circle(A, O))
add_element(circle(B, O))
add_element(circle(Ce, A))
add_element(circle(Cw, B))
if GREEN:
add_element(line(pts[11], pts[23], classes=['green']))
if BLUE:
add_element(line(Ds, pts[31], classes=['blue']))
# if RED:
if PART1:
if GREEN:
add_element(line(pts[16], pts[12], classes=['green']))
add_element(line(pts[7], pts[24], classes=['green']))
add_element(line(pts[8], pts[17], classes=['green']))
if BLUE:
add_element(line(Ds, pts[40], classes=['blue']))
add_element(line(Dn, pts[30], classes=['blue']))
add_element(line(Dn, pts[39], classes=['blue']))
Fnw = pts[42]
Fne = pts[35]
Fsw = pts[41]
Fse = pts[34]
add_element(line(Fnw, Fsw))
add_element(line(Fne, Fse))
add_element(circle(A, Ce))
add_element(circle(B, Cw))
add_element(line(pts[68], pts[80]))
model_summary(NAME, start_time)
# ANALYZE ***************************
if ANALYZE:
print_log(f'\nANALYZE: {NAME}')
goldens, groups = analyze_model()
analyze_summary(NAME, start_time, goldens, groups)
# PLOT *********************************
print_log(f'\nPLOT: {NAME}')
limx, limy = get_limits_from_points(pts, margin=.25)
limx, limy = adjust_lims(limx, limy)
bounds = set_bounds(limx, limy)
print_log()
print_log(f'limx: {limx}')
print_log(f'limy: {limy}')
# plt.ion()
fig, (ax, ax_btm) = plt.subplots(2, 1, gridspec_kw={'height_ratios': [10, 1]})
ax_btm.axis('off')
ax.axis('off')
ax.set_aspect('equal')
plt.tight_layout()
title = f'G E O M E T O R'
fig.suptitle(title, fontdict={'color': '#960', 'size':'small'})
print_log('\nPlot Summary')
xlabel = f'elements: {len(elements)} | points: {len(pts)}'
ax_prep(ax, ax_btm, bounds, xlabel)
plot_sequence(ax, history, bounds)
snapshot(NAME, 'sequences/summary.png')
if BUILD:
print_log('\nPlot Build')
build_sequence(NAME, ax, ax_btm, history, bounds)
if ANALYZE:
print_log('\nPlot Goldens')
bounds = get_bounds_from_sections(goldens)
plot_sections(NAME, ax, ax_btm, history, goldens, bounds)
print_log('\nPlot Golden Groups')
plot_all_groups(NAME, ax, ax_btm, history, groups, bounds)
plot_all_sections(NAME, ax, ax_btm, history, goldens, bounds)
complete_summary(NAME, start_time, goldens, groups)
else:
model_summary(NAME, start_time)
plt.show()