Пример #1
0
        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
        }                                                                 //

        #endregion

        #region Public Methods

        public PointPatternMatchResult[] GetPointPatternMatchResults(Point[] Points)
        {
            // Create a list of PointPatternMatchResults to hold final results and group results of point pattern set comparison
            List <PointPatternMatchResult> comparisonResults = new List <PointPatternMatchResult>(PointPatternSet.Count());
            var targetPattern = new PointsPatternSet(null, Points);

            // Enumerate each point patterns
            foreach (var pointPatternSet in PointPatternSet)
            {
                // Calculate probability of each point pattern
                comparisonResults.Add(GetPointPatternMatchResult(pointPatternSet, targetPattern));
            }

            // Return comparison results ordered by highest probability
            return(comparisonResults.ToArray());//.OrderByDescending(ppmr => ppmr.Probability).
        }