Exemple #1
0
        public void Centers()
        {
            Random r = new Random();

            for (int i = 0; i < n; i++)
            {
                int ind = r.Next(0, points.Count - 1);
                centers[i] = new PointXY();
                centers[i].setX(points[ind].getX());
                centers[i].setY(points[ind].getY());
                centers[i].setCluster(i + 1);
            }
        }
Exemple #2
0
 public double Dist(PointXY cent, PointXY p)
 {
     return(Math.Sqrt(Math.Pow((cent.getX() - p.getX()), 2) + Math.Pow((cent.getY() - p.getY()), 2)));
 }