generated from mwc/problemset_typeface
I did P K and S
This commit is contained in:
142
typeface.py
142
typeface.py
@@ -12,6 +12,7 @@
|
||||
from turtle import *
|
||||
from math import sqrt
|
||||
|
||||
|
||||
def draw_letter_a(unit):
|
||||
pass
|
||||
|
||||
@@ -43,7 +44,38 @@ def draw_letter_j(unit):
|
||||
pass
|
||||
|
||||
def draw_letter_k(unit):
|
||||
pass
|
||||
|
||||
diagonal_45 = sqrt((unit*unit)+(unit*unit))
|
||||
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
pendown()
|
||||
forward(unit*8)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
left(135)
|
||||
forward(diagonal_45*3)
|
||||
right(45)
|
||||
forward(unit)
|
||||
right(135)
|
||||
forward(diagonal_45*4)
|
||||
left(90)
|
||||
forward(diagonal_45*4)
|
||||
right(135)
|
||||
forward(unit)
|
||||
right(45)
|
||||
forward(diagonal_45*3)
|
||||
left(135)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
penup()
|
||||
forward(unit*2)
|
||||
right(180)
|
||||
pendown()
|
||||
|
||||
def draw_letter_l(unit):
|
||||
pass
|
||||
@@ -58,7 +90,69 @@ def draw_letter_o(unit):
|
||||
pass
|
||||
|
||||
def draw_letter_p(unit):
|
||||
pass
|
||||
|
||||
diagonal_26 = (unit * sqrt(5/4))
|
||||
diagonal_45 = sqrt((unit*unit)+(unit*unit))
|
||||
|
||||
def corner_left():
|
||||
left(26.565)
|
||||
forward(diagonal_26)
|
||||
left(45-26.565)
|
||||
forward(diagonal_45/2)
|
||||
left(45-26.565)
|
||||
forward(diagonal_26)
|
||||
|
||||
penup()
|
||||
forward(unit*3)
|
||||
pendown()
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
corner_left()
|
||||
left(26.565)
|
||||
forward(unit)
|
||||
corner_left()
|
||||
left(26.565)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*8)
|
||||
|
||||
penup()
|
||||
#placing the interior hole
|
||||
left(90)
|
||||
#how far to the right do you want the interior hole of the P?
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
#how far up do we want the interior hole?
|
||||
forward(unit*4.5)
|
||||
|
||||
pendown()
|
||||
#Draw the interior hole
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*1)
|
||||
right(45)
|
||||
forward(diagonal_45/2)
|
||||
right(45)
|
||||
forward(unit)
|
||||
right(45)
|
||||
forward(diagonal_45/2)
|
||||
right(45)
|
||||
forward(unit*1)
|
||||
penup()
|
||||
forward(unit*4.5)
|
||||
left(90)
|
||||
forward(unit*4.5)
|
||||
left(90)
|
||||
pendown()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_q(unit):
|
||||
pass
|
||||
@@ -67,7 +161,49 @@ def draw_letter_r(unit):
|
||||
pass
|
||||
|
||||
def draw_letter_s(unit):
|
||||
pass
|
||||
|
||||
diagonal_26 = (unit * sqrt(5/4))
|
||||
diagonal_45 = sqrt((unit*unit)+(unit*unit))
|
||||
|
||||
def corner_left():
|
||||
left(26.565)
|
||||
forward(diagonal_26)
|
||||
left(45-26.565)
|
||||
forward(diagonal_45/2)
|
||||
left(45-26.565)
|
||||
forward(diagonal_26)
|
||||
|
||||
def corner_right():
|
||||
right(26.565)
|
||||
forward(diagonal_26)
|
||||
right(45-26.565)
|
||||
forward(diagonal_45/2)
|
||||
right(45-26.565)
|
||||
forward(diagonal_26)
|
||||
|
||||
def s_side():
|
||||
corner_left()
|
||||
left(26.565)
|
||||
corner_left()
|
||||
left(26.565)
|
||||
corner_right()
|
||||
right(26.565)
|
||||
corner_right()
|
||||
right(26.565)
|
||||
|
||||
penup()
|
||||
forward(unit*3)
|
||||
pendown()
|
||||
s_side()
|
||||
forward(unit)
|
||||
right(180)
|
||||
s_side()
|
||||
forward(unit)
|
||||
penup()
|
||||
forward(unit*3)
|
||||
right(180)
|
||||
pendown()
|
||||
|
||||
|
||||
def draw_letter_t(unit):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user