if len self st_list and self ex2 is None self st_list -2 r1 sqrt phi g

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
if len(self.st_list)>=2 and self.ex2 is None:
l = self.st_list[-2:]
r1 = sqrt(l[0][0]**2+l[0][1]**2)
phi = get_angle(l[0][0],l[0][1])
v = l[1][0]-l[0][0],l[1][1]-l[0][1]
Vr = - (l[0][0]*v[0] + l[0][1]*v[1]) / r1
Vt = - (l[0][0]*v[1]-l[0][1]*v[0])/r1
h = sqrt(r1*(Vt**2))
p = (h**2)/mu
V0 = sqrt(mu/p)
phi = atan(Vr/(V0*(Vt/V0-1)))
#phi += pi/2
e = abs(Vr/(sqrt(mu/p)*sin(phi)))
self.h2 = h
self.e2 = e