def testGridComplex(self):
    top_left      = self.makePoints((0, 0), (0, 1),
                                    (1, 0), (1, 1),
                                    (2, 0), (2, 1))
    top_middle    = self.makePoints((0, 2), (0, 3),
                                    (1, 2), (1, 3),
                                    (2, 2), (2, 3))
    top_right     = self.makePoints((0, 4), (0, 5),
                                    (1, 4), (1, 5),
                                    (2, 4), (2, 5))
    bottom_left   = self.makePoints((3, 0), (3, 1),
                                    (4, 0), (4, 1),
                                    (5, 0), (5, 1))
    bottom_middle = self.makePoints((3, 2), (3, 3),
                                    (4, 2), (4, 3),
                                    (5, 2), (5, 3))
    bottom_right  = self.makePoints((3, 4), (3, 5),
                                    (4, 4), (4, 5),
                                    (5, 4), (5, 5))

    points = (top_left + top_middle + top_right +
              bottom_left + bottom_middle + bottom_right)
    grid = geo.grid(geo.Rect(6, 6, 0, 0), 2, 3, points)

    self.assertEqual([top_left, top_middle, top_right,
                      bottom_left, bottom_middle, bottom_right], grid)
示例#2
0
 def testGridDiscardsPointsOutsideArea(self):
     points = self.makePoints(
         (0, 0),  # The only point inside the area.
         (-10, 0),
         (10, 0),
         (0, -10),
         (0, 10))
     grid = geo.grid(geo.Rect(1, 1, -1, -1), 1, 1, points)
     self.assertEqual([[points[0]]], grid)
示例#3
0
    def testGridComplex(self):
        top_left = self.makePoints((0, 0), (0, 1), (1, 0), (1, 1), (2, 0),
                                   (2, 1))
        top_middle = self.makePoints((0, 2), (0, 3), (1, 2), (1, 3), (2, 2),
                                     (2, 3))
        top_right = self.makePoints((0, 4), (0, 5), (1, 4), (1, 5), (2, 4),
                                    (2, 5))
        bottom_left = self.makePoints((3, 0), (3, 1), (4, 0), (4, 1), (5, 0),
                                      (5, 1))
        bottom_middle = self.makePoints((3, 2), (3, 3), (4, 2), (4, 3), (5, 2),
                                        (5, 3))
        bottom_right = self.makePoints((3, 4), (3, 5), (4, 4), (4, 5), (5, 4),
                                       (5, 5))

        points = (top_left + top_middle + top_right + bottom_left +
                  bottom_middle + bottom_right)
        grid = geo.grid(geo.Rect(6, 6, 0, 0), 2, 3, points)

        self.assertEqual([
            top_left, top_middle, top_right, bottom_left, bottom_middle,
            bottom_right
        ], grid)
示例#4
0
 def testGridSimple(self):
     points = self.makePoints((0, 0), (0, 1), (1, 0), (1, 1))
     grid = geo.grid(geo.Rect(2, 2, 0, 0), 2, 2, points)
     self.assertEqual([[points[0]], [points[1]], [points[2]], [points[3]]],
                      grid)
 def testGridDiscardsPointsOutsideArea(self):
   points = self.makePoints((0, 0),  # The only point inside the area.
                            (-10, 0), (10, 0), (0, -10), (0, 10))
   grid = geo.grid(geo.Rect(1, 1, -1, -1), 1, 1, points)
   self.assertEqual([[points[0]]], grid)
 def testGridSimple(self):
   points = self.makePoints((0, 0), (0, 1),
                            (1, 0), (1, 1))
   grid = geo.grid(geo.Rect(2, 2, 0, 0), 2, 2, points)
   self.assertEqual([[points[0]], [points[1]], [points[2]], [points[3]]],
                     grid)