public PointPatternMatchResult GetPointPatternMatchResult(PointsPatternSet compareTo, PointsPatternSet points)
        {
            PointPatternMatchResult comparisonResults = new PointPatternMatchResult();

            if (compareTo.Points.Length == 1 || points.Points.Length <= 1)
            {
                if (points.Points.Length == compareTo.Points.Length)
                {
                    comparisonResults.Probability = 100d;
                }
                else
                {
                    comparisonResults.Probability = 0d;
                }
            }
            else
            {
                double[] aDeltas          = new double[Precision];
                double[] aCompareToAngles = compareTo.GetAngularMargins(Precision);
                double[] aCompareAngles   = points.GetAngularMargins(Precision);

                for (int i = 0; i <= aCompareToAngles.Length - 1; i++)
                {
                    aDeltas[i] = PointPatternMath.GetAngularDelta(aCompareToAngles[i], aCompareAngles[i]);
                }

                // Create new PointPatternMatchResult object to hold results from comparison
                comparisonResults.Probability = PointPatternMath.GetProbabilityFromAngularDelta(aDeltas.Average());
            }
            comparisonResults.Name = compareTo.Name;
            // Return results of the comparison
            return(comparisonResults);
        }
示例#2
0
 public double[] GetAngularMargins(int precision)
 {
     if (_angularMargins == null)
     {
         _angularMargins = PointPatternMath.GetPointArrayAngularMargins(PointPatternMath.GetInterpolatedPointArray(Points, precision));
     }
     return(_angularMargins);
 }