Compare commits

...

4 Commits

Author SHA1 Message Date
root
2ba77ec376 I made some more helper functions to make the code for each of the
letters be more concise.

When I was testing whether my helper funcions worked, it was helpful
to '#' out the lines I was trying to replace and test it, before
deleting the lines permanently. I am not sure if the draw_segment
function is that good, but I couldn't figure out how to use a loop
with having so many arguments in it. Also, the draw_segment function
isn't always the right length of what I need to draw, so sometimes I
have to put a lot of zeros.
2024-09-21 17:08:38 -04:00
root
a2a5571155 I made the ghosty skirt use a loop so that I could use it for the
different length and letters. I also finished C and D.

I had to make sure that I kept track of the coordinates so that I could
get back to the starting point. Eventually, I quit trying to
prioritize the look and I tried to stick to 90 or 180 degree arcs for
the circles so that I didn't have to use as many sqrt(3) fractions.
2024-09-21 02:23:53 -04:00
root
67f3e0cb61 I made B, and I made A less wide so that it matched, because B
looked weird being so wide, and also there is probably supposed to be
one unit left empty on either side of the letters for spacing.

I feel like there is probably a better way to manage this. I figured
that I would try to make B before fixing the loop thing with the
ghosty skirt, so that I could see what was annoying. B was a weirder
shape, so I had to make part of the skirt shrunken to match up with
the sides. Also, when I made A less wide, I had to change the width
of the skirt, but I didn't want to mess up B, so now I have two
different ghosty skirt functions, which seems unnecessary.

I figured out why my work didn't save for the few last assignments and
why my commit messages haven't been saving. I copied this^
one just in case it happened again. I started putting the '#' in
front of the things I've been typing sometimes because I thought we
should because it's just a message and not code but then I realized
that it doesn't look like I made any changes and then the git commit
aborts, and it doesn't finish the mwc submit either. -_-
2024-09-20 00:58:57 -04:00
root
801ba8edbf I finished the function for drawing the letter A.
I am frustrated that my commit messages keep failing to save and I have
to keep rewriting them.
First I wrote the function and it was very long. Then, I made functions
for the eyes and ghosty skirt, since I will use them in other letters.
I feel like I should use loops but I don't want to mess up my letter.
I tried one way, and it didn't work, so I think I will try for the
letter B and then go back and change A as needed.
2024-09-19 23:36:19 -04:00

View File

@@ -1,5 +1,5 @@
# typeface.py
# By Chris Proctor and _________
# By Chris Proctor and Stacy S
# Contains one function for each letter in the English alphabet.
# Each function should draw its letter at a scale of `unit`, and then
@@ -12,17 +12,110 @@
from turtle import *
from math import sqrt
def draw_master_ghostyskirt(unit, length):
for width in range(length):
circle(-unit/4, 180)
circle(unit/4, 180)
circle(-unit/4, 180)
def draw_segment(turn1, d1, rad1, deg1, turn2, d2, rad2, deg2, turn3, d3):
right(turn1)
forward(d1)
circle(rad1, deg1)
right(turn2)
forward(d2)
circle(rad2, deg2)
right(turn3)
forward(d3)
def draw_eye(unit):
right(45)
fillcolor('black')
begin_fill()
draw_segment(0,0,unit/2,90, 0,0,unit/12,90,0,0)
draw_segment(0,0,unit/2,90, 0,0,unit/12,90,0,0)
end_fill()
left(45)
def fly_turn(dega, da, degb, db, degc):
penup()
right(dega)
forward(da)
right(degb)
forward(db)
right(degc)
pendown()
def draw_letter_a(unit):
pass
width(1)
# outline of A
fly_turn(0,unit,270,unit/4,0) #(1,1/4)
draw_segment(0, 19*unit/4,-3*unit,180,0,19*unit/4,0,0,0,0) #(7,1/4)
draw_master_ghostyskirt(unit,2) #(9/2,1/4)
draw_segment(0,2*unit,unit/2,180,0,2*unit,0,0,0,0) #(7/2,1/4)
draw_master_ghostyskirt(unit,2) #(1,1/4)
# face of A
fly_turn(0,15*unit/4,90,3*unit,0)
circle(unit, 450) #(5,5)
fly_turn(0,5*unit/4,0,0,0)
draw_eye(unit)
fly_turn(270,2*unit,0,0,0) #(3,25/4)
draw_eye(-unit)
# return to origin
fly_turn(0,3*unit,270,25*unit/4,270) #(0,0)
def draw_letter_b(unit):
pass
width(1)
# outline of B
fly_turn(0,unit,270,3*unit/4,0) #(1,1/4)
draw_segment(0,21*unit/4,-2*unit,90, 0,2*unit,-2*unit,180,0,0) #(5,4)
draw_segment(180,0,-2*unit,150, 300,(((7-4*sqrt(3)))/4)*unit,0,0,0,0) #(6,1/4)
draw_master_ghostyskirt(unit,4) #(3/2,1/4)
draw_segment(0,0,unit/4,90, 0,0,-unit/4,90,0,0) #(1,3/4)
# face of B
fly_turn(0,4*unit,90,3.5*unit,0)
draw_segment(0,0,unit,180,0,unit,unit,180, 0,unit)
fly_turn(90,3.5*unit,270,0,0)
draw_segment(0,0,unit,180,0,unit,unit,180, 0,unit) #(9/2,5/4)
fly_turn(270,11*unit/2,90,unit,270)
draw_eye(unit) #(5.5,6.75)
fly_turn(270,3*unit,0,0,0)
draw_eye(-unit) #(2.5,6.75)
# return to origin
fly_turn(0,2.5*unit,270,6.75*unit,270)
def draw_letter_c(unit):
pass
width(1)
# outline of C
fly_turn(0,unit,270,unit,0)
draw_segment(0,4*unit,-3*unit,90, 0,2*unit,-unit,180,0,0)
draw_segment(0,2*unit,unit,90,0,7*unit/4,unit,90,0,2*unit)
draw_segment(0,0,-unit,180, 270,0,0,0,0,0)
draw_master_ghostyskirt(unit,4)
draw_segment(0,0,unit/4,90,0,0,-unit/4,90,0,unit/4)
# face of C
fly_turn(0,5.5*unit,90,3*unit,270)
draw_eye(unit)
# return to origin
fly_turn(270,4*unit,270,6.5*unit,270)
def draw_letter_d(unit):
pass
width(1)
# outline of D
fly_turn(0,unit,270,unit,0)
draw_segment(0,6*unit,-unit,90,0,3*unit,-2*unit,90,0,3.75*unit)
draw_segment(0,0,-2*unit,90,270,0,0,0,0,0)
draw_master_ghostyskirt(unit, 3)
draw_segment(0,0,unit/4,90, 0,0,-unit/4,90,0,unit/4)
# face of D
fly_turn(0,2.5*unit,90,2*unit,90)
draw_segment(0,0,unit,180, 0,unit,unit,180,0,unit)
fly_turn(180,2*unit,0,0,0)
draw_eye(unit)
fly_turn(90,2*unit,270,0,0)
draw_eye(unit)
# return to origin
fly_turn(270,5*unit,270,5.5*unit,270)
def draw_letter_e(unit):
pass