Пример #1
0
        // Simplex.Noise(x, y, r.id, 0)
        // Program.LatLongToSpherical(lat, long) => x,y,z

        /*
         *      NEW PLAN
         *      generate 200 random points on sphere
         *      see which is closest using simple 3d distance calculation
         *      create voronoi diagram
         */
        public static int CountryAtTile(WorldTile w)
        {
            if (!w.isLand)
            {
                return(-1);
            }
            if (0 <= w.owner)
            {
                return(w.owner);
            }
            if (capitals[maxCountries - 1] == null)           // in case cursor gets placed on land BEFORE countries generate
            {
                return(-1);
            }
            // find min dist
            List <double> distances = capitals.Select(c => w.Distance(c)).ToList();

            return(distances.IndexOf(distances.Min()));
        }