Polygon¶
- class Polygon(vertices: List[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]])¶
Shape defined by a list of vertices in a 2D plane
- Attributes:
- verticesList[array_like]
Must be defined in clockwise or counterclockwise order.
Attributes
lattice_offset
vertices
Methods
_pybind11_conduit_v1_
contains
(x, y, z)Return
True
if the given position is located within the shapeplot
([ax])Line plot of the polygon
with_offset
(vector)Return a copy that's offset by the given vector
- contains(x: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]'], y: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]'], z: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]'])¶
Return
True
if the given position is located within the shapeGiven arrays as input the return type is a boolean array.
- Parameters:
- x, y, zarray_like
Positions to test against the shape.
- plot(ax: Axes | None = None, **kwargs) None ¶
Line plot of the polygon
- Parameters:
- axOptional[plt.Axes]
The axis to plot on.
- **kwargs
Forwarded to
matplotlib.pyplot.plot()
.