-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrawRoute.m
30 lines (26 loc) · 1 KB
/
drawRoute.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function drawRoute(method,startnode,endnode,exnodelocation,exnodIndex,exunedges,rt,Cost)
% draw graph nodes and selected way.
ns=size(exnodelocation,1);
map_definition();
hold on;
title([ method ' Cost:' num2str(Cost)]);
sn=exnodIndex(startnode);
en=exnodIndex(endnode);
plot(exnodelocation(1:ns,1),exnodelocation(1:ns,2),'b*');
plot(exnodelocation(sn,1),exnodelocation(sn,2),'rx','markersize',10);
plot(exnodelocation(en,1),exnodelocation(en,2),'rx','markersize',10);
for i=1:2:size(exunedges,1)
x1=exnodelocation(exunedges(i,1),1);
x2=exnodelocation(exunedges(i,2),1);
y1=exnodelocation(exunedges(i,1),2);
y2=exnodelocation(exunedges(i,2),2);
line([x1;x2],[y1;y2],'linewidth',0.1);
end
for i=1:length(rt)-1
x1=exnodelocation(exnodIndex(rt(i)),1);
x2=exnodelocation(exnodIndex(rt(i+1)),1);
y1=exnodelocation(exnodIndex(rt(i)),2);
y2=exnodelocation(exnodIndex(rt(i+1)),2);
line([x1;x2],[y1;y2],'color','r','linewidth',2);
end
hold off