diff --git a/hex.py b/hex.py new file mode 100644 index 0000000..bc0ef9d --- /dev/null +++ b/hex.py @@ -0,0 +1,19 @@ +from math import cos, sin, radians + +h = int(input("Total hexagon height allowed: ")) +canvas_size = int(input("SVG size: ")) +move_by = abs(canvas_size - h) / 2 + +m = h // 2 +p = { + "x": 0, + "y": m +} + +print("\nPoints: ") +for _ in range(6): + print(f"{round(p['x'] + m + move_by)},{round(p['y'] + m + move_by)}", end=" ") + x, y = p["x"], p["y"] + p["x"] = round(x*cos(radians(60)) - y*sin(radians(60)), 5) + p["y"] = round(x*sin(radians(60)) + y*cos(radians(60)), 5) +print() \ No newline at end of file