@@ -254,6 +254,13 @@ Create a demo state, using the 4 point kite model with a given height and time.
254254Returns a SysState instance.
255255"""
256256function demo_state_4p (P, height= 6.0 , time= 0.014 ; azimuth_north= - pi / 2 )
257+ function get_particle (particle, X, Y, Z)
258+ x, y, z = particle[1 ], particle[2 ], particle[3 ]
259+ push! (X, x)
260+ push! (Y, y)
261+ push! (Z, z)
262+ return SVector (x,y,z)
263+ end
257264 ss = SysState {P+4} ()
258265 a = 10
259266 turn_angle = azimuth_north+ pi / 2
@@ -266,22 +273,10 @@ function demo_state_4p(P, height=6.0, time=0.014; azimuth_north=-pi/2)
266273 pod_pos = [X[end ], Y[end ], Z[end ]]
267274 vec_c = [X[end - 2 ] - X[end - 1 ], Y[end - 2 ] - Y[end - 1 ], Z[end - 2 ] - Z[end - 1 ]]
268275 particles = get_particles (se (). height_k, se (). h_bridle, se (). width, se (). m_k, pod_pos, vec_c, v_app)[3 : end ]
269- local pos_B, pos_C, pos_D
270- for i in 1 : 4
271- particle= particles[i]
272- x, y, z = particle[1 ], particle[2 ], particle[3 ]
273-
274- if i== 2
275- pos_B = SVector (x,y,z)
276- elseif i== 3
277- pos_C = SVector (x,y,z)
278- elseif i== 4
279- pos_D = SVector (x,y,z)
280- end
281- push! (X, x)
282- push! (Y, y)
283- push! (Z, z)
284- end
276+ get_particle (particles[1 ], X, Y, Z)
277+ pos_B = get_particle (particles[2 ], X, Y, Z)
278+ pos_C = get_particle (particles[3 ], X, Y, Z)
279+ pos_D = get_particle (particles[4 ], X, Y, Z)
285280 ss. X .= X
286281 ss. Y .= Y
287282 ss. Z .= Z
0 commit comments