public void addShape(string shape) { if (idx >= numShapes) { System.Windows.Forms.MessageBox.Show("Idx is greater than numShapes. Weird. shape: "+name+" features: "+shape+" idx: "+idx); return; }; shapes[idx] = new Shape(numFeatures, shape); idx++; }
private double shapeDistance(Shape s, Shape n) { double results = 0; for (int i = 0; i < numFeatures; i++) { results += (double)(s.feature[i] - n.feature[i]) * (double)(s.feature[i] - n.feature[i]); } return results==0 ? 0 : Math.Sqrt(results); }
private double sum(Shape a, Shape b, double c) { return shapeDistance(a, b); }
private double dev(Shape a, Shape b, double c) { double dist = shapeDistance(a, b); return (dist - c) * (dist - c); }