Beispiel #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)
Beispiel #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())
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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())
Beispiel #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())
Beispiel #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))
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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))
Beispiel #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)
Beispiel #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))
Beispiel #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)
Beispiel #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)
Beispiel #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)