-
Notifications
You must be signed in to change notification settings - Fork 13
/
CreateModel2.m
102 lines (75 loc) · 2.48 KB
/
CreateModel2.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function model=CreateModel2()
H = imread('ChrismasTerrain.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
% Map limits
xmin= 1;
xmax= MAPSIZE_X;
ymin= 1;
ymax= MAPSIZE_Y;
zmin = 100;
zmax = 200;
% Threats as cylinders
R1=30; % Radius
x1 = 400; y1 = 500; z1 = 100; % center
R2=35; % Radius
x2 = 600; y2 = 400; z2 = 150; % center
R3=35; % Radius
x3 = 430; y3 = 410; z3 = 150; % center
R4=40; % Radius
x4 = 300; y4 = 200; z4 = 150; % center
R5=50; % Radius
x5 = 650; y5 = 500; z5 = 150; % center
R6=30; % Radius
x6 = 750; y6 = 750; z6 = 150; % center
R7=25; % Radius
x7 = 200; y7 = 300; z7 = 150; % center
R8=40; % Radius
x8 = 300; y8 = 500; z8 = 150; % center
R9=50; % Radius
x9 = 550; y9 = 600; z9 = 150; % center
R10=35; % Radius
x10 = 650; y10 = 650; z10 = 150; % center
R11=30; % Radius
x11 = 500; y11 = 800; z11 = 150; % center
R12=45; % Radius
x12 = 800; y12 = 400; z12 = 150; % center
R13=40; % Radius
x13 = 900; y13 = 650; z13 = 150; % center
R14=35; % Radius
x14 = 800; y14 = 650; z14 = 150; % center
% Start and end position
start = [200,100,100];
start(3) = start(3) + H(round(start(2)),round(start(1)));
% goals = [[700,200,150];
% [900,500,150];
% [800,800,150];
% [500,700,150]];
%
% for i = 1:size(goals,1)
% goals(i,3) = goals(i,3) + H(round(goals(i,2)),round(goals(i,1)));
% end
goal = [800,850,150];
goal(3) = goal(3) + H(round(goal(2)),round(goal(1)));
% Incorporate map and searching parameters to a model
model.start = start;
model.goal = goal;
model.xmin=xmin;
model.xmax=xmax;
model.ymin=ymin;
model.ymax=ymax;
model.zmin=zmin;
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; x7 y7 z7 R7; x8 y8 z8 R8; x9 y9 z9 R9; ...
x10 y10 z10 R10; x11 y11 z11 R11; x12 y12 z12 R12; x13 y13 z13 R13; ...
x14 y14 z14 R14];
% PlotTopView(0,model)
end