Exemplo n.º 1
0
def test_TriangleWithConvexQuad_non_intersecting():
    for i in range(10000):

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

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

        # Ensure we no vertices
        assert len(result) == 0
Exemplo n.º 2
0
def test_TriangleWithConvexQuad_intersecting():
    for i in range(10000):

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

        # Do the clipping
        result = clip.triangle_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)])
Exemplo n.º 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(3, 4)

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

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

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

            # Do the clipping
            result = clip.triangle_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)]))
Exemplo n.º 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(3, 4)

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

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

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

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

      # Do the clipping
      result = clip.triangle_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'