Esempio n. 1
0
    def test_five(self):
        pts = [(20, 10), (90, 50), (60, 80), (70, 30), (40, 100)]

        tree = generate(pts)
        self.assertEqual(60, tree.root.point[X])

        # on X-coordinate
        self.assertEqual(20, tree.root.below.point[X])
        self.assertEqual(70, tree.root.above.point[X])
Esempio n. 2
0
    def test_five(self):
        pts = [(20, 10), (90, 50), (60, 80), (70, 30), (40, 100)]

        tree = generate(pts)
        self.assertEqual(60, tree.root.point[X])

        # on X-coordinate
        self.assertEqual(20, tree.root.below.point[X])
        self.assertEqual(70, tree.root.above.point[X])    
Esempio n. 3
0
    def test_three(self):
        pts = [(20, 10), (90, 50), (60, 80)]

        tree = generate(pts)
        self.assertEqual(60, tree.root.point[X])

        # on X-coordinate
        self.assertEqual(20, tree.root.below.point[X])
        self.assertEqual(90, tree.root.above.point[X])

        # regions
        self.assertEqual(60, tree.root.below.region.x_max)
Esempio n. 4
0
    def test_three(self):
        pts = [(20, 10), (90, 50), (60, 80)]

        tree = generate(pts)
        self.assertEqual(60, tree.root.point[X])

        # on X-coordinate
        self.assertEqual(20, tree.root.below.point[X])
        self.assertEqual(90, tree.root.above.point[X])

        # regions
        self.assertEqual(60, tree.root.below.region.x_max)
Esempio n. 5
0
 def rebalance(self):
     """Rebalance points in tree"""
     points = [p for p in self.tree]
     if points:
         self.tree = kd_factory.generate(points)
         self.paint()
Esempio n. 6
0
 def rebalance(self):
     """Rebalance points in tree"""
     points = [p for p in self.tree]
     if points:
         self.tree = kd_factory.generate(points)
         self.paint()