function usa_cvt_geo_estimate_test ( )

%*****************************************************************************80
%
%% usa_cvt_geo_estimate_test() tests usa_cvt_geo_estimate();
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 January 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'usa_cvt_geo_estimate_test():\n' );
  fprintf ( 1, '  usa_cvt_geo_estimate() estimates the geometric centroidal\n' );
  fprintf ( 1, '  Voronoi tessellation (CVT) of a set of points\n' );
  fprintf ( 1, '  within the boundaries of the USA,\n' );
  fprintf ( 1, '  expressed as longitudes and latitudes.\n' );
%
%  Set the data.
%
  names = [ ...
    'Montgomery', ...
    'Phoenix', ...
    'Little Rock', ...
    'Sacramento', ...
    'Denver', ...
    'Hartford', ...
    'Dover', ...
    'Tallahassee', ...
    'Atlanta', ...
    'Boise', ...
    'Springfield', ...
    'Indianapolis', ...
    'Des Moines', ...
    'Topeka', ...
    'Frankfort', ...
    'Baton Rouge', ...
    'Augusta', ...
    'Annapolis', ...
    'Boston', ...
    'Lansing', ...
    'Saint Paul', ...
    'Jackson', ...
    'Jefferson City', ...
    'Helena', ...
    'Lincoln', ...
    'Carson City', ...
    'Concord', ...
    'Trenton', ...
    'Santa Fe', ...
    'Albany', ...
    'Raleigh', ...
    'Bismarck', ...
    'Columbus', ...
    'Oklahoma City', ...
    'Salem', ...
    'Harrisburg', ...
    'Providence', ...
    'Columbia', ...
    'Pierre', ...
    'Nashville', ...
    'Austin', ...
    'Salt Lake City', ...
    'Montpelier', ...
    'Richmond', ...
    'Olympia', ...
    'Charleston', ...
    'Madison', ...
    'Cheyenne' ...
   ];

  gen_lat = [ ...
    32.361538, ...
    33.448457, ...
    34.736009, ...
    38.555605, ...
    39.7391667, ...
    41.767, ...
    39.161921, ...
    30.4518, ...
    33.76, ...
    43.613739, ...
    39.783250, ...
    39.790942, ...
    41.590939, ...
    39.04, ...
    38.197274, ...
    30.45809, ...
    44.323535, ...
    38.972945, ...
    42.2352, ...
    42.7335, ...
    44.95, ...
    32.320, ...
    38.572954, ...
    46.595805, ...
    40.809868, ...
    39.160949, ...
    43.220093, ...
    40.221741, ...
    35.667231, ...
    42.659829, ...
    35.771, ...
    48.813343, ...
    39.962245, ...
    35.482309, ...
    44.931109, ...
    40.269789, ...
    41.82355, ...
    34.000, ...
    44.367966, ...
    36.165, ...
    30.266667, ...
    40.7547, ...
    44.26639, ...
    37.54, ...
    47.042418, ...
    38.349497, ...
    43.074722, ...
    41.145548 ];

  gen_lon = [ ...
     -86.279118, ...
    -112.073844, ...
     -92.331122, ...
    -121.468926, ...
    -104.984167, ...
     -72.677, ...
     -75.526755, ...
     -84.27277, ...
     -84.39, ...
    -116.237651, ...
     -89.650373, ...
     -86.147685, ...
     -93.620866, ...
     -95.69, ...
     -84.86311, ...
     -91.140229, ...
     -69.765261, ...
     -76.501157, ...
     -71.0275, ...
     -84.5467, ...
     -93.094, ...
     -90.207, ...
     -92.189283, ...
    -112.027031, ...
     -96.675345, ...
    -119.753877, ...
     -71.549127, ...
     -74.756138, ...
    -105.964575, ...
     -73.781339, ...
     -78.638, ...
    -100.779004, ...
     -83.000647, ...
     -97.534994, ...
    -123.029159, ...
     -76.875613, ...
     -71.422132, ...
     -81.035, ...
    -100.336378, ...
     -86.784, ...
     -97.75, ...
    -111.892622, ...
     -72.57194, ...
     -77.46, ...
    -122.893077, ...
     -81.633294, ...
     -89.384444, ...
    -104.802042 ];
%
%  Estimate the CVT.
%
  [ gen_lon, gen_lat ] = usa_cvt_geo_estimate ( gen_lon, gen_lat );
%
%  Estimate the centroids.
%
  sample_num = 20000;
  [ cen_lon, cen_lat ] = usa_centroid_geo ( gen_lon, gen_lat, sample_num );
%
%  Show generators, centroids, and Voronoi region together.
% 
  filename = 'usa_cvt_geo_estimate_test.png';
  plot_title = 'Estimated 48-Generator geometric CVT for the USA';
  usa_voronoi_display ( gen_lon, gen_lat, cen_lon, cen_lat, filename, plot_title );

  return
end

