function [ i1, i2, i3, t0, y0, tstop ] = rigid_body_parameters ( i1_user, ...
  i2_user, i3_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% rigid_body_parameters() returns parameters for rigid_body_ode().
%
%  Discussion:
%
%    If input values are specified, this resets the default parameters.
%    Otherwise, the output will be the current defaults.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real I1_USER, I2_USER, I3_USER: shape parameters.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(3): the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real I1, I2, I3: shape parameters.
%
%    real T0: the initial time.
%
%    real Y0(3): the initial condition.
%
%    real TSTOP: the final time.
%
  persistent i1_default;
  persistent i2_default;
  persistent i3_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( i1_default ) )
    i1_default = 1.6;
  end

  if ( isempty ( i2_default ) )
    i2_default = 1.0;
  end

  if ( isempty ( i3_default ) )
    i3_default = 2.0 / 3.0;
  end

  if ( isempty ( t0_default ) )
    t0_default = 0.0;
  end

  if ( isempty ( y0_default ) )
    x = cos ( 0.9 );
    y = 0.0;
    z = sin ( 0.9 );
    y0_default = [ x, y, z ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 50.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    i1_default = i1_user;
  end

  if ( 2 <= nargin )
    i2_default = i2_user;
  end

  if ( 3 <= nargin )
    i3_default = i3_user;
  end

  if ( 4 <= nargin )
    t0_default = t0_user;
  end

  if ( 5 <= nargin )
    y0_default = y0_user;
  end

  if ( 6 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  i1 = i1_default;
  i2 = i2_default;
  i3 = i3_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;

  return
end

