function triboard_ijk_init ( m, n, r, color_back, color_fore )

%*****************************************************************************80
%
%% triboard_ijk_init initializes a triangular board.
%
%  Discussion:
%
%    An MxN parallelogram is drawn, with one side horizontal and the other
%    at 60 degrees.  The parallelogram can be subdivided into M*N unit 
%    parallelograms with coordinates (I,J).  Each parallelogram is further 
%    divided into a lower left and upper right equilateral triangle, with 
%    coordinates K=0 and K=1.  Thus, each triangle can be identified by
%    (I,J,K) coordinates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 August 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the width and height of the board.
%
%    real R, a size factor for each triangle, between 0 and 1.
%
%    colors COLOR_BACK, COLOR_FORE.  These can be
%    any of the 8 abbreviated color terms 'r', 'g', 'b', 'c',
%    'm', 'y', 'w', 'k', or an RGB triple such as [1.0,0.4,0.0].
%    The board background is drawn with COLOR_BACK, and the board
%    cells are then drawn with COLOR_FORE.
%

%
%  Draw the background parallelogram.
%
  x1 = 0.0;
  x2 = m;
  x3 = m + n * cos ( pi / 3.0 );
  x4 = n * cos ( pi / 3.0 );

  y1 = 0.0;
  y2 = 0.0;
  y3 = n * sin ( pi / 3.0 );
  y4 = n * sin ( pi / 3.0 );

  fill ( [ x1, x2, x3, x4 ], [ y1, y2, y3, y4 ], color_back );
%
%  Draw the equilateral triangular cells.
%
  hold ( 'on' );

  for i = 1 : m
    for j = 1 : n
      for k = 0 : 1
        triangle_ijk_fill ( i, j, k, r, color_fore );
      end     
    end
  end

  hold ( 'off' );

  axis ( 'equal' );
  axis ( 'off' );

  return
end
