internal static Point[] sort(Point[] centers, int[] angle) { Point[] sortedCenters = new Point[3]; switch (FinderPattern.getURQuadant(angle)) { case 1: sortedCenters[1] = FinderPattern.getPointAtSide(centers, 1, 2); sortedCenters[2] = FinderPattern.getPointAtSide(centers, 2, 4); break; case 2: sortedCenters[1] = FinderPattern.getPointAtSide(centers, 2, 4); sortedCenters[2] = FinderPattern.getPointAtSide(centers, 8, 4); break; case 3: sortedCenters[1] = FinderPattern.getPointAtSide(centers, 4, 8); sortedCenters[2] = FinderPattern.getPointAtSide(centers, 1, 8); break; case 4: sortedCenters[1] = FinderPattern.getPointAtSide(centers, 8, 1); sortedCenters[2] = FinderPattern.getPointAtSide(centers, 2, 1); break; } for (int i = 0; i < centers.Length; i++) { if (!centers[i].equals(sortedCenters[1]) && !centers[i].equals(sortedCenters[2])) { sortedCenters[0] = centers[i]; } } return(sortedCenters); }
internal static Point[] sort(Point[] centers, int[] angle) { Point[] pointArray = new Point[3]; switch (FinderPattern.getURQuadant(angle)) { case 1: pointArray[1] = FinderPattern.getPointAtSide(centers, 1, 2); pointArray[2] = FinderPattern.getPointAtSide(centers, 2, 4); break; case 2: pointArray[1] = FinderPattern.getPointAtSide(centers, 2, 4); pointArray[2] = FinderPattern.getPointAtSide(centers, 8, 4); break; case 3: pointArray[1] = FinderPattern.getPointAtSide(centers, 4, 8); pointArray[2] = FinderPattern.getPointAtSide(centers, 1, 8); break; case 4: pointArray[1] = FinderPattern.getPointAtSide(centers, 8, 1); pointArray[2] = FinderPattern.getPointAtSide(centers, 2, 1); break; } for (int index = 0; index < centers.Length; ++index) { if (!centers[index].equals(pointArray[1]) && !centers[index].equals(pointArray[2])) { pointArray[0] = centers[index]; } } return(pointArray); }