...
 
Commits (2)
......@@ -9,7 +9,7 @@ endfunction
function d = dominates(peak1, peak2)
% Returns true, if peak1 dominates peak2, false otherwise.
% Uses the haversine formula to determine the spherical angle
% between the peaks. Recall the identity cos(hav⁻¹(θ)) = 1 - 2θ.
% between the peaks. Recall the identity cos(hav⁻¹(x)) = 1 - 2x.
% In vectorized code, one of the arguments can be an N x 3 matrix,
% the other must be a 1 x 3 vector.
R = 6371080;
......@@ -18,6 +18,12 @@ function d = dominates(peak1, peak2)
d = ((R+peak1(:,3)).*(1 - 2*y) > (R+peak2(:,3)));
endfunction
function n = filter_nearby(P, peaks)
% Returns true, if the distance between a peak P and some peaks is less than
% the radius which is dominated by Mount Everest, false otherwise
n = logical((P(1)-peaks(:,1)).^2 + (cos(P(1))*(P(2)-peaks(:,2))).^2 < 0.003);
endfunction
fprintf('[Octave] Loading peak data...........');
fflush(stdout);
tic;
......@@ -41,6 +47,8 @@ tic;
if dom(i)
peak1 = P(i,:);
mask = logical(dom.*(1:N>i)');
nearby = filter_nearby(peak1,P(mask,:));
mask(mask) = mask(mask).*nearby;
dom(mask) = dom(mask) .* (1 - dominates(peak1, P(mask,:)));
endif
endfor
......@@ -61,7 +69,8 @@ tic;
for i=2:K
j = ind(i);
peak2 = P(j,:);
dom(j) = dom(j)*(1 - logical(sum(dominates(P(1:j-1,:), peak2))));
nearby = filter_nearby(peak2, P(1:j-1,:));
dom(j) = dom(j)*(1 - logical(sum(dominates(P(1:j-1,:)(nearby,:), peak2))));
endfor
t = toc;
fprintf('[%f s]\n', t);
......
......@@ -79,7 +79,7 @@
}).addTo(mymap);
</script>
<p><small>Last data update: 2018-08-21</small></p>
<p><small>Last data update: 2018-09-23</small></p>
</div>
</body>
......
This diff is collapsed.