-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrocket.py
117 lines (111 loc) · 2.78 KB
/
rocket.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# rocket.py
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
def rocket(x, x1, y1, z1, a1, y2, z2):
# Main top cone
glPushMatrix()
if x >= 5.5:
glTranslatef(z2, -z2, z2)
glRotatef(a1, 0, 1, 1)
glPushMatrix()
glTranslatef(0, 2.5, 0)
glColor3f(1, 0, 0)
glScalef(2.2, 1.5, 2.2)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPopMatrix()
# Satellite container
glPushMatrix()
if x >= 6.8:
glTranslatef(2, 0, 0)
glRotatef(x * 40, 0, 1, 0)
# satellite()
glPopMatrix()
glPushMatrix()
if x >= 5:
glTranslatef(0, y2, y2)
glRotatef(a1, 0, 1, 1)
glPushMatrix()
glColor3f(1, 1, 1)
glTranslatef(0, 0.0, 0)
glScalef(0.3, 4.3, 0.3)
glRotatef(90, 1, 0, 0)
glutSolidTorus(0.5, 1, 30, 30)
glPopMatrix()
glPushMatrix()
glTranslatef(0, -2.2, 0)
glColor3f(1, 0, 0)
glScalef(3, 1.5, 3)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPopMatrix()
# RightSide rocket
glPushMatrix()
glTranslatef(x1, -y1, z1)
glRotatef(a1, 0, 1, 1)
glPushMatrix()
glTranslatef(0.7, 1, 0)
glColor3f(1, 0, 0)
glScalef(1.5, 1, 1.5)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPushMatrix()
glTranslatef(0.7, -0.2, 0)
glColor3f(1, 1, 1)
glScalef(0.2, 6.5, 0.2)
glRotatef(90, 1, 0, 0)
glutSolidTorus(0.2, 1, 30, 30)
glPopMatrix()
glPushMatrix()
glTranslatef(0.7, -2.0, 0)
glColor3f(1, 0, 0)
glScalef(1.5, 1, 1.5)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPopMatrix()
# LeftSide rocket
glPushMatrix()
glTranslatef(-x1, -y1, -z1)
glRotatef(-a1, 0, 1, 1)
glPushMatrix()
glTranslatef(-0.7, 1, 0)
glColor3f(1, 0, 0)
glScalef(1.5, 1, 1.5)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPushMatrix()
glTranslatef(-0.7, -0.2, 0)
glColor3f(1, 1, 1)
glScalef(0.2, 6.5, 0.2)
glRotatef(90, 1, 0, 0)
glutSolidTorus(0.2, 1, 30, 30)
glPopMatrix()
glPushMatrix()
glTranslatef(-0.7, -2.0, 0)
glColor3f(1, 0, 0)
glScalef(1.5, 1, 1.5)
glRotatef(270, 1, 0, 0)
glutSolidCone(0.2, 1, 30, 30)
glPopMatrix()
glPopMatrix()
def stars():
for s1 in range(50, 1000, 4):
for s2 in range(-60, 60, 5):
glPushMatrix()
glBegin(GL_POINTS)
glVertex3f(s2 / 10.0, s1 / 10.0, 0)
glEnd()
glPopMatrix()
for s3 in range(52, 1000, 3):
for s4 in range(-62, 60, 3):
glPushMatrix()
glBegin(GL_POINTS)
glVertex3f(s4 / 10.0, s3 / 10.0, 0)
glEnd()
glPopMatrix()