function area = sphere_triangle_sides_to_area ( r, as, bs, cs )

%*****************************************************************************80
%
%% sphere_triangle_sides_to_area() computes spherical triangle area from sides.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 November 2025
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Analog of Heron's formula on a sphere,
%    https://www.johndcook.com/blog/2025/11/08/heron-on-a-sphere/
%    posted 08 November 2025.
%
%  Input:
%
%    real R, the radius of the sphere.
%
%    real AS, BS, CS, the (geodesic) length of the 
%    sides of the triangle.
%
%  Output:
%
%    real AREA: the area of the spherical triangle.
%
  s = 0.5 * ( as + bs + cs );

  t = tan ( 0.5 * s / r ) ...
    * tan ( 0.5 * ( s - as ) / r ) ...
    * tan ( 0.5 * ( s - bs ) / r ) ...
    * tan ( 0.5 * ( s - cs ) / r );

  area = r^2 * 4.0 * atan ( sqrt ( t ) );

  return
end
