-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.m
29 lines (23 loc) · 849 Bytes
/
test1.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
% In this example after converting the occupancy grid map of
% a continuous non-convex environment into a discretize grid graph
% 5 points are set as the sites or the center of Voronoi Diagram
% filename, name of the input image
% drate, the rate of iscritization or tiling
% showflag, it will show the output image if it is set to 1
close all;
clear all;
clc;
% initializing parameters
filename='testmap_883_556.png';
drate = 21;
showflag=1;
% create the grid graph
G=CreateGridGraph(filename,drate,showflag);
% get the source and destination nodes from inputs, 4 points in this example
if (~showflag)
imshow(G.mapshow);
end
[p1,p2] = ginput(5);
%convert real position on the map to the corresponding graph node index
points=ConvertPos2Point(G,p1,p2);
[dmap mapindx]=CreateVoronoi(G,points,showflag);