function [ gen_lon, gen_lat ] = usa_cvt_geo_estimate ( gen_lon, gen_lat )

%*****************************************************************************80
%
%% usa_cvt_geo_estimate() estimates a CVT for the US based on geometric data.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 December 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real GEN_LON(N), GEN_LAT(N), points to be used as the initial
%    generators.
%
%  Output:
%
%    real GEN_LON(N), GEN_LAT(N), improved estimates of the CVT
%    generators.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'usa_cvt_geo_estimate():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Estimate a centroidal Voronoi tessellation (CVT)\n' );
  fprintf ( 1, '  of the USA, using geometric data.\n' );
%
%  Select N random points within the Florida polygon to use as generators.
%
  n = length ( gen_lon );
%
%  Display the points.
%
  filename = '';
  plot_title = 'Starting generators';
  usa_point_display ( gen_lon, gen_lat, filename, plot_title );
%
%  Prepare for random sampling.
%
  sample_num = 5000;

  for step = 1 : 10

    [ cen_lon, cen_lat ] = usa_centroid_geo ( gen_lon, gen_lat, sample_num );

    filename = '';
    plot_title = sprintf ( 'CVT Step %d', step );
    usa_voronoi_display ( gen_lon, gen_lat, cen_lon, cen_lat, filename, plot_title );

    filename = '';
    plot_title = sprintf ( 'Generators after step %d\n', step );
    usa_point_display ( cen_lon, cen_lat, filename, plot_title );

    gen_lon = cen_lon;
    gen_lat = cen_lat;

  end

  return
end
