Skip to content

A python implement for dividing polygon algorithm.

Notifications You must be signed in to change notification settings

sean2077/divide_polygon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

divide_polygon

A python implement for dividing polygon algorithm.

def divide_polygon(poly: _Polygon, n: int, idx: int, in_place=False) -> List[_Segment]:
    """Divede polygon with lines parallel with its idx-th edge.

    Args:
        poly (_Polygon): counterclockwise polygon with edge p[0]p[-1] on y axis.
        n (int): number of parts to divide polygon into.
        idx (int): index of edge to be paralleled with.
        in_place (bool, optional): whether to operate in place (If true, input data would be changed). Defaults to False.

    Returns:
        List[_Segment]: dividing segments
    """

Effect Picture

divide into 2 parts:

divide_2

divide into 3 parts:

divide_3

divide into 4 parts:

divide_4

divide into 5 parts:

divide_5

About

A python implement for dividing polygon algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages