-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDissectPlot.m
127 lines (96 loc) · 3.67 KB
/
DissectPlot.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
% Dissect Plot
% Last Edited 8/8/2021 by Lucien Peach
function [DissectPlot] = DissectPlot(n, ls, index, infostruct, val)
% Counter used for data structure indexing
count = 1;
% Identify color
black = [0, 0, 0];
blue = [0, 0, 1];
% Boundary coordinates
% Special case for initial scenario
if index == 5
% Store initial tube information to boundary matrix
boundary = [0, 0; ...
(n+1)*ls, 0; ...
(n+1)*ls, infostruct(index-1).lmaxnet + infostruct(index).lmax/2; ...
0, infostruct(index-1).lmaxnet + infostruct(index).lmax/2; ...
0, 0];
% Store to data structure and plot
DissectPlot(count).x = boundary(:, 1);
DissectPlot(count).y = boundary(:, 2);
DissectPlot(count).color = black;
plot(DissectPlot(count).x, DissectPlot(count).y, 'color', ...
DissectPlot(count).color)
% Increase counter
count = count + 1;
% Add overlap indicator line
overlap = [0, infostruct(index-1).lmaxnet + infostruct(index).lmax/2; ...
(n+1)*ls, infostruct(index-1).lmaxnet + infostruct(index).lmax/2];
% Store to structure and plot
DissectPlot(count).x = overlap(:, 1);
DissectPlot(count).y = overlap(:, 2);
DissectPlot(count).color = blue;
plot(DissectPlot(count).x, DissectPlot(count).y, 'color', ...
DissectPlot(count).color)
% Plot settings
set(gcf, 'color', 'w')
daspect([1, 1, 1])
axis off
elseif index ~=5 && index ~= val
% Address top and bottom height parameters for easy translation into
% the boundary matrix
bottomheight = infostruct(index-6).lmaxnet + infostruct(index-5).lmax/2 ...
- 0.02;
topheight = infostruct(index-1).lmaxnet + infostruct(index).lmax/2;
% Store subsequent tube information and boundary matrix
boundary = [0, bottomheight; ...
(n+1)*ls, bottomheight; ...
(n+1)*ls, topheight; ...
0, topheight; ...
0, bottomheight];
% Store to data structure and plot
DissectPlot(count).x = boundary(:, 1);
DissectPlot(count).y = boundary(:, 2);
DissectPlot(count).color = black;
plot(DissectPlot(count).x, DissectPlot(count).y, 'color', ...
DissectPlot(count).color)
% Increase counter
count = count + 1;
% Add overlap indicator line
overlap = [0, topheight; ...
(n+1)*ls, topheight];
% Store to structure and plot
DissectPlot(count).x = overlap(:, 1);
DissectPlot(count).y = overlap(:, 2);
DissectPlot(count).color = blue;
plot(DissectPlot(count).x, DissectPlot(count).y, 'color', ...
DissectPlot(count).color)
% Plot settings
set(gcf, 'color', 'w')
daspect([1, 1, 1])
axis off
else
% Address top and bottom height parameters for easy translation into
% the boundary matrix
bottomheight = infostruct(index-3).lmaxnet + infostruct(index-2).lmax/2 ...
- 0.02;
topheight = infostruct(index).lmaxnet;
% Store subsequent tube information and boundary matrix
boundary = [0, bottomheight; ...
(n+1)*ls, bottomheight; ...
(n+1)*ls, topheight; ...
0, topheight; ...
0, bottomheight];
% Store to data structure and plot
DissectPlot(count).x = boundary(:, 1);
DissectPlot(count).y = boundary(:, 2);
DissectPlot(count).color = black;
plot(DissectPlot(count).x, DissectPlot(count).y, 'color', ...
DissectPlot(count).color)
% Plot settings
set(gcf, 'color', 'w')
daspect([1, 1, 1])
axis off
hold on
end
end