function n = printseveral(s) % N = PRINT(S) % % S: ... % % N: ... % % PRINT displays fronts saved in 'Curves'. ... global x y n Fronts Time Phi Time = load('Time'); Phi = load('Phi'); Curves = load('Curves'); CurveLengths = load('CurveLengths'); x = load('X'); y = load('Y'); Delta_x = x(2) - x(1); Delta_y = y(2) - y(1); LimitDistance = sqrt( Delta_x^2 + Delta_y^2 ); n = length(CurveLengths); Fronts = cell(n,1); count = 1; for i=1:n Fronts(i) = {Curves(count:count + CurveLengths(i) - 1, :)}; count = count + CurveLengths(i); end figure; axis([x(1) x(end) y(1) y(end)]); hold on for i=1:s:n LastX = Fronts{i}(1, 1); LastY = Fronts{i}(1, 2); for j=1:size(Fronts{i},1)-1 if ( sqrt( (Fronts{i}(j,1) - Fronts{i}(j+1,1))^2 + (Fronts{i}(j,2) - Fronts{i}(j+1,2))^2 ) < LimitDistance) plot([Fronts{i}(j, 1); Fronts{i}(j+1, 1)], [Fronts{i}(j, 2); Fronts{i}(j+1, 2)], '-b') else if ( sqrt( (Fronts{i}(j,1) - LastX)^2 + (Fronts{i}(j,2) - LastY)^2 ) < LimitDistance) plot([Fronts{i}(j, 1); LastX], [Fronts{i}(j, 2); LastY], '-b') end LastX = Fronts{i}(j+1, 1); LastY = Fronts{i}(j+1, 2); end end j = size(Fronts{i},1); if ( sqrt( (Fronts{i}(j,1) - Fronts{i}(1,1))^2 + (Fronts{i}(j,2) - Fronts{i}(1,2))^2 ) < LimitDistance) plot([Fronts{i}(j, 1); Fronts{i}(1, 1)], [Fronts{i}(j, 2); Fronts{i}(1, 2)], '-b') else if ( sqrt( (Fronts{i}(j,1) - LastX)^2 + (Fronts{i}(j,2) - LastY)^2 ) < LimitDistance) plot([Fronts{i}(j, 1); LastX], [Fronts{i}(j, 2); LastY], '-b') end end end set(gcf, 'Position', [100 100 600 600]); return;