function sphere_triangle_vertices_to_sides_test ( )

%*****************************************************************************80
%
%% sphere_triangle_vertices_to_sides_test() tests sphere_triangle_vertices_to_sides().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 November 2025
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Spherical trig, research triangle, and Mathematica,
%    https://www.johndcook.com/blog/2018/12/03/research-triangle/
%    Posted on 03 December 2018.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'sphere_triangle_vertices_to_sides_test():\n' );
  fprintf ( 1, '  sphere_triangle_vertices_to_sides() takes the XYZ\n' );
  fprintf ( 1, '  coordinates of the vertices of a spherical triangle and\n' );
  fprintf ( 1, '  determines the geodesic length of the triangle sides.\n' );
%
%  Radius of earth in miles.
%
  r = 3958.8;
%
%  longitude and latitude in degrees of research triangle.
%
  latd = [  35.9046,  36.0011,  35.7872 ];
  lond = [ -79.0468, -78.9389, -78.6705 ];
%
%  Convert to radians.
%
  latr = latd * pi / 180.0;
  lonr = lond * pi / 180.0;
%
%  Convert to XYZ coordinates.
%
  x = r * cos ( latr ) .* cos ( lonr );
  y = r * cos ( latr ) .* sin ( lonr );
  z = r * sin ( latr );
%
%  Create column vectors.
%
  axyz = [ x(1); y(1); z(1) ];
  bxyz = [ x(2); y(2); z(2) ];
  cxyz = [ x(3); y(3); z(3) ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sphere has radius %g miles\n', r );
  fprintf ( 1, '  vertex A xyz = ( %g, %g, %g )\n', axyz(1), axyz(2), axyz(3) );
  fprintf ( 1, '  vertex B xyz = ( %g, %g, %g )\n', bxyz(1), bxyz(2), bxyz(3) );
  fprintf ( 1, '  vertex C xyz = ( %g, %g, %g )\n', cxyz(1), cxyz(2), cxyz(3) );
%
%  Get the length of the triangle sides.
%
  [ aside, bside, cside ] = sphere_triangle_vertices_to_sides ( r, axyz, bxyz, cxyz );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  side A = %g miles\n', aside );
  fprintf ( 1, '  side B = %g miles\n', bside );
  fprintf ( 1, '  side C = %g miles\n', cside );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  side A = %g radians\n', aside / r );
  fprintf ( 1, '  side B = %g radians\n', bside / r );
  fprintf ( 1, '  side C = %g radians\n', cside / r );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  side A = %g degrees\n', aside * 180 / pi / r );
  fprintf ( 1, '  side B = %g degrees\n', bside * 180 / pi / r );
  fprintf ( 1, '  side C = %g degrees\n', cside * 180 / pi / r );


  return
end
