Package pygeodesy :: Module clipy
[frames] | no frames]

Module clipy

Functions to clip a path or polygon of LatLon points against a rectangular box or clip region.


Version: 19.11.04

Functions
 
clipCS3(points, lowerleft, upperright, closed=False, inull=False)
Clip a path against a rectangular clip box using the Cohen-Sutherland algorithm.
 
clipSH(points, corners, inull=False, closed=False)
Clip a polygon against a clip region or box using the Sutherland-Hodgman algorithm.
 
clipSH3(points, corners, inull=False, closed=False)
Clip a polygon against a clip region or box using the Sutherland-Hodgman algorithm.
Variables
  __all__ = _ALL_LAZY.clipy
Function Details

clipCS3(points, lowerleft, upperright, closed=False, inull=False)

 

Clip a path against a rectangular clip box using the Cohen-Sutherland algorithm.

Parameters:
  • points - The points (LatLon[]).
  • lowerleft - Bottom-left corner of the clip box (LatLon).
  • upperright - Top-right corner of the clip box (LatLon).
  • closed - Optionally, close the path (bool).
  • inull - Optionally, include null edges if inside (bool).
Returns:
Yield a ClipCS3Tuple(start, end, index) for each edge of the clipped path.
Raises:
  • ValueError - The lowerleft corner is not below and/or not to the left of the upperright corner.

clipSH(points, corners, inull=False, closed=False)

 

Clip a polygon against a clip region or box using the Sutherland-Hodgman algorithm.

Parameters:
  • points - The polygon points (LatLon[]).
  • corners - Three or more points defining a convex clip region (LatLon[]) or two points to specify a rectangular clip box.
  • inull - Optionally, include null edges (bool).
  • closed - Close the clipped points (bool).
Returns:
Yield the clipped points (LatLon[]).
Raises:
  • ValueError - Insufficient number of points or the corners specify a polar, zero-area, non-convex or otherwise invalid clip region.

clipSH3(points, corners, inull=False, closed=False)

 

Clip a polygon against a clip region or box using the Sutherland-Hodgman algorithm.

Parameters:
  • points - The polygon points (LatLon[]).
  • corners - Three or more points defining a convex clip region (LatLon[]) or two points to specify a rectangular clip box.
  • inull - Optionally, include null edges (bool).
  • closed - Close the clipped points (bool).
Returns:
Yield a ClipSH3Tuple(start, end, original) for each edge of the clipped polygon.
Raises:
  • ValueError - Insufficient number of points or the corners specify a polar, zero-area, non-convex or otherwise invalid clip region.