Home > src > PF > getRandomParticleData.m

getRandomParticleData

PURPOSE ^

rs: returns three random particles of each platoon

SYNOPSIS ^

function [vi_pos, pos_new, fi_vec] = getRandomParticleData(own_forceNo, currEnemy)

DESCRIPTION ^

 rs: returns three random particles of each platoon 
 050111 - commented trace printout

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function  [vi_pos, pos_new, fi_vec] = getRandomParticleData(own_forceNo, currEnemy)
0002 % rs: returns three random particles of each platoon
0003 % 050111 - commented trace printout
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)); % take nine new copies
0010 vi_pos = struct_own_forces(own_forceNo).pos;
0011 %struct_enemy_comps(currEnemy).plt(1).particles
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;

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003