Skip to content

Instantly share code, notes, and snippets.

@NicolaM94
Last active June 7, 2023 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicolaM94/c7031addaa3371dfc673ce988220a495 to your computer and use it in GitHub Desktop.
Save NicolaM94/c7031addaa3371dfc673ce988220a495 to your computer and use it in GitHub Desktop.
Draws all the points on the circle
# Draws all the points on a circle with an origin and a given radius
coordinates = {}
def drawCircumferencePoints (turtle :turtle.Turtle, radius :int,coordinates :dict, numberOfPoints :int=1000, penSize :int=1,penColor :str="black",writeLabel :bool=False):
turtle.pensize(penSize)
turtle.pencolor(penColor)
def singlePointDraw (angle):
turtle.up()
turtle.goto(
radius*math.sin(angle),
radius*math.cos(angle)
)
turtle.down()
turtle.dot()
angle = calculateAngle(numberOfPoints)
for i in range(numberOfPoints):
singlePointDraw(i*angle)
coordinates[i] = turtle.pos(),i*angle
if writeLabel:
turtle.write(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment