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); }
public PointPatternMatchResult GetPointPatternMatchResult(PointsPatternSet CompareTo, Point[] Points) { PointPatternMatchResult comparisonResults = new PointPatternMatchResult(); if (CompareTo.Points.Length == 1 || Points.Length <= 1) { if (Points.Length == CompareTo.Points.Length) { comparisonResults.Probability = 100d; } else { comparisonResults.Probability = 0d; } } else { double[] aDeltas = new double[Precision]; double[] aCompareToAngles = PointPatternMath.GetPointArrayAngularMargins(PointPatternMath.GetInterpolatedPointArray(CompareTo.Points, Precision)); double[] aCompareAngles = PointPatternMath.GetPointArrayAngularMargins(PointPatternMath.GetInterpolatedPointArray(Points, 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; comparisonResults.PointPatternSetCount = 1; // Return results of the comparison return comparisonResults; }