Example #1
0
 def test_fully_overlapping_oriented_boxes(self):
     box1 = CollisionablePolygonExample(
         [Point2D(-1, 1),
          Point2D(0, 2),
          Point2D(1, 1),
          Point2D(0, 0)])
     box2 = CollisionablePolygonExample(
         [Point2D(-1, 1),
          Point2D(0, 2),
          Point2D(1, 1),
          Point2D(0, 0)])
     self.assertTrue(CollisionDetection.are_colliding(box1, box2))
Example #2
0
 def test_touching_axis_aligned_boxes(self):
     box1 = CollisionablePolygonExample(
         [Point2D(0, 1),
          Point2D(1, 1),
          Point2D(1, 0),
          Point2D(0, 0)])
     box2 = CollisionablePolygonExample(
         [Point2D(1, 1),
          Point2D(2, 1),
          Point2D(2, 0),
          Point2D(1, 0)])
     self.assertTrue(CollisionDetection.are_colliding(box1, box2))
Example #3
0
 def test_partially_overlapping_axis_aligned_boxes(self):
     box1 = CollisionablePolygonExample(
         [Point2D(0, 1),
          Point2D(1, 1),
          Point2D(1, 0),
          Point2D(0, 0)])
     box2 = CollisionablePolygonExample([
         Point2D(0.5, 1),
         Point2D(2.5, 1),
         Point2D(2.5, 0),
         Point2D(1.5, 0)
     ])
     self.assertTrue(CollisionDetection.are_colliding(box1, box2))
Example #4
0
 def test_falla(self):
     box1 = CollisionablePolygonExample([
         Point2D(15, 5),
         Point2D(15.0, 3.0),
         Point2D(24.43, -2.92),
         Point2D(25, -1)
     ])
     box2 = CollisionablePolygonExample([
         Point2D(18.6, -0.5),
         Point2D(20.6, -0.5),
         Point2D(20.6, 0.5),
         Point2D(18.6, 0.5)
     ])
     self.assertTrue(CollisionDetection.are_colliding(box1, box2))