0001 function [vi_pos, pos_new, fi_vec] = getRandomParticleData(own_forceNo, currEnemy)
0002
0003
0004
0005 global struct_enemy_comps;
0006 global struct_own_forces;
0007 vi_pos = []; pos_new = []; fi_vec = [];
0008 n = length(struct_enemy_comps(currEnemy).plt(1).particles(:,1));
0009 chooseParticleRowIdx = ones(9,1) + round((n - 1).*rand(9,1));
0010 vi_pos = struct_own_forces(own_forceNo).pos;
0011
0012 for i = 1:3
0013 pos_new = [pos_new;struct_enemy_comps(currEnemy).plt(1).particles(chooseParticleRowIdx(i),1:2)];
0014 fi_vec = [fi_vec;[struct_enemy_comps(currEnemy).plt(1).particles(chooseParticleRowIdx(i),3)*cos(struct_enemy_comps(currEnemy).plt(1).particles(chooseParticleRowIdx(i),4)) struct_enemy_comps(currEnemy).plt(1).particles(chooseParticleRowIdx(i),3)*sin(struct_enemy_comps(currEnemy).plt(1).particles(chooseParticleRowIdx(i),4))]];
0015 end;
0016 for i = 4:6
0017 pos_new = [pos_new;struct_enemy_comps(currEnemy).plt(2).particles(chooseParticleRowIdx(i),1:2)];
0018 fi_vec = [fi_vec; [struct_enemy_comps(currEnemy).plt(2).particles(chooseParticleRowIdx(i),3)*cos(struct_enemy_comps(currEnemy).plt(2).particles(chooseParticleRowIdx(i),4)) struct_enemy_comps(currEnemy).plt(2).particles(chooseParticleRowIdx(i),3)*sin(struct_enemy_comps(currEnemy).plt(2).particles(chooseParticleRowIdx(i),4))]];
0019 end;
0020 for i = 7:9
0021 pos_new = [pos_new;struct_enemy_comps(currEnemy).plt(3).particles(chooseParticleRowIdx(i),1:2)];
0022 fi_vec = [fi_vec;[struct_enemy_comps(currEnemy).plt(3).particles(chooseParticleRowIdx(i),3)*cos(struct_enemy_comps(currEnemy).plt(3).particles(chooseParticleRowIdx(i),4)) struct_enemy_comps(currEnemy).plt(3).particles(chooseParticleRowIdx(i),3)*sin(struct_enemy_comps(currEnemy).plt(3).particles(chooseParticleRowIdx(i),4))]];
0023 end;
0024 vi_pos; pos_new; fi_vec;