__author__ Lenovo import math import numpy as np import matplotlib pyp

 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
__author__ = 'Lenovo'
import math
import numpy as np
import matplotlib.pyplot as plt
def makePath(alpha, v0, k, eps, xmax, ymax):
vx = v0*math.cos(alpha)
vy = v0*math.sin(alpha)
xcur = xmax*0.5
ycur = ymax*0.5
print "no"
# while vx**2 + vy**2 > eps:
# if alpha <= 90:
# if (xmax - xcur) * math.tan(alpha) > ymax:
# t1 = np.linspace(xcur, (ymax - ycur)/ np.tan(alpha), 100)
# plt.plot(t1, math.tan(alpha)*t1 + ycur)
# xcur = (ymax - ycur)/ np.tan(alpha)
# ycur = ymax
# alpha = 360. - alpha
# else:
# t1 = np.linspace(xcur, xmax, 100)
# plt.plot(t1, math.tan(alpha)*t1 + ycur)
# ycur = (xmax - xcur)* np.tan(alpha)
# xcur = xmax
# alpha = 180. - alpha
# elif alpha <= 180:
# t1 = np.linspace(0., xcur, 100)
# plt.plot(t1, math.tan(alpha)*t1)
# elif alpha <= 270:
# t1 = np.linspace(0., xcur, 100)
# plt.plot(t1, math.tan(alpha)*t1)
# else:
# t1 = np.linspace(xcur, xmax, 100)
# plt.plot(t1, math.tan(alpha)*t1)
# vx = vx*k
# vy = vy*k
# plt.show()
makePath(25, 15, 0.2, 0.1, 10, 20)
print "Hello"