add

Purpose

Insert Polyhedron to PolyUnion object.

Syntax

U = add(U,P)
U.add(P)

Description

Insert the Polyhedron object inside the existing PolyUnion object. The polyhedron P can be given as an array. Each element of the array is stored under PolyUnion.Set property which can be accessed later for usage. Any polyhedron P that is empty, it is not added to the union. If the PolyUnion object has been created with some properties, such as: Convex, Overlaps, Connected, Bounded, and FullDim, then any polyhedron to be added is checked for this property. If the union created by merging of the existing polyhedra and the new polyhedra P does not satisfy any of these properties, an error message is thrown.

Input Arguments

U

The object of the PolyUnion class.

Class: PolyUnion

P

A Polyhedron or an array of polyhedra to be added to the union.

Class: Polyhedron

Output Arguments

U

Union of the sets.

Class: Union

Example(s)

Example 1

Construct PolyUnion object by triangulating a zonotope.
Z = ExamplePoly.randZono;
Triangulate the zonotope Z. 
 T = Z.triangulate 
Array of 8 polyhedra.
We know that the polyhedra T are not overlapping, bounded and in full-dimension. We can create a union of first four polyhedra
 U = PolyUnion('Set',T(1:4),'Overlaps',false,'Bounded',true,'FullDim',true) 
PolyUnion in the dimension 2 with 4 polyhedra.
Properties of the union: 
  Overlaps: 0
  Bounded: 1
  FullDim: 1
Functions : none
Plot the union
 U.plot 

../../../../../../fig/mpt/modules/geometry/unions/@PolyUnion/add_img_1.png

To add the remainining polyhedra is not a problem because the properties are fulfilled.
 U.add(T(5:end)) 
PolyUnion in the dimension 2 with 8 polyhedra.
Properties of the union: 
  Overlaps: 0
  Bounded: 1
  FullDim: 1
Functions : none
We can plot the union
 U.plot 

../../../../../../fig/mpt/modules/geometry/unions/@PolyUnion/add_img_2.png

See Also

union


© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch