コード例 #1
0
 def test_twoDiagonals(self):
     line1 = ((-1, -1), (1, 1))
     line2 = ((-1, 1), (1, -1))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals((0, 0),
                       intersectionPoint)
コード例 #2
0
 def test_twoParallelLines(self):
     line1 = ((-1, 0), (1, 0))
     line2 = ((-1, 1), (1, 1))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals(None,
                       intersectionPoint)
コード例 #3
0
 def test_twoLinesOfUnequalLength(self):
     line1 = ((0, 0), (100, 0))
     line2 = ((50, 1), (50, -1))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals((50, 0),
                       intersectionPoint)
コード例 #4
0
 def test_twoLinesIntersectAtOneOne(self):
     line1 = ((0, 1), (2, 1))
     line2 = ((1, 0), (1, 2))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals((1, 1),
                       intersectionPoint)
コード例 #5
0
 def test_twoLinesIntersectAtOrigin(self):
     line1 = ((-1, 0), (1, 0))
     line2 = ((0, -1), (0, 1))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals((0, 0),
                       intersectionPoint)
コード例 #6
0
 def test_twoLineSegmentsThatDoNotIntersect(self):
     line1 = ((-1, 0), (1, 0))
     line2 = ((5, -1), (5, 1))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertEquals(None,
                       intersectionPoint)
コード例 #7
0
 def test_1(self):
     line1 = ((338, 1188), (342, 1248))
     line2 = ((25, 1225), (1255, 1225))
     intersectionPoint = intersect.getLineSegmentIntersection(line1,
                                                line2)
     self.assertTrue(intersectionPoint)