filenames = ['image_points_01.txt';
             'image_points_02.txt';
             'image_points_03.txt';
             'image_points_04.txt';
             'image_points_05.txt'];
siz = size(filenames);
num = siz(1);

wp = load('world_points.txt');

fid = fopen('point_angle.txt', 'w');
for k = 1:num
  ip = load(filenames(k,:));
  siz = size(wp);

  for m = 1:4
    for n = m+1:4
      v1 = wp(m,:) / norm(wp(m,:));
      v2 = wp(n,:) / norm(wp(n,:));
      a = acos(sum(v1 .* v2));
      fprintf(fid, '%3.6f %3.6f %3.6f %3.6f %3.6f\n', ...
              ip(m,:), ip(n,:), a);
    end
  end
end
fclose(fid);
