コード例 #1
0
 def test_intersect_2(self):
     box = ConstructionBox(center=(5, 0.5), width=10, height=1, angle=0)
     line = ConstructionLine((5, -1), (5, 2))
     result = box.intersect(line)
     assert len(result) == 2
     assert result[0].isclose((5, 0))
     assert result[1].isclose((5, 1))
コード例 #2
0
 def test_intersect_1(self):
     box = ConstructionBox(center=(5, 0.5), width=10, height=1, angle=0)
     line = ConstructionLine((10, 1), (11, 2))  # touch one corner
     result = box.intersect(line)
     assert len(result) == 1
     assert result[0].isclose((10, 1))
コード例 #3
0
 def test_intersect_0(self):
     box = ConstructionBox(center=(5, 0.5), width=10, height=1, angle=0)
     line = ConstructionLine((0, 2), (1, 2))  # above box
     assert len(box.intersect(line)) == 0