#!/usr/bin/env octave

1;

function nml(hl,phi_deg,i)
  r_in = hl*12*90;
  y_in = -max(r_in*sin(phi_deg/180*pi),0.001);
  z_in = -r_in*cos(phi_deg/180*pi);

  disp(sprintf("y_ray(%2d) = %12.6f",i,y_in))
  disp(sprintf("z_ray(%2d) = %12.6f",i,z_in))
end

disp(sprintf('&sonic_boom'));
for i=0:90
  nml(3,i*2,i+1);
end

disp(sprintf('nsignals = %d',91));
disp(sprintf('/'));

function zone(hl,phi_deg,i)
  r_in = hl*12*90;
  y_in = -max(r_in*sin(phi_deg/180*pi),0.001);
  z_in = -r_in*cos(phi_deg/180*pi);

 disp(sprintf('ZONE T="HL=%2.0f,PHI=%02.0f"',hl,phi_deg))
 disp(sprintf(" %3.1f %12.6f %12.6f %3.1f",0,y_in,z_in,0))

end
for i=0:90
  zone(3,i*2,i+1);
end

function txt(hl,phi_deg,i)
  r_in = hl*12*90;
  y_in = -max(r_in*sin(phi_deg/180*pi),0.001);
  z_in = -r_in*cos(phi_deg/180*pi);

 disp(sprintf(" %12.6f %12.6f %9.1f %9.1f",y_in,z_in,hl,phi_deg))

end
for i=0:90
  txt(3,i*2,i+1);
end
