-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCreateModel.m
74 lines (59 loc) · 1.76 KB
/
CreateModel.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
%{
This model is generated by:
- Loading terrain map
- Creating threats as cylinders
- Creating start and finish points
- Setting ranges and limits
%}
function model=CreateModel()
H = imread('ChrismasTerrain2.tif'); % Get elevation data
H (H < 0) = 0;
MAPSIZE_X = size(H,2); % x index: columns of H
MAPSIZE_Y = size(H,1); % y index: rows of H
[X,Y] = meshgrid(1:MAPSIZE_X,1:MAPSIZE_Y); % Create all (x,y) points to plot
% Threats as cylinders
R1=70; % Radius
x1 = 200; y1 = 230; z1 = 250; % center
R2=70; % Radius
x2 = 600; y2 = 250; z2 = 250; % center
R3=70; % Radius
x3 = 450; y3 = 550; z3 = 250; % center
R4=50; % Radius
x4 = 700; y4 = 600; z4 = 250; % center
R5=60; % Radius
x5 = 200; y5 = 500; z5 = 250; % center
R6=60; % Radius
x6 = 500; y6 = 800; z6 = 250; % center
% R7=60; % Radius
% x7 = 200; y7 = 500; z7 = 250; % center
% Map limits
xmin= 1;
xmax= MAPSIZE_X;
ymin= 1;
ymax= MAPSIZE_Y;
zmin = 100;
zmax = 200;
% Start and end position
start_location = [50;50;150];
end_location = [800;800;170];
% Number of path nodes (not including the start position (start node))
n=10;
% Incorporate map and searching parameters to a model
model.start=start_location;
model.end=end_location;
model.n=n;
model.xmin=xmin;
model.xmax=xmax;
model.zmin=zmin;
model.ymin=ymin;
model.ymax=ymax;
model.zmax=zmax;
model.MAPSIZE_X = MAPSIZE_X;
model.MAPSIZE_Y = MAPSIZE_Y;
model.X = X;
model.Y = Y;
model.H = H;
model.threats = [x1 y1 z1 R1;x2 y2 z2 R2; x3 y3 z3 R3; x4 y4 z4 R4; x5 y5 z5 R5; ...
x6 y6 z6 R6];
PlotModel(model);
end