Api reference

The package’s functionality is split into a fuction and a class:

polygonation.is_convex(polygon: Iterable)bool[source]

Evaluates if a polygon is convex or not.

Parameters
polygon

Iterable of points (x, y) in order as they appear in the polygon.

Returns
True if the polynomial is convex, False if it is not.

Notes

Implementation: convexness is checked by ‘driving around the polygon’. Convex means ‘never steer to the left’ or ‘never steer to the right’. No checks are done for complex cases such as self-intersecting polygons etc.

polygonation.Polygonate(points: Iterable, *, pickedge: str = '', convex: bool = True)[source]

Tessellate a set of points with a set of non-overlapping polygons.

Parameters
points

Iterable of points (x, y).

pickedge{‘actue’, ‘long’, ‘round’}, optional

‘acute’ to remove the most acute angle first; ‘long’ to remove the longest edge first; ‘round’ to remove edge to create polygon with roundest corners.

convexbool, optional

True if polygons must be convex (default).

Attributes
pointsndarray of (x, y)

The (x, y) coordinates of the points.

shapesndarray of ndarray of ints

The point-indices of the vertices of each shape.

neighborsndarray of ndarray of ints

The neighbors of each shape.