-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.py
More file actions
89 lines (77 loc) · 2.78 KB
/
pattern.py
File metadata and controls
89 lines (77 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
'''
reset() - Erase all of the patterns and start over
setup()
Configure turtle to draw quickly
Configure turtle to have a window of 1000 x 800
drawRectanglePattern()
Use appropriate parameters
See additional information below
It should call drawRectangle()
drawRectangle()
Use appropriate parameters
Should draw a SINGLE rectangle
drawCirclePattern()
Use appropriate parameters
See additional information below
drawSuperPattern()
Use appropriate parameters
Randomly draw Rectangle and Circle patterns. Each pattern should based on random values.
Use reasonable random values (some can be negative) so patterns are drawn on the screen
setRandomColor()
Do not use any parameters
Set turtle to draw in a random color
Use at least 4 colors
done()
Called when user quits
Keeps the turtle window open
Make sure to read the rubric to see the additional requirements.
Drawing Rectangle Pattern
The Rectangle Pattern has 6 parts to it
Center position - This is the x, y center point of the circular pattern that is drawn
Offset - This is the distance from the center position to the starting corner of each rectangle. It can be a positive or negative number
Height - The height of a rectangle
Width - The width of a rectangle
Count - The number of rectangles to draw within the 360 degree pattern.
Rotation - The number of degrees each rectangle is rotated in relation to the line from the Center Position to the starting corner of the rectangle
Each individual rectangle should be a new random color. You should use at least 4 different colors.
Drawing Circle Pattern
The Circle Pattern has 4 parts to it
Center position - This is the x, y center point of the circular pattern that is drawn
Offset - This is the distance from the center position to starting drawing point of each circle. It can be a positive or negative number. Note that the center point of each circle should be 'radius + offset' distance from the Center Position of the pattern.
Radius - The radius of the circle
Count - The number of circles to draw within the 360 degree pattern.
Each individual circle should be a new random color. You should use at least 4 different colors.
'''
import turtle as t
import math
def reset():
pass
def setup():
pass
def drawRectanglePattern(x,y,o,w,h,c,r):
t.speed(100)
th = 360/c
for i in range(0,c):
offsetx = math.cos(math.radians(th*(i)))*o
offsety = math.sin(math.radians(th*(i)))*o
t.penup()
t.goto(x+(offsetx),y+(offsety))
t.pendown()
drawRectangle(w,h,r)
pass
def drawRectangle(w,h,r):
t.forward(w)
t.left(90)
t.forward(h)
t.left(90)
t.forward(w)
t.left(90)
t.forward(h)
t.left(90)
def drawCirclePattern():
pass
def drawCircle():
pass
def drawSuperPattern():
pass
drawRectanglePattern(50,50,100,30,40,100,30)