Polygon manipulation

Functions on polygons, that is, 2D polyhedra.

pypoman.polygon.compute_polygon_hull(B: ndarray, c: ndarray) List[ndarray]

Compute the vertex representation of a polygon.

The polygon is defined by:

\[B x \leq c\]

where \(x\) is a 2D vector.

Parameters:
  • B – Linear inequality matrix of size \(2 \times K\).

  • c – Linear inequality vector.

Returns:

List of 2D vertices in counterclockwise order.

pypoman.polygon.plot_polygon(points: ndarray, alpha: float = 0.4, color: str = 'g', linestyle: str = 'solid', fill: bool = True, linewidth: float | None = None, resize: bool = False) None

Plot a polygon in matplotlib.

Parameters:
  • points – Array or list of points.

  • alpha – Transparency value.

  • color – Color in matplotlib format.

  • linestyle – Line style in matplotlib format.

  • fill – When True, fills the area inside the polygon.

  • linewidth – Line width in matplotlib format.

  • resize – When True, resets axis limits to center on the polygon.