Created
March 19, 2017 17:23
-
-
Save max-kov/f58362341c2f6689912345ad967794ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
# change these values | |
points = 10000 | |
circles = 30.0 | |
radius = 200.0 | |
resolution = np.array([1000, 500]) | |
pygame.init() | |
window = pygame.display.set_mode(resolution) | |
points_per_circle = points / circles | |
angle_per_point = 2.0 / points_per_circle | |
radius_per_point = radius / points | |
offset = resolution / 2 | |
def get_coord_from_num(num): | |
return np.array([np.cos(np.pi * num * angle_per_point) * (radius_per_point * (points - num)), | |
np.sin(np.pi * num * angle_per_point) * (radius_per_point * (points - num))] + offset) | |
point_coords = np.array([get_coord_from_num(a) for a in range(points)]) | |
last_point = point_coords[0] | |
for point in point_coords: | |
pygame.draw.line(window, (255, 255, 255), last_point, point) | |
last_point = point | |
pygame.display.update() | |
while 1: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment