Home > src > BN_pol_rec > functions > getFieldCandiadte.m

getFieldCandiadte

PURPOSE ^

------------------------

SYNOPSIS ^

function [newNode,cost_this, roadNo, pxNo, markedNodes] = getFieldCandiadte(roadPoints, positionRoad_no, nodeToExpand, costMap, markedNodes, oponent_pos)

DESCRIPTION ^

------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 
0003 function  [newNode,cost_this, roadNo, pxNo, markedNodes] = getFieldCandiadte(roadPoints, positionRoad_no, nodeToExpand, costMap, markedNodes, oponent_pos)
0004 
0005 %------------------------
0006 
0007 %--------------040209 RS-------------------------------------------
0008 %Roads = contains all roadpoints
0009 %point = pixel on the map, n
0010 %markedRoad = all pixles that are already used for candiadates
0011 %nodeList = contains all crossing points
0012 %candidateList = returns list of neighbour points that are road points
0013 %---------------------------------------------------------------------
0014 
0015 markedNodes(nodeToExpand(1),nodeToExpand(2)) = 1;
0016 c = 0;
0017 cost_this = 1000;
0018 candidateList = [];
0019 newNode = [];%byt namn
0020 roadNo = 0;
0021 pxNo = [];
0022 sx = nodeToExpand(1) - 1;
0023 sy = nodeToExpand(2) - 1;
0024 x = sx;
0025 y = sy;
0026 for i = 1:3
0027  for j= 1:3
0028   if inMatrix(costMap, x, y)
0029     if (oponent_pos(1) == x)&&(oponent_pos(2) == y)
0030         c = nodeToExpand(3) + costMap(x,y);
0031         pxNo = [oponent_pos(1,1:2) c];
0032         roadNo = 10000;
0033         newNode = [ x y c];
0034         cost_this = c; 
0035         return;
0036     end;
0037     if (markedNodes(x,y) == 0)
0038        c = nodeToExpand(3) + costMap(x,y);
0039        newNode = [newNode; x y c];
0040        markedNodes(x,y) = 1;
0041        if (roadPoints(x,y) == 1)
0042            [roadNo, pxNo] = findRoadPix(x,y,positionRoad_no);
0043            if (roadNo == 0)
0044                disp('ERROR ROAD NOT FOUND')
0045                 %  x,y,positionRoad_no
0046            else
0047                   pxNo = [pxNo(1) pxNo(2) c];
0048                   cost_this = c; 
0049            end;
0050            return;
0051        end;
0052         markedNodes =  markedNodes;
0053     end;
0054   end;
0055     y = y + 1;
0056 end;
0057     x = x + 1;
0058     y = sy;
0059 end;
0060 
0061 
0062

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