% script file to generate a figure showing the points where the maximum
%     error occurs between the level set and the Merz barrier points 
%
% Ian Mitchell for TransAC, 5/5/01

lsFile = 'c:\cygwin\tmp\Aircraft3D\air.100.min.0260';
ptsFile = 'c:\cygwin\tmp\Aircraft3D\merzPts60.mat';
%lsFile = '/tmp/Aircraft3D/aircraft3D.100.min.0260';
%ptsFile = '/tmp/Aircraft3D/merzPts60.mat';

% plot the level set
%figure
plotLS(0, lsFile, 1000, 'solid');
hold on;

% pretty up the level set
view(0,-90);
camlight right;
view(80,12);
axis([ -5 20 -10 10 0 2*pi ]);
xlabel('x');  ylabel('y');  zlabel('\psi');

% get points and find errors
load(ptsFile);
[ err n ind ] = errorLS(lsFile, pts);

% plot largest several errors
howMany = 100;
inds = ind(1:howMany);
plot3(pts(inds,1), pts(inds,2), pts(inds,3), 'k.');

% plot largest error
plot3(pts(ind(1),1), pts(ind(1),2), pts(ind(1),3), 'g*');
plot3(pts(ind(1),1), pts(ind(1),2), pts(ind(1),3), 'go');

hold on;
legend([ num2str(which(end)) ' largest' ], 'single largest', 4);

title('Barrier Points with Largest Deviation from Zero Level Set');

