From 80b471cefb5bfb17969b1a22412527ba25ce0b62 Mon Sep 17 00:00:00 2001 From: Pat Wick Date: Sun, 23 Jul 2023 12:46:12 -0400 Subject: [PATCH] Added two shift variables to increase readability The halfShift and fullShift variables are based on the original face ellipse shape. They are the major and minor axis chord lengths of the two different arcs. The fullShift only gets used in positioning the lower half of the face, everything else is shifted left/right so works off of the halfShift since it aligns with the minor axis of the top part of the dog's face, which is the x-direction --- drawing.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drawing.py b/drawing.py index fb0a908..e83a5c2 100644 --- a/drawing.py +++ b/drawing.py @@ -84,28 +84,32 @@ hideturtle() faceLength = 200 +# these shifts are based on the short and long chord-lengths of the original face ellipse +halfShift = 2*(faceLength/2)*math.sin(math.pi/4) +fullShift = 2*(faceLength)*math.sin(math.pi/4) + right(20) -goto(2*(faceLength/2)*math.sin(math.pi/4)*0.5,0) +goto(halfShift*0.5,0) ear(-faceLength,'sienna') -goto(-2*(faceLength/2)*math.sin(math.pi/4)*0.5,0) +goto(-halfShift*0.5,0) right(140) ear(faceLength,'sienna') -goto(-2*(faceLength/2)*math.sin(math.pi/4)*0.5,0) +goto(-halfShift*0.5,0) setheading(-135) face(faceLength,'white') -goto(-2*(faceLength/2)*math.sin(math.pi/4),-2*(faceLength)*math.sin(math.pi/4)*1.25) +goto(-halfShift,-fullShift*1.25) setheading(-45) face(faceLength,'sienna') setheading(0) -goto(-2*(faceLength/2)*math.sin(math.pi/4)*0.4,-faceLength/2) +goto(-halfShift*0.4,-faceLength/2) eye(faceLength/12,'black') -goto(2*(faceLength/2)*math.sin(math.pi/4)*0.4,-faceLength/2) +goto(halfShift*0.4,-faceLength/2) eye(faceLength/12,'black') -goto(faceLength/12,-2*(faceLength/2)*math.sin(math.pi/4)*1.25) +goto(faceLength/12,-halfShift*1.25) nose(faceLength/6) done()