function cc_grids_constrained_display ( )

%*****************************************************************************80
%
%% CC_GRIDS_CONSTRAINED_DISPLAY displays grids generated by CC_GRIDS_CONSTRAINED.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    08 November 2006
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  timestamp ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'CC_GRIDS_CONSTRAINED_DISPLAY:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Display the 2D Clenshaw-Curtis grids\n' );
  fprintf ( 1, '  generated by CC_GRIDS_CONSTRAINED.\n' );

  dim_num = 2;
 
  while ( 1 )
%
%  Get user input.
%
    q_max = input ( 'Enter Q_MAX or RETURN to exit;' );
    
    if ( isempty ( q_max ) )
      break
    end
    
    if ( q_max < dim_num )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  We require DIM_NUM <= Q_MAX!\n' );
      continue
    end

    alpha = input ( 'Enter [ ALPHA1, ALPHA2 ] or RETURN to exit;' );
    
    if ( isempty ( alpha ) )
      break
    end

    order_min = input ( 'Enter [ ORDER_MIN1, ORDER_MIN2 ] or RETURN to exit;' );
    
    if ( isempty ( order_min ) )
      break
    end

    order_max = input ( 'Enter [ ORDER_MAX1, ORDER_MAX2 ] or RETURN to exit;' );
    
    if ( isempty ( order_max ) )
      break
    end
%
%  Compute data.
%
    [ grid_num, point_num ] = cc_grids_constrained_size ( dim_num, ...
      q_max, alpha, order_min, order_max );
    
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Number of grids is %d\n', grid_num );
    fprintf ( 1, '  Number of points is %d\n', point_num );

    [ grid_order, grid_point ] = cc_grids_constrained ( dim_num, ...
      q_max, alpha, order_min, order_max, grid_num, point_num );

    clf
%
%  We have to name the axes in order to control the grid.
%
    axes_handle = axes;
%
%  Plot the points.
%
    handle = scatter ( grid_point(1,:), grid_point(2,:), 'filled' );
%
%  Force the plotting region to be square, not rectangular.
%
    axis square
%
%  Request grid lines.
%
    grid on
%
%  Specify the location of the grid lines, and suppress labeling.
%
    set ( axes_handle, 'xtick', [ -1, -.75, -.5, -.25, 0, .25, .50, .75, 1] );
    set ( axes_handle, 'xticklabel', [] );
    set ( axes_handle, 'ytick', [ -1, -.75, -.5, -.25, 0, .25, .50, .75, 1] );
    set ( axes_handle, 'yticklabel', [] );
%
%  Make the plotting region slightly bigger than the data.
%
    axis ( [ -1.1, 1.1, -1.1, 1.1 ] )
%
%  Title
%
    s = sprintf ( '%d <= Q <= %d', q_min, q_max );
    title ( s );
    
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, 'CC_GRIDS_CONSTRAINED_DISPLAY:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
