def test_triangleToIntersectingLines_intersectOnePoint(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = [ [2, 4, 3], [3, 2, 3], [1, 2, 5], ] slice.triangleToIntersectingLines(tri, 5, pixels, lines) expected = [] self.assertEqual(expected, lines)
def test_triangleToIntersectingLines_onePointSame(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = np.array([ (2, 4, 1), (1, 2, 5), (3, 2, 3) ]) slice.triangleToIntersectingLines(tri, 3, pixels, lines) expected = np.array([ ((1.5, 3, 3), (3, 2, 3)), ]) self.assertTrue((expected == lines).all())
def test_triangleToIntersectingLines_twoPointSame(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = [ [2, 4, 3], [3, 2, 3], [1, 2, 5], ] slice.triangleToIntersectingLines(tri, 3, pixels, lines) expected = [ (tri[0], tri[1]), ] self.assertEqual(expected, lines)
def test_triangleToIntersectingLines_onePointSame(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = [ (2, 4, 1), (1, 2, 5), (3, 2, 3) ] slice.triangleToIntersectingLines(tri, 3, pixels, lines) expected = [ ((1.5, 3, 3), (3, 2, 3)), ] self.assertEqual(expected, lines)
def test_triangleToIntersectingLines(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = [ [2, 4, 1], [1, 2, 5], [3, 2, 3] ] slice.triangleToIntersectingLines(tri, 4, pixels, lines) expected = [ ((1.25, 2.5, 4.0), (2.0, 2.0, 4.0)), ] self.assertEqual(expected, lines)
def test_triangleToIntersectingLines_twoPointSame(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = np.array([ [2, 4, 3], [3, 2, 3], [1, 2, 5], ]) slice.triangleToIntersectingLines(tri, 3, pixels, lines) expected = np.array([ (tri[0], tri[1]), ]) self.assertTrue((expected == lines).all())
def test_triangleToIntersectingLines(self): pixels = np.zeros((100, 100), dtype=bool) lines = [] tri = np.array([ [2, 4, 1], [1, 2, 5], [3, 2, 3] ]) slice.triangleToIntersectingLines(tri, 4, pixels, lines) expected = np.array([ ((1.25, 2.5, 4.0), (2.0, 2.0, 4.0)), ]) self.assertTrue((expected == lines).all())
def test_triangleToIntersectingLines(self): tri = [[2, 4, 1], [1, 2, 5], [3, 2, 3]] lines = list(slice.triangleToIntersectingLines(tri, 4)) self.assertIn((tri[0], tri[1]), lines) self.assertIn((tri[2], tri[1]), lines) print(lines) self.assertEqual(2, len(lines))
def test_triangleToIntersectingLines_threePointSame(self): tri = [ [2, 4, 3], [1, 2, 3], [3, 2, 3] ] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertTrue(tri in lines)
def test_triangleToIntersectingLines_twoPointSame(self): tri = [ [2, 4, 3], [1, 2, 5], [3, 2, 3] ] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertTrue((tri[0], tri[1]) in lines or (tri[2], tri[1]) in lines)
def test_triangleToIntersectingLines_intersectOnePoint(self): tri = [ [2, 4, 3], [3, 2, 3], [1, 2, 5], ] lines = slice.triangleToIntersectingLines(tri, 5) self.assertEqual(None, lines)
def test_triangleToIntersectingLines_twoPointSame(self): tri = [ [2, 4, 3], [3, 2, 3], [1, 2, 5], ] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertEqual([tri[0], tri[1]], sorted(lines))
def test_triangleToIntersectingLines_onePointSame(self): tri = [ (2, 4, 1), (1, 2, 5), (3, 2, 3) ] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertEqual([(1.5, 3, 3), (3, 2, 3)], lines)
def test_triangleToIntersectingLines(self): tri = [ [2, 4, 1], [1, 2, 5], [3, 2, 3] ] lines = list(slice.triangleToIntersectingLines(tri, 4)) self.assertIn((tri[0], tri[1]), lines) self.assertIn((tri[2], tri[1]), lines) print(lines) self.assertEqual(2, len(lines))
def test_triangleToIntersectingLines(self): tri = [ [2, 4, 1], [1, 2, 5], [3, 2, 3] ] actual = list(slice.triangleToIntersectingLines(tri, 4)) expected = [ (1.25, 2.5, 4.0), (2.0, 2.0, 4.0) ] self.assertEqual(actual, expected)
def test_triangleToIntersectingLines_threePointSame(self): tri = [[2, 4, 3], [1, 2, 3], [3, 2, 3]] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertTrue(tri in lines)
def test_triangleToIntersectingLines_twoPointSame(self): tri = [[2, 4, 3], [1, 2, 5], [3, 2, 3]] lines = list(slice.triangleToIntersectingLines(tri, 3)) self.assertTrue((tri[0], tri[1]) in lines or (tri[2], tri[1]) in lines)