-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForTesting_S3P1.m
More file actions
151 lines (90 loc) · 2.58 KB
/
ForTesting_S3P1.m
File metadata and controls
151 lines (90 loc) · 2.58 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
[ny, nx] = size(bcan);
test = zeros(ny, nx);
xi = repmat(nx:-1:1, ny, 1);
yi = repmat((ny:-1:1)', 1, nx);
ycan = max(yi .* bcan);
xcan = max(xi .* bcan);
m = tand(-thetta);
thetta_inc = 40.8;
L1x = 1225; L1y = 1;
L2x = nx - 1317; L2y = 36;
mL2 = tand(40.8);
bL2 = L2y - mL2 * L2x;
yL2 = mL2 * (nx:-1:1) + bL2;
%%%%%%%%% SEGMENTO INCLINADO
for j = 1:nx
for i = 1:ny
if yi(i, j) > yL2(j) %&& xi(i, j) > xL2(j)
test(i, j) = thetta_inc;
% else
%
% test(i, j) = thetta(j);
end
end
end
%%%%%%%%%%% SEGMENTO CURVO
centerx = L1x - 1;
centery = find(test(:, centerx) ~= 0, 1, 'last');
ncx = length(centerx:1317);
ncy = length(centery:802);
SC = zeros(ncy, ncx);
xc = repmat(0:1:ncx, ncy + 1, 1);
yc = repmat((0:1:ncy)', 1, ncx + 1);
[thettac, rho] = cart2pol(yc, xc);
thettac = mod(thettac, 2 * pi()) * 360 / (2 * pi());
thettac(thettac > thetta_inc) = 0;
test(centery:802, centerx:1317) = test(centery:802, centerx:1317) + thettac(1:end - 1, 1:end - 1);
for i = L1x:1358
pf = find(test(:, i) == 0, 1);
pl = find(test(:, i) == 0, 1, 'last');
if isempty(pf)
else
x = [pf - 1; pl + 1];
y = [test(pf - 1, i); test(pl + 1, i)];
xq = pf - 1: pl + 1;
test(pf - 1: pl + 1, i) = interp1(x,y,xq);
end
end
for i = 766:802
pf = find(test(i, 1317:end) == 0, 1);
pl = find(test(i, 1317:end) == 0, 1, 'last');
if isempty(pf)
else
x = [1316 + pf - 1; 1316 + pl + 1];
y = [test(i, 1316 + pf - 1); test(i, 1316 + pl + 1)];
xq = 1316 + pf - 1: 1316 + pl + 1;
test(i, 1316 + pf - 1: 1316 + pl + 1) = interp1(x, y, xq);
end
end
curva = test;
for j = 1:nx
for i = 1:ny
if yi(i, j) > yL2(j) %&& xi(i, j) > xL2(j)
curva(i, j) = 0;
% else
%
% test(i, j) = thetta(j);
end
end
end
% for j = 1225:1317
%
% m = tand(thetta(j));
%
% b = ycan(j) - m * xcan(j);
%
% y = m * xcan(j) + b;
%
% for i = 687:ny
%
% if yi(i, j) > yL2(j)
%
% test(i, j) = 40.8;
%
% elseif yi(i, j) >= y
%
% test(i, j) = thetta(j);
%
% end
% end
% end