예제 #1
0
 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)
예제 #2
0
 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())
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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)
예제 #6
0
 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())
예제 #7
0
 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())
예제 #8
0
 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))
예제 #9
0
 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)
예제 #10
0
 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)
예제 #11
0
 def test_triangleToIntersectingLines_intersectOnePoint(self):
     tri = [
         [2, 4, 3],
         [3, 2, 3],
         [1, 2, 5],
     ]
     lines = slice.triangleToIntersectingLines(tri, 5)
     self.assertEqual(None, lines)
예제 #12
0
 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))
예제 #13
0
 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)
예제 #14
0
 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))
예제 #15
0
 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)
예제 #16
0
 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)
예제 #17
0
 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)