Example #1
0
    def test_circles_overlap(self):
        pt1 = funcs_objects.Circle(funcs_objects.Point(0, 0), 10)
        pt2 = funcs_objects.Circle(funcs_objects.Point(15, 15), 2)
        self.assertFalse(funcs_objects.circles_overlap(pt1, pt2))

        pt1 = funcs_objects.Circle(funcs_objects.Point(9, 0), 18)
        pt2 = funcs_objects.Circle(funcs_objects.Point(0, 0), 6)
        self.assertTrue(funcs_objects.circles_overlap(pt1, pt2))
 def test_overlap(self):
     center1 = Point(3, 2)
     center2 = Point(4, 6)
     center3 = Point(7, 10)
     center4 = Point(8, 15)
     c1 = Circle(center1, 5)
     c2 = Circle(center2, 2)
     c3 = Circle(center3, 4)
     c4 = Circle(center4, 3)
     overlap1 = funcs_objects.circles_overlap(c1, c2)
     overlap2 = funcs_objects.circles_overlap(c1, c3)
     overlap3 = funcs_objects.circles_overlap(c1, c4)
     self.assertTrue(overlap1)
     self.assertTrue(overlap2)
     self.assertFalse(overlap3)
Example #3
0
 def test_circles_overlap2(self):
     Point_1 = objects.Point(57, 64)
     Point_2 = objects.Point(1, 2)
     Circle_1 = objects.Circle(Point_1, 2)
     Circle_2 = objects.Circle(Point_2, 2)
     test_circles_overlap2 = funcs_objects.circles_overlap(Circle_1, Circle_2)
     self.assertFalse(test_circles_overlap2)
Example #4
0
 def test_circles_overlap(self):
     Point_1 = objects.Point(1, 0)
     Point_2 = objects.Point(2, 1)
     Circle_1 = objects.Circle(Point_1, 4)
     Circle_2 = objects.Circle(Point_2, 5)
     test_circles_overlap = funcs_objects.circles_overlap(Circle_1, Circle_2)
     self.assertTrue(test_circles_overlap)
Example #5
0
 def test_point(self):
    p = objects.Point(1,2)
    self.assertEqual(p.x, 1)
    self.assertEqual(p.y, 2)
    dist = funcs_objects.distance(objects.Point(0,1), objects.Point(0,2))
    self.assertEqual(dist, 1)
    overlap = funcs_objects.circles_overlap(objects.Circle(objects.Point(1,0), 4), objects.Circle(objects.Point(2,0), 2))
    self.assertEqual(overlap, True)
Example #6
0
 def test_circle(self):
    p = objects.Circle(objects.Point(.3, .2), 6)
    self.assertAlmostEqual(p.point.x, .3)
    self.assertAlmostEqual(p.point.y, .2)
    self.assertEqual(p.radius, 6)
    dist = funcs_objects.distance(objects.Point(2,4), objects.Point(10,-5))
    self.assertAlmostEqual(dist, 12.041594578792296)
    circle_1 = objects.Circle(objects.Point(2,4), 2)
    circle_2 = objects.Circle(objects.Point(10,-5), 3)
    overlap = funcs_objects.circles_overlap(circle_1, circle_2)
    self.assertEqual(overlap, False)
Example #7
0
 def test_circles_overlap_2(self):
     point1 = objects.Point(1.0, 1.0)
     point2 = objects.Point(5.0, 10.0)
     circle1 = objects.Circle(point1, 3)
     circle2 = objects.Circle(point2, 2)
     self.assertFalse(funcs_objects.circles_overlap(circle1, circle2))
Example #8
0
 def test_circles_overlap_1(self):
     point1 = objects.Point(0.0, 1.0)
     point2 = objects.Point(2.0, 3.0)
     circle1 = objects.Circle(point1, 3)
     circle2 = objects.Circle(point2, 6)
     self.assertTrue(funcs_objects.circles_overlap(circle1, circle2))
Example #9
0
 def test_circles_overlap2(self):
     c1 = objects.circle(objects.point(2, 2), 3)
     c2 = objects.circle(objects.point(2, 2), 5)
     c3 = funcs_objects.circles_overlap(c1, c2)
     self.assertTrue(c3, True)
Example #10
0
 def test_circles_overlap(self):
     circle3 = objects.circle(objects.point(0, 0), 1)
     circle4 = objects.circle(objects.point(0, 0), 1)
     circle4 = funcs_objects.circles_overlap(circle3, circle4)
     self.assertTrue(circle4, True)