imforge.utils module¶
-
imforge.utils.
clip_polygon
(polygon, width, height)¶ Clip given polygon with rectangle of given width and height.
-
imforge.utils.
is_clockwise
(polygon, check_convexity=False)¶ Return whether or not given polygon is clockwise oriented or not.
If
check_convexity
is False (the default), it’s assumed that given polygon is convex, so we only check for orientation based on the first vertex. Ifcheck_convexity
is True, then we check orientation for all vertices and they must all have the same orientation (i.e. the polygon is convex)- Parameters
- Returns
True
if polygon is clockwise oriented.False
if it is counterclockwise oriented.- Return type
- Raises
if polygon does not contain at least 3 distinct vertices
if
check_convexity
is True, and the polygon is not convexif 3 consecutive vertices of polygon are aligned