public float KhoangCach(tPoint b) { float result = 0; for (int i = 0; i < Vector.Count; i++) { result += (float)Math.Pow(Vector[i] - b.Vector[i], 2); } return((float)Math.Sqrt(result)); }
public void UpdateCenter(List <tPoint> lst) { if (lst == null || lst.Count == 0) { return; } tPoint save = new tPoint(); save.ZeroVector(); foreach (var item in lst) { save += item; } for (int i = 0; i < save.Vector.Count; i++) { save.Vector[i] = (byte)(save.Vector[i] / lst.Count); } this.Vector = save.Vector; }