Union object is the high level class for representing unions of convex sets. The union can be comprised of any sets derived from the
ConvexSet class, such as
Polyhedron objects. To construct the
Union object, it suffices to provide the sets concatenated in an array as an argument:
The same applies for
To create union that combines
YSet objects, one can employ
add method, for instance
Note that the sets do not have to be in the same dimension. In the above example, the set "S" is in dimension 2 whereas the set "P" is in the dimension 3. Other sets can be added using the
add method, e.g.
The set can be also removed from the union. This is achieved with
remove method by referring to the index of the set to remove, e.g.
It is possible to store arbitrary data with the
Union object. The user data can be provided in the extended syntax at the time of construction, e.g.
or attached after creation of the object
There are three properties of the
Num- indicates the number of sets in the union
Set- stored sets of the union in a cell array
Data- place for storing arbitrary user data with the union
The properties can be accessed by referring to their names, i.g.
Data property can be modified after the object has been created, other properties are not changeable. The properties are useful when extracting information about the union, for instance, consider the union of a box and a circle:
The total number of sets in the union is given by the property
and the individual sets can be acessed by index in the
Set property in the order as they were stored
PolyUnion objects represents unions of polyhedra in the same dimension. The dimension check is the only requirement for construction of
PolyUnion objects. To construct a
PolyUnion object an union one has to supply an array of polyhedra in the same dimension. In the next example it is shown how to construct an union of three intervals in dimension one:
In this example an union of two polyhedra is constructed in dimension 2 - the first polyhedron is in V-representation and the second in H-representation:
The dimension of the
PolyUnion object can be retrieved from
other properties are inherited from the
Num- the number of polyhedra in the union,
Set- stored polyhedra in a polyhedron array,
Data- arbitrary user data stored.
The number of sets forming in the union can be read in
Num property, i.e.
To access the individual sets from the
PolyUnion object one can use the
Set property, for instance the second polyhedron can be read by pointing to it with index 2:
If other user data have been stored with the object, it can be accessed in
Polyhedra can be added/removed from the
PolyUnion object. To add new polyhedra to the union, the dimension must be retained and the added polyhedron must not be empty:
Removing the polyhedron from the
PolyUnion object is based on an index of the set which to remove, i.e.
For the usage in computational geometry it is of intereset to exploit the properties of the union of polyhedra, such as convexity and overlaps. If these properties are know at the time of the construction of the
PolyUnion object, one can associate these properties directly to the union. The following properties can be attached to the
Convex- logical flag indicating if the union convex or not
Overlaps- logical flag indicating if the polyhedra in union overlap or not
FullDim- logical flag indicating if the union is build from just from full-dimensial polyhedra or not
Bounded- logical flag indicating if the union is build from just from bounded polyhedra or not
Connected- logical flag indicating if the union convex is connected or disconnected
For instance, in the next example the union of polyhedra is build only from bounded polyhedra that are connected, not-overlapping and build a convex union
Example of a non-convex union:
If the properties of the union are not provided at the construction, the
PolyUnion class contains methods for determining convexity, overlaps, connectivity, full-dimensionality and boundedness. Please note, that some of these methods are computationally expensive and the computation may be time consuming:
Consider the following example, which is constructed out of four polyhedra without specifying any properties. The convexity, overlaps, connectivity, full-dimensionality and boundedness properties of the union can be obtained as
Back to computational geometry overview.