예제 #1
0
파일: test.py 프로젝트: reuf/point-location
    def testMinTriangle(self):
        points = randomConvexPolygon(10, k=20).points
        interior = minTriangle(points)
        exterior = boundingTriangle(points)

        # Plot points
        plotPoints(points, style='ro')

        # Plot bounding triangle
        plot(interior, style='go-')
        show(exterior, style='bo-')
예제 #2
0
            def add_bounding_triangle(poly):
                """
                    Calculates a bounding triangle for a polygon

                    Arguments:
                    poly -- a polygon to-be bound

                    Returns: a bounding polygon for 'poly'
                """

                bounding_tri = min_triangle.boundingTriangle(poly.points)
                bounding_regions = spatial.triangulatePolygon(
                    bounding_tri, hole=poly.points)
                return bounding_tri, bounding_regions