mpt4py.geometry.union package#
Submodules#
mpt4py.geometry.union.polyunion module#
- class mpt4py.geometry.union.polyunion.PolyUnion(*polyhedra: Polyhedron, convex: bool | None = None, overlaps: bool | None = None, connected: bool | None = None, bounded: bool | None = None, fulldim: bool | None = None)[source]#
Bases:
ConvexSetUnionRepresent a union of polyhedra (represented in the same dimension).
- add(polyhedron: Polyhedron)[source]#
Add a polyhedron to the union.
- convex_hull() Polyhedron[source]#
Compute the convex hull for union of polyhedra.
The convex hull of the union of polyhedra is defined as the minimal convex set that contains all polyhedra.
- Returns:
the convex hull of the union of polyhedra.
- Return type:
- fplot(ax: Axes | Plotter, func_name: str | None = None, **kwargs)[source]#
Plot the functions associated with the polyunion.
- property is_bounded: bool#
Determine if the union is built from bounded polyhedra.
- property is_connected: bool#
Determine if the union of polyhedra form a connected union.
- property is_convex: bool#
Determine if the union of polyhedra is convex.
Warning
This method is very computationally demanding and is suitable for unions with small number of polyhedra.
- property is_full_dim: bool#
Determine if the union is built from full-dimensional polyhedra.
- property is_overlapping: bool#
Determine if the union of polyhedra is overlapping.
Note
This function considers following two cases to detect overlaps:
1. If two full-dimensional polyhedra overlap, then the intersection of these polyhedra must be full-dimensional.
2. If low-dimensional and full-dimensional polyhedra overlap, then the intersection of these polyhedra must not be empty.
Warning
This method is computationally demanding and is suitable for unions with small number of polyhedra.
- merge()[source]#
Simplify the union of polyhedra by merging the neighboring polyhedra if their union is convex. The algorithm cycles through the regions and checks if any two regions form a convex union. If so, the algorithm combines them in one region, and continues checking the remaining regions. To improve the solution, multiple merging loops can be enabled in options.
mpt4py.geometry.union.union module#
- class mpt4py.geometry.union.union.ConvexSetUnion(*convex_sets: ConvexSet)[source]#
Bases:
objectRepresents a general union of convex sets.
- contains(x: ndarray[tuple[Any, ...], dtype[float64]], fastbreak: bool = False) Tuple[bool, List[int]][source]#
Test if the point x is in the union of convex sets.
- Parameters:
x (Vector) – A point with the same dimension as the convex sets.
fastbreak (bool) – Do a quick stop in the consecutive search when x is contained in the first set it founds. Defaults to False.
- Returns:
whether x is in the union of convex sets or not, and the indices of the sets that contain x.
- Return type:
Tuple[bool, List[int]]
- property dim: int#
Returns the dimension of the convex sets in the union.
- property num_sets: int#
Returns the number of convex sets in the union.
Module contents#
- class mpt4py.geometry.union.ConvexSetUnion(*convex_sets: ConvexSet)[source]#
Bases:
objectRepresents a general union of convex sets.
- contains(x: ndarray[tuple[Any, ...], dtype[float64]], fastbreak: bool = False) Tuple[bool, List[int]][source]#
Test if the point x is in the union of convex sets.
- Parameters:
x (Vector) – A point with the same dimension as the convex sets.
fastbreak (bool) – Do a quick stop in the consecutive search when x is contained in the first set it founds. Defaults to False.
- Returns:
whether x is in the union of convex sets or not, and the indices of the sets that contain x.
- Return type:
Tuple[bool, List[int]]
- property dim: int#
Returns the dimension of the convex sets in the union.
- property num_sets: int#
Returns the number of convex sets in the union.
- class mpt4py.geometry.union.PolyUnion(*polyhedra: Polyhedron, convex: bool | None = None, overlaps: bool | None = None, connected: bool | None = None, bounded: bool | None = None, fulldim: bool | None = None)[source]#
Bases:
ConvexSetUnionRepresent a union of polyhedra (represented in the same dimension).
- add(polyhedron: Polyhedron)[source]#
Add a polyhedron to the union.
- convex_hull() Polyhedron[source]#
Compute the convex hull for union of polyhedra.
The convex hull of the union of polyhedra is defined as the minimal convex set that contains all polyhedra.
- Returns:
the convex hull of the union of polyhedra.
- Return type:
- fplot(ax: Axes | Plotter, func_name: str | None = None, **kwargs)[source]#
Plot the functions associated with the polyunion.
- property is_bounded: bool#
Determine if the union is built from bounded polyhedra.
- property is_connected: bool#
Determine if the union of polyhedra form a connected union.
- property is_convex: bool#
Determine if the union of polyhedra is convex.
Warning
This method is very computationally demanding and is suitable for unions with small number of polyhedra.
- property is_full_dim: bool#
Determine if the union is built from full-dimensional polyhedra.
- property is_overlapping: bool#
Determine if the union of polyhedra is overlapping.
Note
This function considers following two cases to detect overlaps:
1. If two full-dimensional polyhedra overlap, then the intersection of these polyhedra must be full-dimensional.
2. If low-dimensional and full-dimensional polyhedra overlap, then the intersection of these polyhedra must not be empty.
Warning
This method is computationally demanding and is suitable for unions with small number of polyhedra.
- merge()[source]#
Simplify the union of polyhedra by merging the neighboring polyhedra if their union is convex. The algorithm cycles through the regions and checks if any two regions form a convex union. If so, the algorithm combines them in one region, and continues checking the remaining regions. To improve the solution, multiple merging loops can be enabled in options.