Пример #1
0
 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++;
 }
Пример #2
0
        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);
        }
Пример #3
0
 private double sum(Shape a, Shape b, double c)
 {
     return shapeDistance(a, b);
 }
Пример #4
0
 private double dev(Shape a, Shape b, double c)
 {
     double dist = shapeDistance(a, b);
     return (dist - c) * (dist - c);
 }