function obstID=checkEdge(xE,yE,Obst) %CHECKEDGE obstID=0; for i_obst=1:size(Obst,2), %determine lengths and angles [a,b,c,A,B,C]=cosinelaw([xE,Obst(1,i_obst)],[yE,Obst(2,i_obst)]); %determine shortest edge-obstacle distance if A>pi/2 || B>pi/2, %vertices-obstacle distance d=min(a,b); else %perpendicular distance d=perpDist([xE,Obst(1,i_obst)],[yE,Obst(2,i_obst)]); end %check minimal distance if d<=Obst(3,i_obst), obstID=i_obst; break; end end