/// <summary> /// Checks if the selected points will result in a degenerate homography. /// </summary> /// private bool degenerate(int[] points) { PointF[] x1 = this.pointSet1.Submatrix(points); PointF[] x2 = this.pointSet2.Submatrix(points); // If any three of the four points in each set is collinear, // the resulting homography matrix will be degenerate. return(Tools.Collinear(x1[0], x1[1], x1[2]) || Tools.Collinear(x1[0], x1[1], x1[3]) || Tools.Collinear(x1[0], x1[2], x1[3]) || Tools.Collinear(x1[1], x1[2], x1[3]) || Tools.Collinear(x2[0], x2[1], x2[2]) || Tools.Collinear(x2[0], x2[1], x2[3]) || Tools.Collinear(x2[0], x2[2], x2[3]) || Tools.Collinear(x2[1], x2[2], x2[3])); }
public void ColinearTest1() { bool actual; PointF pt1, pt2, pt3; pt1 = new PointF(0, 0); pt2 = new PointF(1, 1); pt3 = new PointF(2, 2); actual = Tools.Collinear(pt1, pt2, pt3); Assert.AreEqual(true, actual); pt1 = new PointH(0, 1); pt2 = new PointH(1, 1); pt3 = new PointH(2, 2); actual = Tools.Collinear(pt1, pt2, pt3); Assert.AreEqual(false, actual); }
public void ColinearTest() { bool actual; PointH p1 = new PointH(0, 1); PointH p2 = new PointH(0, 2); PointH p3 = new PointH(0, 3); bool expected = true; actual = Tools.Collinear(p1, p2, p3); Assert.AreEqual(expected, actual); p1 = new PointH(0, 1); p2 = new PointH(1, 0); p3 = new PointH(1, 1); expected = false; actual = Tools.Collinear(p1, p2, p3); Assert.AreEqual(expected, actual); }