test - # Program to make snowflake and snowman! # Local...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
# Program to make snowflake and snowman! # Local graphics module. Must be in same folder as this # program (or both on Desktop) import ecs10graphics as gr # Math module that comes with Python import math def pointOnCircle(f, r): # f is fraction of the way around # r is radius # produces a point f way around circle c,r # Use the global variable "center". c = center a = (2*math.pi)*f + math.pi/2.0 x = c[0] + math.cos(a)*r y = c[1] + math.sin(a)*r return [x,y] def circleSegment(f1, f2, r1, r2): # f1 is first fraction, r1 first radius # f2 is second fraction, r2 second radius # draws a segment from point f1, r1 to point f2, r2 p1 = pointOnCircle(f1, r1) p2 = pointOnCircle(f2, r2) gr.line(p1[0], p1[1], p2[0], p2[1], lineWidth=3) def drawBothLines(frac,s1, s2, r1, r2): #circleSegment(frac+s1, frac+s2, r1, r2) #circleSegment(frac-s1, frac-s2, r1, r2) #call by: drawBothLines(frac, .05, .05, 100) p1= pointOnCircle(frac+s1, r1) p2= pointOnCircle(frac+s2, r2) gr.line(p1[0], p1[1], p2[0], p2[1], lineWidth=5)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2010 for the course ECS 40175 taught by Professor Amenta during the Fall '09 term at UC Davis.

Page1 / 2

test - # Program to make snowflake and snowman! # Local...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online