Example #1
0
def test_QuadWithConvexQuad_non_intersecting():
    for i in range(10000):

        # Generate nonintersecting polygons
        subject, target = generate_non_intersecting(4, 4)

        # Do the clipping
        result = clip.quad_with_convex_quad(subject, target)

        # Ensure we no vertices
        assert len(result) == 0
Example #2
0
def test_QuadWithConvexQuad_intersecting():
    for i in range(10000):

        # Generate intersecting polygons
        subject, target = generate_intersecting(4, 4)

        # Do the clipping
        result = clip.quad_with_convex_quad(subject, target)

        # Ensure we have roughly valid number of vertices
        assert len(result) >= 3
        assert len(result) >= min([len(subject), len(target)])
Example #3
0
    def test_non_intersecting(self):
        from dials.algorithms.polygon import clip

        for i in range(10000):

            # Generate nonintersecting polygons
            subject, target = generate_non_intersecting(4, 4)

            # Do the clipping
            result = clip.quad_with_convex_quad(subject, target)

            # Ensure we no vertices
            assert (len(result) == 0)
Example #4
0
    def test_intersecting(self):
        from dials.algorithms.polygon import clip
        for i in range(10000):

            # Generate intersecting polygons
            subject, target = generate_intersecting(4, 4)

            # Do the clipping
            result = clip.quad_with_convex_quad(subject, target)

            # Ensure we have roughly valid number of vertices
            assert (len(result) >= 3)
            assert (len(result) >= min([len(subject), len(target)]))
Example #5
0
  def tst_non_intersecting(self):
    from dials.algorithms.polygon import clip

    for i in range(10000):

      # Generate nonintersecting polygons
      subject, target = generate_non_intersecting(4, 4)

      # Do the clipping
      result = clip.quad_with_convex_quad(subject, target)

      # Ensure we no vertices
      assert(len(result) == 0)

    print 'OK'
Example #6
0
  def tst_intersecting(self):
    from dials.algorithms.polygon import clip
    for i in range(10000):

      # Generate intersecting polygons
      subject, target = generate_intersecting(4, 4)

      # Do the clipping
      result = clip.quad_with_convex_quad(subject, target)

      # Ensure we have roughly valid number of vertices
      assert(len(result) >= 3)
      assert(len(result) >= min([len(subject), len(target)]))

#            for v in result:
#                assert(point_in_polygon(v, clip))

    print 'OK'