Last active
April 5, 2021 20:16
-
-
Save nwjlyons/c96495bdcc3003207c74afc134504f4e to your computer and use it in GitHub Desktop.
Plot points along circumference using Trigonometry
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 math | |
radius = 20 | |
circumference_points_ratios = [(math.cos(degree), math.sin(degree)) for degree in range(360)] | |
circumference_points = [(x * radius, y * radius) for x, y in circumference_points_ratios] | |
circumference_points_ints = [(int(x), int(y)) for x, y in circumference_points] | |
for y in range(-30, 30): | |
for x in range(-30, 30): | |
if (x, y) in circumference_points_ints: | |
print("*", end="") | |
else: | |
print(" ", end="") | |
print() |
Author
nwjlyons
commented
Apr 5, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment