예제 #1
0
        /// <summary>
        /// This is a lazy calculation of the voronoi Vertex, its not calculated if it isn't required.
        /// </summary>
        private void CalculateSimpliceCentroid()
        {
            Debug.Print("Calculating Simplice centroid");

            if (Nucleis.Any(n => n.Coordinates.Length != Dimensionality))
            {
                throw new ArgumentException("Incorrect dimensionality in the nucleis. some nucleis have no the right dimensionality");
            }

            voroniVertex = new VoronoiVertex(Dimensionality, this);
            Helpers.CalculateSimpliceCentroid(Nucleis, voroniVertex);

            for (int i = 0; i < VoronoiVertex.Coordinates.Length; i++)
            {
                double diff = VoronoiVertex.Coordinates[i] - Nucleis.First().Coordinates[i];
                squaredDistance += diff * diff;
            }
        }
예제 #2
0
 public override string ToString()
 {
     return(GetHashCode() + "||" + string.Join(", ", Nucleis.Select(nc => nc.ToString()).ToArray()));
 }