def test_contains(self): for rdggs in [WGS84_003, WGS84_003_RADIANS]: # A cell should contain its nucleus, but not my test point p. # Assume that nucleus() and vertices() work. for suid in [[N, 3, 1], [P, 5, 7, 5, 1, 3], [S, 0]]: c = Cell(rdggs, suid) w = c.width() for plane in [True, False]: nucleus = c.nucleus(plane=plane) vertices = c.vertices(plane=plane) p = (max([v[0] for v in vertices]) + 1, vertices[3][1]) self.assertTrue(c.contains(nucleus, plane=plane)) self.assertFalse(c.contains(p, plane=plane))
def test_random_point(self): # Output should lie in the cell at least. for E in [WGS84_ASPHERE_RADIANS, WGS84_ELLIPSOID]: rdggs = RHEALPixDGGS(E) for plane in [True, False]: c = Cell(rdggs, [N, 8, 7]) p = c.random_point(plane=plane) self.assertTrue( c.contains(p, plane=plane) ) # ------------------------------------------------------------------------------