-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobot.py
More file actions
85 lines (71 loc) · 1.72 KB
/
Robot.py
File metadata and controls
85 lines (71 loc) · 1.72 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
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import numpy as np
from math import *
def draw():
glClearColor(1,1,1,1)
glClear(GL_COLOR_BUFFER_BIT)
glBegin(GL_POLYGON)
glColor(0, 0, 0)
for theta in np.arange(0, 2*pi, .01):
x = .5*sin(theta)
y = .5+.4*cos(theta)
glVertex(x,y)
glEnd()
glBegin(GL_POLYGON)
glColor(1,1,1)
for theta in np.arange(0, 2*pi, .01):
x = .4+.07*sin(theta)
y = .5+.07*cos(theta)
glVertex(x,y)
glEnd()
glBegin(GL_POLYGON)
glColor(1,1,1)
for theta in np.arange(0, 2*pi, .01):
x = -.06+.07*sin(theta)
y = .5+.07*cos(theta)
glVertex(x,y)
glEnd()
glBegin(GL_POLYGON)
glColor(0, 0, 0)
for theta in np.arange(0,2*pi,0.01):
x = 0.05*sin(theta) -0.17
y = 0.08*cos(theta) -0.4
glVertex2d(x, y)
glEnd()
glBegin(GL_POLYGON)
glColor(0, 0, 0)
for theta in np.arange(0,2*pi,0.01):
x = 0.05*sin(theta) +0.17
y = 0.08*cos(theta) -0.4
glVertex2d(x, y)
glEnd()
glBegin(GL_POLYGON)
glColor(0, 0, 0)
for theta in np.arange(0,2*pi,0.01):
x = 0.3*sin(theta)
y = 0.4*cos(theta)
glVertex2d(x, y)
glEnd()
glBegin(GL_POLYGON)
glColor(0, 0, 0)
for theta in np.arange(0,2*pi,0.01):
x = 0.2*sin(theta)
y = 0.3*cos(theta)
glVertex2d(x, y)
glEnd()
glBegin(GL_POLYGON)
glColor(1, 1, 1)
glVertex2d(.5,.3 )
glVertex2d(.5,-.3 )
glVertex2d(-.5,.3 )
glEnd()
#----
glFlush()
glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(600,600)
glutCreateWindow(b"hey")
glutDisplayFunc(draw)
glutMainLoop()