screen01a screen01b screen01c

The screenshot shows two polytopes and its Minkowski sum and is obtained by the following commands:

	P=cube(3);
	Q=ball(3);
	R=P+Q;
	plot(P);
	plot(Q);
	plot(R);

There are different options to enter a convex polyhedron:

V-representation: Finitely many points, for example \(0 \choose 3\), \(3 \choose 0\), \(2 \choose 2\), and finitely many directions, for example \(-1 \choose 0\), \(0 \choose -1\), are stored column-wise, respectively, in a field V and a field D of a structure rep:

	rep.V=[0 3; 3 0; 2 2]';
	rep.D=[-1 0;0 -1];

A polyhedron P is defined, where option 'v' indicates that rep is a V-represenation. The result is plotted:

	P=polyh(rep,'v');
	plot(P);


screen02

H-representation: A polyhedron P of the form \[ P=\{x \in \mathbb{R}^n |\; a \leq Bx \leq b,\; l \leq x \leq u\}\] is considered. For example, an H-representation for \[ P=\{x \in \mathbb{R}^2 |\; 2 \leq 2 x_1 + x_2,\; 2 \leq x_1 + 2 x_2,\, x_1 \geq 0\}\] can be enererd as

	clear rep;
	rep.B=[2 1; 1 2];
	rep.a=[2; 2];
	rep.l=[0; -Inf];

A polyhedron Q is defined, where option 'h' indicates that rep is an H-represenation. The result is plotted:

	Q=polyh(rep,'h');
	plot(Q);


screen03

Another calculus example: The intersection of P and Q is computed and stored in R. The result is plotted:

	R=P&Q;
	plot(R);


screen04

The Cartesian product of P and Q is computed and stored in S. The image of the 4-dimensional polyhedron S under the (\(3 \times 4\))-matrix M is a 3-dimensional polyhedron T with 5 vertices and 4 extremal directions. The length of the unbounded edges in the plot is set to 10:

	S=P:Q;
	M=[2 1 3 8; 1 6 8 5; 1 7 5 0];
	T=S.im(M);
	opt.dirlength=10;
	plot(T,opt);


screen05

Many other examples can be found in the reference manual.

Copyright © 2023 Daniel Ciripoi, Andreas Löhne and Benjamin Weißing, All rights reserved. License and Disclaimer Privacy Statement