Remove the edge connections in the adjacency matrix for any nodes that are inside the "keep out" area prior to running the shortest path algorithm:
A(in,:) = 0;
A(:,in) = 0;
Comment only
06 Nov 2014
matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Hi Joseph,
I am using the code below to define a grid and find the shortest point between two points. I am also defining a polygon as a keep out area. How can I change the cost of the paths inside the polygon so that the connection line goes around the keep out are?
I have Identified the points that are inside the polygon.
Please advice.
Thanks
Mohsen
clear all;close all;
[xgrid ygrid]= meshgrid (-5:0.5:5,-5:0.5:5);
ygrid(:,2:2:end)=ygrid(:,2:2:end)+0.25;
xx=xgrid(1:end);
yy=ygrid(1:end);
xy=[xx;yy]';
L = linspace(0,2.*pi,11); xv = 3*sin(L);yv = 3*cos(L);
plot(xv,yv,'g')
hold on
in = inpolygon(xx,yy,xv,yv);
plot(xy(find(in==1),1),xy(find(in==1),2),'om')
% xy(find(in==1),:)=-5;
n = size(xy,1); A = zeros(n); %xy = 10*rand(n,2)
tri = delaunay(xy(:,1),xy(:,2));
I = tri(:); J = tri(:,[2 3 1]); J = J(:);
IJ = I + n*(J-1); A(IJ) = 1 ;
[cost,path] = dijkstra(A,xy,3,437) ;
gplot(A,xy,'k.:'); hold on;
plot(xy(path,1),xy(path,2),'ro-','LineWidth',2)
% for k = 1:n, text(xy(k,1),xy(k,2),[' ' num2str(k)],'Color','k'); end
5
06 Nov 2014
matlab2tikz
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.
Hi!
In the new version it always adds:
every outer x axis line/.append style={white!15!black},
every x tick label/.append style={font=\color{white!15!black}}
to the TeX-Code (and also for the y-axis), even if I use
ax = gca;
ax.XColor = 'black';
ax.YColor = 'black';
ax.ZColor = 'black';
in the Matlab-Code.
Is there a way to change this? I dont't want grey axes and I dont't want to change that manually every time.
Comment only