From da2ba3566d04b051f2aeda0351affcfee083d703 Mon Sep 17 00:00:00 2001 From: Cory Dean Chung Date: Wed, 9 Aug 2023 18:13:29 -0400 Subject: [PATCH] Commit 2. I made a juggler and arranged the balls. This took far too much time to do. What I realized about my own work habits is not having strict due dates makes it easy for me to procrastinate... (In good news, I'm finished with my summer job, so I should be able to get back on track quickly.) I also don't consider myself a creative or artistic person, so it took a while to build any sort of momentum. Something I hadn't anticipated was having degrees() from math not work. I had imported the functions in the same way we had imported those from turtle, and I had previously used degrees() in another assignment, so I was surprised degrees() didn't behave as I thought it would. I'm not sure what the difference between from math import * and import math is, or what it means to say something like math.degrees, but I ended up doing the latter and got it to work. It's interesting to me to have all this documentation and information online while at the same time not knowing what's immediately useful or important to focus on, or even what I'm ready to understand and know yet. --- .DS_Store | Bin 6148 -> 6148 bytes __pycache__/helper_functions.cpython-311.pyc | Bin 2157 -> 8260 bytes drawing.py | 4 +- helper_functions.py | 150 ++++++++++++++++--- poetry.lock | 12 +- 5 files changed, 137 insertions(+), 29 deletions(-) diff --git a/.DS_Store b/.DS_Store index f31696f72677928a897c4d167df58a08d0fdb490..7d09a08f6709f5827f6b3b65cc8377a08872414d 100644 GIT binary patch delta 59 zcmZoMXffE}%%~{Lkin43ki$>_B#Rj08PXU^8S)sC8A=#38S;Uw;>iaXRVO<$7HxjU M$iudoo#QV*0J1y}g#Z8m delta 40 wcmZoMXffE}%s9D|v51?4p_n0+p@gB7p-ESMm5x*0cniZVsY zdnc$il$I(~lmuvi4wOdDlLDk}4L`OoeJarY13Z8zi~|T12#SDj0*t<-FP+^ZFMD_7 zQHq$M(L>EJfDM`PdSkj`80Qn{C1@I zoBD4D{JOTeTP_g+MWP$1Tl4_+h+d#xQ2;84KA=94zrjWPH6k_^;Wd6d!PmPWKW?~O za6RvY+D|!!;XQ`xr*P?o=M>VeUN%9k`|z&VaUW{TPmjTbrwubWc#rf^FQV%)^zhW^ z1-RY@52PU**Y^!~le2NzcilGb3%o0GFle4wjhIn814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#nlmGw# delta 958 zcmZWn%}X0W6rb75ZZ=8t(U__w$r80FX)i5>9*VTuTCEF zRox8BS1~t|$Ly&RW)b44e*Vc8{TJAKoTE@IFqwLo@(;lb^qKE%-_0~(sinUtq}XCj7uR{rG@HlNO+Ces4^2!g)OuRfo|bL0ih29n+x|={|4j< z^dzw@B|!FP&);@;%&UYgM#4K{qB#m4Xpd|; zxl4J9n=b(3PD`X&Z6!~61<(ip5Gg~;P(LSl2$q;N)(iQ#gYvXl((L5q{DY*0vnJ1d zEY{9(kjFh!&@?@3X!q?b(Gj>1MiY?iPp~SY6XGfjp8aTpxOS)ZrixPy;x65+gvz%o z%SR-7OrkXsZFqx~8|8)lg%%RUfDPX`Yx`BeVPOqa-t<&r1a;?)_#EpF|)P;VGT`klF TNyL5#xC1^P9&DlWV0-i*$dmTH 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]