function sphere_imp_point_project_3d_test ( )

%*****************************************************************************80
%
%% sphere_imp_point_project_3d_test() tests sphere_imp_point_project_3d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 May 2005
%
%  Author:
%
%    John Burkardt
%
  dim_num = 3;
  ntest = 4;

  ptest = [ ...
    2.0, 0.0,  0.0; ...
    0.0, 4.0,  0.0; ...
    2.0, 4.0, 10.0; ...
    3.0, 5.0,  0.0 ]';
  r = 2.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'sphere_imp_point_project_3d_test():\n' );
  fprintf ( 1, '  sphere_imp_point_project_3d() projects a 3D point\n' );
  fprintf ( 1, '  onto a sphere.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        P1       projection P2\n' );
  fprintf ( 1, '\n' );
 
  center(1:dim_num) = [ 2.0, 4.0, 0.0 ];
    
  for i = 1 : ntest

    p1(1:dim_num) = ptest(1:dim_num,i);

    p2 = sphere_imp_point_project_3d ( r, center, p1 );

    fprintf ( 1, '  %10f  %10f  %10f  %10f  %10f  %10f\n', ...
      p1(1:dim_num), p2(1:dim_num) );

  end

  return
end
