diff --git a/.DS_Store b/.DS_Store index f31696f..7d09a08 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/__pycache__/helper_functions.cpython-311.pyc b/__pycache__/helper_functions.cpython-311.pyc index 82096fe..e105317 100644 Binary files a/__pycache__/helper_functions.cpython-311.pyc and b/__pycache__/helper_functions.cpython-311.pyc differ diff --git a/drawing.py b/drawing.py index 82fabf5..7048d23 100644 --- a/drawing.py +++ b/drawing.py @@ -2,11 +2,11 @@ # ---------- # By Cory # -# This program draws the upper body of a juggler juggling balls. +# This program draws the juggling upper body of a bald juggler. from helper_functions import * -HALF = 300 # Max x- and y-coordinate the turtle will go to. +HALF = 200 # Max x- and y-coordinate the turtle will go to. # Sets up a square region with max x-coordinate HALF and min -HALF startingPosition(HALF) diff --git a/helper_functions.py b/helper_functions.py index 3e15567..15fcc55 100644 --- a/helper_functions.py +++ b/helper_functions.py @@ -1,4 +1,4 @@ -from math import * +import math # degrees() from math wasn't working so I have this to do math.degrees() instead... from turtle import * from superturtle import * @@ -12,31 +12,139 @@ def startingPosition(HALF): left(90) forward(HALF) left(90) - pendown() def drawPerson(HALF): - pass + # Turtle starts and ends at starting position + drawBody(HALF) + drawHead(HALF) + drawFace(HALF) +def drawBody(HALF): + # Turtle starts at starting position + fillcolor("green") + begin_fill() + forward(HALF * 4 / 5.0) + pendown() + forward(HALF * 2 / 5.0) + left(90) + forward(HALF / 2.0) + right(180) + forward(HALF / 5.0) + left(90) + forward(HALF / 10.0) + left(45) + forward(HALF * math.sqrt(2) / 5.0) + left(135) + forward(HALF / 10.0) + left(45) + forward(HALF * math.sqrt(2) / 10.0) + right(135) + forward(HALF / 5.0) + left(90) + forward(HALF / 5.0) + left(45) + forward(HALF * math.sqrt(2) / 10.0) + right(90) + forward(HALF * math.sqrt(2) / 10.0) + left(45) + forward(HALF / 5.0) + left(90) + forward(HALF / 5.0) + right(135) + forward(HALF * math.sqrt(2) / 10.0) + left(45) + forward(HALF / 10.0) + left(135) + forward(HALF * math.sqrt(2) / 5.0) + left(45) + forward(HALF / 10.0) + left(90) + forward(HALF / 5.0) + left(180) + forward(HALF / 2.0) + penup() + end_fill() + + +def drawHead(HALF): + # Turtle starts from where drawBody ended + neckHeadAngle = math.degrees(math.acos(.35)) + fillcolor("bisque") + right(180) + forward(.6 * HALF) + right(90) + forward(.1 * HALF) + begin_fill() + pendown() + right(45) + forward(.1 * math.sqrt(2) * HALF) + left(90) + forward(.1 * math.sqrt(2) * HALF) + left(135) + forward(.05 * HALF) + right(90) + forward(.1 * HALF) + right(neckHeadAngle) + circle(HALF / 7.0, 180 + 2 * neckHeadAngle) + right(neckHeadAngle) + forward(.1 * HALF) + right(90) + forward(.05 * HALF) + penup() + end_fill() + +def drawFace(HALF): + # Turtle starts from where drawHead ended and returns to starting position + right(90) + forward(1.7 * HALF / 7.0) + right(90) + forward(.025 * HALF) + left(90) + pendown() + forward(.025 * HALF) + penup() + right(90) + forward(.15 * HALF) + right(90) + pendown() + forward(.025 * HALF) + penup() + forward(.05 * HALF) + pendown() + circle(-0.075 * HALF,180) + penup() + right(180) + forward(27 * HALF / 140.0) + right(90) + forward(37 * HALF / 40.0) + left(90) + forward(3 * HALF / 5.0) + print("C") + print(position()) + left(90) + +def drawJugglingCircle(HALF,OFFSET): + # Turtle starts and ends from starting position + # Draw 3 balls in a circle. The 3 balls are evenly spaced apart and the first ball starts at OFFSET degrees CCW from the starting position. + forward(.5 * HALF) + left(90) + forward(.5 * HALF) + right(150) + penup() + circle(math.sqrt(3) /3 * HALF,OFFSET) + for i in range(2): + pendown() + drawBall(HALF) + penup() + circle(math.sqrt(3) /3 * HALF,120) + pendown() + drawBall(HALF) + penup() + circle(math.sqrt(3) /3 * HALF,120-OFFSET) + def drawBall(HALF): # draw a filled circle fillcolor("blue") begin_fill() circle(HALF / 10.0) - end_fill() - -def drawJugglingCircle(HALF,OFFSET): - # Draw 3 balls in a circle. The 3 balls are evenly spaced apart and the first ball starts at OFFSET degrees CCW from the starting position. - right(60) - penup() - circle(2/3 * HALF,OFFSET) - for i in range(2): - pendown() - drawBall(HALF) - penup() - circle(2/3 * HALF,120) - input() - pendown() - drawBall(HALF) - penup() - circle(2/3 * HALF,120-OFFSET) - + end_fill() \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 596f7de..932b90b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -285,13 +285,13 @@ files = [ [[package]] name = "pygments" -version = "2.15.1" +version = "2.16.1" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, - {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, + {file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692"}, + {file = "Pygments-2.16.1.tar.gz", hash = "sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"}, ] [package.extras] @@ -342,13 +342,13 @@ files = [ [[package]] name = "sphinx" -version = "7.1.1" +version = "7.1.2" description = "Python documentation generator" optional = false python-versions = ">=3.8" files = [ - {file = "sphinx-7.1.1-py3-none-any.whl", hash = "sha256:4e6c5ea477afa0fb90815210fd1312012e1d7542589ab251ac9b53b7c0751bce"}, - {file = "sphinx-7.1.1.tar.gz", hash = "sha256:59b8e391f0768a96cd233e8300fe7f0a8dc2f64f83dc2a54336a9a84f428ff4e"}, + {file = "sphinx-7.1.2-py3-none-any.whl", hash = "sha256:d170a81825b2fcacb6dfd5a0d7f578a053e45d3f2b153fecc948c37344eb4cbe"}, + {file = "sphinx-7.1.2.tar.gz", hash = "sha256:780f4d32f1d7d1126576e0e5ecc19dc32ab76cd24e950228dcf7b1f6d3d9e22f"}, ] [package.dependencies]