def test(self): self.box = ((-10, -10), (10, 10)) for i in range(1000): point1 = random.uniform(-20, 20), random.uniform(-20, 20) point2 = random.uniform(-20, 20), random.uniform(-20, 20) line = (point1, point2) line, status = clip.line_with_rect(line, self.box) if self.intersects(point1, point2): assert status else: assert status is False
def test(self): self.box = ((-10, -10), (10, 10)) from dials.algorithms.polygon import clip for i in range(1000): point1 = random.uniform(-20, 20), random.uniform(-20, 20) point2 = random.uniform(-20, 20), random.uniform(-20, 20) line = (point1, point2) line, status = clip.line_with_rect(line, self.box) if self.intersects(point1, point2): assert (status) else: assert (status == False)
def __call__(self): from random import uniform from dials.algorithms.polygon import clip for i in range(1000): point1 = uniform(-20, 20), uniform(-20, 20) point2 = uniform(-20, 20), uniform(-20, 20) line = (point1, point2) line, status = clip.line_with_rect(line, self.box) if self.intersects(point1, point2): assert (status) else: assert (status == False) print 'OK'
def __call__(self): from random import uniform from dials.algorithms.polygon import clip for i in range(1000): point1 = uniform(-20, 20), uniform(-20, 20) point2 = uniform(-20, 20), uniform(-20, 20) line = (point1, point2) line, status = clip.line_with_rect(line, self.box) if self.intersects(point1, point2): assert(status == True) else: assert(status == False) print 'OK'