function corkscrew_plot3d ( )

%*****************************************************************************80
%
%% CORKSCREW_PLOT3D makes a plot of a 3D curve that looks like a corkscrew.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 July 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CORKSCREW_PLOT3D:\n' );
  fprintf ( 1, '  Octave version:\n' );
  fprintf ( 1, '  Display a curve defined by points on a 3D curve.\n' );
%
%  Define N points (X,Y,Z) along a curve.
%
  n = 101;
  z = linspace ( -2.0, 2.0, n );
  r = z .^ 2 + 1.0;
  theta = linspace ( - 6.0 * pi, + 6.0 * pi, n );
  x = r .* sin ( theta );
  y = r .* cos ( theta );
%
%  Save the data to a file.
%
  xyz = [ x', y', z' ];
  save ( 'corkscrew_data.txt', 'xyz', '-ascii' );
%
%  Plot the curve.
%
  plot3 ( x, y, z, 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- X -->' );
  ylabel ( '<-- Y -->' );
  zlabel ( '<-- Z -->' );
  title ( 'A 3D "corkscrew" curve', 'fontsize', 24 );
  
  view ( 3 );

  pause ( 5 )
%
%  Save graphics to a file.
%
  filename = 'corkscrew_plot3d.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CORKSCREW_PLOT3D:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
