Just like cones, polyhedra have two descriptions. One description as the convex hull of finitely many points (and optionally rays and lineality), the V-representation. Another description as the intersection of finitely many half-spaces, the H-representation. Using the method convexHull we can create a polyhedron in 2-space which is the convexHull of a given set of points.
|
|
Polyhedra uses the principle of lazy evaluation: Properties of the combinatorial objects are only computed on demand and then they are stored with the object. For example we can ask for the vertices of P using vertices:
|
Here we see that the point (0,1) is not a vertex and P is actually a triangle.
|
This gives the defining affine half-spaces, i.e. P is given by all p such that HS*p <= v and that lie in the defining affine hyperplanes. The rows of the matrix HS are the outer normals of the polyhedron P. To get the defining hyperplanes we use:
|
There are none, so the polyhedron is of full dimension. It is also compact, since P has no rays and the lineality space is of dimension zero.
|
|
|
|
|
Internally, polyhedra are realized as cones, by embedding the polyhedron at height one and then taking the positive hull. To get at this cone, use cone. The height is the first coordinate of the rays of the cone, comparing the matrices of rays and vertices for the example one can see the correspondence:
|
|
|
We can also construct the convex hull of a set of points and a set of rays.
|
|
|
|
This polyhedron is not compact anymore and also not of full dimension.
|
|
|
|
On the other hand we can construct a polyhedron as the intersection of affine half-spaces and affine hyperplanes, given via inequalities and equations:
|
|
|
|
|
This is a triangle in 3-space with the following vertices.
|
|
If we don't intersect with the hyperplane we get a full dimensional polyhedron.
|
|
|
|
Note that the vertices are given modulo the lineality space. Besides constructing polyhedra by hand, there are also some basic polyhedra implemented such as the hypercube, in this case with edge-length four.
|
|
Another on is the crossPolytope, in this case with diameter six.
|
|
Furthermore the standard simplex (stdSimplex).
|
|
Now that we can construct polyhedra, we can turn to the functions that can be applied to polyhedra. First of all, we can apply the convexHull function also to a pair of polyhedra:
|
|
Or we can intersect them by using intersection:
|
|
Furthermore, both functions can be applied to a list containing any number of polyhedra and matrices defining vertices/rays or affine half-spaces/hyperplanes. All of these must be in the same ambient space. For example:
|
|
Further functions are for example the Minkowski sum (minkowskiSum) of two polyhedra.
|
|
|
In the other direction, we can also determine all Minkowski summands (see minkSummandCone) of a polyhedron.
|
|
Here the polyhedra in the hash table L are all possible Minkowski summands up to scalar multiplication and the columns of M give the minimal decompositions. So the hexagon P10 is not only the sum of two triangles but also the sum of three lines. Furthermore, we can take the direct product of two polyhedra.
|
|
The result is in QQ^4.
|
To find out more about this polyhedron use for example.
|
The function fVector gives the number of faces of each dimension, so it has 9 vertices, 18 edges and so on. We can access the faces of a certain codimension via:
|
|
|
We can compute all lattice points of the polyhedron with latticePoints.
|
|
Evenmore the tail/recession cone of a polyhedron with tailCone.
|
|
Finally, there is also a function to compute the polar of a polyhedron, i.e. all points in the dual space that are greater than -1 on all points of the polyhedron:
|
|