mpt4py.geometry.visualization package#
Submodules#
mpt4py.geometry.visualization.plot module#
Plotting protocol for MPT library.
- class mpt4py.geometry.visualization.plot.PlotterProtocol[source]#
Bases:
ABC- abstractmethod plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = None, opacity: float | None = 1.)[source]#
- abstractmethod plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
- class mpt4py.geometry.visualization.plot.PolyhedralPlottingData(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None)[source]#
Bases:
objectRepresents the data needed to plot a polyhedron.
The representation is always in 3d. A 2d polyhedron will be represented as a single facet with an affine hull of z=0.
- property affine_hull: Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]#
Returns \(p_0, A_e\), Basis such that \(A_e * (x - p_0) = 0\) and \(x = B * \lambda\) for all \(x\in P\).
- combined_points: ndarray[tuple[Any, ...], dtype[float64]]#
- property extreme_points: Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]#
Returns (Vertices, Rays)
- property extreme_rays: ndarray[tuple[Any, ...], dtype[float64]]#
Returns the extreme rays (irredundant rays)
- facet_eqns: ndarray[tuple[Any, ...], dtype[float64]]#
- facets: List[ndarray[tuple[Any, ...], dtype[int64]]]#
- hull: ConvexHull#
- property num_extreme_rays#
- property num_facets#
- property num_vertices#
- points: ndarray[tuple[Any, ...], dtype[float64]]#
- ray_length: float = 1.0#
- rays: ndarray[tuple[Any, ...], dtype[float64]]#
- property vertices: ndarray[tuple[Any, ...], dtype[float64]]#
Returns vertices
mpt4py.geometry.visualization.plot_matplotlib module#
Matplotlib plotting backend for MPT.
Implement the PlotterProtocol.
- class mpt4py.geometry.visualization.plot_matplotlib.MatplotlibPlotter(ax: Axes | None = None)[source]#
Bases:
PlotterProtocol- plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = 'blue', opacity: float | None = 1., show_edges: bool | None = True, edge_width: float | None = 1., edge_color: str | None = 'black', show_vertices: bool | None = False, vertex_size: float | None = 20., vertex_color: str | None = 'black', **kwargs)[source]#
- plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
mpt4py.geometry.visualization.plot_pyvista module#
pyVista plotting backend for MPT.
Implement the PlotterProtocol.
- class mpt4py.geometry.visualization.plot_pyvista.PyvistaPlotter(plotter: Plotter | None = None)[source]#
Bases:
PlotterProtocol- plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = True, edge_width: float | None = 1., edge_color: str | None = 'black', show_vertices: bool | None = False, vertex_size: float | None = 10., vertex_color: str | None = 'black', **kwargs)[source]#
- plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
Module contents#
- class mpt4py.geometry.visualization.MatplotlibPlotter(ax: Axes | None = None)[source]#
Bases:
PlotterProtocol- plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = 'blue', opacity: float | None = 1., show_edges: bool | None = True, edge_width: float | None = 1., edge_color: str | None = 'black', show_vertices: bool | None = False, vertex_size: float | None = 20., vertex_color: str | None = 'black', **kwargs)[source]#
- plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
- class mpt4py.geometry.visualization.PlotterProtocol[source]#
Bases:
ABC- abstractmethod plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = None, opacity: float | None = 1.)[source]#
- abstractmethod plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
- class mpt4py.geometry.visualization.PolyhedralPlottingData(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None)[source]#
Bases:
objectRepresents the data needed to plot a polyhedron.
The representation is always in 3d. A 2d polyhedron will be represented as a single facet with an affine hull of z=0.
- property affine_hull: Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]#
Returns \(p_0, A_e\), Basis such that \(A_e * (x - p_0) = 0\) and \(x = B * \lambda\) for all \(x\in P\).
- combined_points: ndarray[tuple[Any, ...], dtype[float64]]#
- property extreme_points: Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]#
Returns (Vertices, Rays)
- property extreme_rays: ndarray[tuple[Any, ...], dtype[float64]]#
Returns the extreme rays (irredundant rays)
- facet_eqns: ndarray[tuple[Any, ...], dtype[float64]]#
- facets: List[ndarray[tuple[Any, ...], dtype[int64]]]#
- hull: ConvexHull#
- property num_extreme_rays#
- property num_facets#
- property num_vertices#
- points: ndarray[tuple[Any, ...], dtype[float64]]#
- ray_length: float = 1.0#
- rays: ndarray[tuple[Any, ...], dtype[float64]]#
- property vertices: ndarray[tuple[Any, ...], dtype[float64]]#
Returns vertices
- class mpt4py.geometry.visualization.PyvistaPlotter(plotter: Plotter | None = None)[source]#
Bases:
PlotterProtocol- plot_convexhull(points: ndarray[tuple[Any, ...], dtype[float64]], rays: ndarray[tuple[Any, ...], dtype[float64]] | None = None, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = True, edge_width: float | None = 1., edge_color: str | None = 'black', show_vertices: bool | None = False, vertex_size: float | None = 10., vertex_color: str | None = 'black', **kwargs)[source]#
- plot_ellipsoid(P: ndarray[tuple[Any, ...], dtype[float64]], c: ndarray[tuple[Any, ...], dtype[float64]] | None = None, r: float = 1.0, color: str | None = 'lightblue', opacity: float | None = 1., show_edges: bool | None = False, line_width: float | None = 2, edge_color: str | None = 'black')[source]#
- mpt4py.geometry.visualization.get_plotter(plotter_name: str | None = None) PlotterProtocol[source]#
Get a plotter object based on the specified backend.