Perform the path between two pixels in respect with a potential field (obstacles).
[Px,Py] = NL_V_PotentialFieldPath(X,Y,Xg,Yg,U)
X-coordinate of the starting pixel.
Y-coordinate of the starting pixel.
X-coordinate of the ending pixel.
Y-coordinate of the ending pixel.
Potential matrix.
X-coordinates of all pixels belonging to the path.
Y-coordinates of all pixels belonging to the path.
NL_V_PotentialFieldPath performs the path P defined by all pixels of coordinates between the two pixels [X,Y] and
in respect with the potential field U (see NL_V_PotentialField).
dt=getdate(); seed=dt(10); rand('seed',seed);//initialization of the random values generator no=4;//quantity of obstacles (rectangle) L=1000;//squared area side hm=100;//minimal height hM=250;//maximal height wm=100;//minimal width wM=250;//maximal width Al=[0 %pi/2 %pi -%pi/2];//available angles for obstacles [Xs,Ys,X,Y,H,W,A]=NL_V_RectanglesCorners(no,L,hm,hM,wm,wM);//generation of obstacles [P]=NL_V_PotentialRectangles(X,Y,H,W,A,L);//generation of obstacle matrix z=10;//zoom factor o=2;// 1=mean, 2=max, 3=min, 4=median Pz=NL_V_MRA(P,z,o);//scale modification [Pzx,Pzy]=size(Pz);//image size w1=1;//window index scf(w1); clf(w1); grayplot(1:Pzx,1:Pzy,Pz);//graph visualization xset("colormap",graycolormap(128)); mO=100000;//infinite value of obstacles [U]=NL_V_PotentialField(Pz,mO);//performance of the potential field x=2;//origine y=2; xg=Pzx-1;//destination:first diagonal yg=Pzy-1; [px,py]=NL_V_PotentialFieldPath(x,y,xg,yg,U)//application of NL_V_PotentialFieldPath PPl=Pz; for kk=1:length(px) PPl(px(kk),py(kk))=2; end w2=2; scf(w2); clf(w2); grayplot(1:Pzx,1:Pzy,PPl);//graph visualization xset("colormap",graycolormap(128)); | ![]() | ![]() |