示例#1
0
 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
示例#2
0
    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)
示例#3
0
    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'
示例#4
0
  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'