Gravwell-Online/hex.py
2022-12-25 17:41:03 -06:00

19 lines
No EOL
466 B
Python

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()