aboutsummaryrefslogtreecommitdiff
path: root/billiard3d.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--billiard3d.py48
1 files changed, 27 insertions, 21 deletions
diff --git a/billiard3d.py b/billiard3d.py
index 904d094..806ae28 100644
--- a/billiard3d.py
+++ b/billiard3d.py
@@ -54,11 +54,7 @@ def is_double(path):
54 54
55 return False 55 return False
56 56
57def print_multiplicities(n, sizes, r): 57def get_multiplicities(n, sizes, r):
58 print("")
59 print("Points with multiplicity > 1:")
60 print("")
61
62 d = dict() 58 d = dict()
63 path = [tuple(x) for x in get_path(n, sizes, r)] 59 path = [tuple(x) for x in get_path(n, sizes, r)]
64 60
@@ -72,6 +68,15 @@ def print_multiplicities(n, sizes, r):
72 for p in d: 68 for p in d:
73 d[p] //= 2 69 d[p] //= 2
74 70
71 return d
72
73def print_multiplicities(n, sizes, r):
74 d = get_multiplicities(n, sizes, r)
75
76 print("")
77 print("Points with multiplicity > 1:")
78 print("")
79
75 for i in range(2, max(d.values())+1): 80 for i in range(2, max(d.values())+1):
76 L = [] 81 L = []
77 for point in d: 82 for point in d:
@@ -259,21 +264,22 @@ def user_input():
259# Main routine below 264# Main routine below
260############################################################################### 265###############################################################################
261 266
262# You can choose to write your input here or to get it interactively 267if __name__ == '__main__':
263#sizes, r, pic = [15, 9, 7], [2, 0, 0], "p" 268 # You can choose to write your input here or to get it interactively
264#sizes, r, pic = [2, 3, 4], [0, 0, 0], "3" 269 #sizes, r, pic = [15, 9, 7], [2, 0, 0], "p"
265sizes, r, pic = user_input() 270 #sizes, r, pic = [2, 3, 4], [0, 0, 0], "3"
271 sizes, r, pic = user_input()
266 272
267print("---------------------------------") 273 print("---------------------------------")
268print_multiplicities(len(sizes), sizes, r) 274 print_multiplicities(len(sizes), sizes, r)
269print("---------------------------------") 275 print("---------------------------------")
270print_points_on_edges(sizes, r) 276 print_points_on_edges(sizes, r)
271print("---------------------------------") 277 print("---------------------------------")
272 278
273if pic == "p": 279 if pic == "p":
274 draw_3d_projections(sizes, r) 280 draw_3d_projections(sizes, r)
275elif pic == "3": 281 elif pic == "3":
276 draw_3d_picture(sizes, r) 282 draw_3d_picture(sizes, r)
277else: 283 else:
278 draw_3d_projections(sizes, r) 284 draw_3d_projections(sizes, r)
279 draw_3d_picture(sizes, r) 285 draw_3d_picture(sizes, r)

Generated with cgit - Back to sebastiano.tronto.net