Esempio n. 1
0
 def setUp(self):
     self.qn = _QuadNode(
         [_Node(99, 3, 7, 2, 0, "red"),
          _Node(100, 2, 9, 3, 0, "blue")], 5, 50)
     cells = {}
     self.x, self.y = (3, 3)
     self.num_x, self.num_y = 5, 5
     self.min_x, self.min_y = 0, 0
     self.max_size = 1.5
Esempio n. 2
0
    def test_get_nodes_just_outside_box(self):
        others = [
            _Node(0, 6, 4.9, 1, 7, "blue"),
            _Node(1, 4, 4, 1, -1, "blue"),
            _Node(2, 4, 7.1, 1, -1, "blue"),
            _Node(3, 11, 7.1, 1, -1, "blue"),
            _Node(4, 7.1, 11, 1, -1, "blue"),
            _Node(5, 6, 6, 1, -1, "blue"),
            _Node(6, 9, 9, 1, -1, "blue"),
            _Node(7, 2.5, 7.1, 1, -1, "blue"),
            _Node(8, 7.1, 15, 1, -1, "blue"),
            _Node(9, 7.1, -3, 1, -1, "blue"),
        ]
        local_quad = _QuadNode(
            [_Node(99, 5, 5, 1, 0, "red"),
             _Node(100, 10, 10, 1, 0, "blue")], 5, 50)
        just_outside = local_quad.get_nodes_near_lines(others)

        self.assertEqual(5, len(just_outside))
Esempio n. 3
0
 def setUp(self):
     self.qn = _QuadNode(
         [_Node(99, 3, 7, 2, 0, "red"),
          _Node(100, 2, 9, 3, 0, "blue")], 5, 50)