Home > src > BN_pol_rec > functions > findCompFormation.m

findCompFormation

PURPOSE ^

compFormation = [Lead, Compact, Spread, Very Spread] and

SYNOPSIS ^

function [compFormation] = findCompFormation(p1, p2, p3, v1, v2, v3);

DESCRIPTION ^

  compFormation = [Lead, Compact, Spread, Very Spread]  and
  sum(compFormation) = 1

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 function [compFormation] = findCompFormation(p1, p2, p3, v1, v2, v3);
0003 %  compFormation = [Lead, Compact, Spread, Very Spread]  and
0004 %  sum(compFormation) = 1
0005 
0006 compFormation = [0 0 0 0]';
0007 
0008 [SideX, SideY] = findSides(p1, p2, p3, v1, v2, v3);
0009 
0010 if SideX == 0
0011     SideX = 0.0001;
0012 end
0013 if SideY == 0
0014     SideY = 0.0001;
0015 end
0016 
0017 [projVec, lineAngle] = findProj(p1, p2, p3, v1, v2, v3);
0018 
0019 if ((SideX/SideY) > 10)||((SideX/SideY) < 0.1)
0020     % All are on   the line
0021     if (projVec >= 0)&&(projVec <= 30)
0022         compFormation(1) = 1;
0023     end;
0024 end
0025 
0026 if ((SideX > 20)&&(SideY > 20)&& (SideX <= 30)&&(SideY <= 30))
0027      compFormation(2) = 1;
0028 end;
0029 
0030 if ((SideX > 40)&&(SideY > 40)&& (SideX <= 60)&&(SideY < 60))
0031      compFormation(3) = 1;
0032 end;
0033 
0034 if sum(compFormation) ~= 1
0035     compFormation(4) = 1;
0036 else
0037     compFormation;
0038 end;

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