function dist = point_to_dist ( dim_num, point_num, point )

%*****************************************************************************80
%
%% point_to_dist() creates a distance matrix from a list of Cartesian coordinates.
%
%  Discussion:
%
%    The euclidean distance is used.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 September 2009
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the spatial dimension.
%
%    integer POINT_NUM, the number of points.
%
%    real POINT(DIM_NUM,POINT_NUM), the  point coordinates.
%
%  Output:
%
%    real DIST(POINT_NUM,POINT_NUM), the distance matrix.
%
  for i = 1 : point_num
    dist(i,i) = 0.0;
    for j = i + 1 : point_num
      dist(i,j) = 0.0;
      for dim = 1 : dim_num
        dist(i,j) = dist(i,j) + ( point(dim,i) - point(dim,j) )^2;
      end
      dist(i,j) = sqrt ( dist(i,j) );
      dist(j,i) = dist(i,j);
    end
  end

  return
end
