plus

Purpose

Add a Polyhedron and a vector or Polyhedron.

Syntax

Q = P + S
Q = plus(P,S,method)
Q = P + x
Q = plus(P, x)

Description

Compute the Minkowski sum of ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus1.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus2.png, or ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus3.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus4.png.

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus5.png

or

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus6.png

Input Arguments

P

Polyhedron in any format

Class: Polyhedron

S

Polyhedron in any format or a point given as column real vector of the length P.Dim

Class: Polyhedron or double

method

String selecting the projection method to be used. Can be 'vrep', 'fourier', or 'mplp'.

Class: string

Output Arguments

Q

Polyhedron Q = P+S.

Class: Polyhedron

Example(s)

Example 1

Sum of Polyhedron and vector
P = Polyhedron('H',[sin([0:0.5:2*pi])' cos([0:0.5:2*pi])' ones(13,1)]);

Q = P + [2;2];

plot([P;Q],'alpha',0.1);

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus_img_1.png

Example 2

Sum of two Polytopes
P = Polyhedron('H',[sin([0:0.5:2*pi])' cos([0:0.5:2*pi])' ones(13,1)]);

S = Polyhedron('lb',[-1;-1],'ub',[1;1]);

Q = P + S;

Q.plot('color','r','alpha',0.2); hold on;
	 S.plot('color','b','alpha',0.5);
	 P.plot('color','g','alpha',0.5);
    

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus_img_2.png

Example 3

Sum of a polytope and a cone
P = Polyhedron('H',[sin([0:0.5:2*pi])' cos([0:0.5:2*pi])' ones(13,1)]);

S = Polyhedron('R', [1 1;1 0.5]); 

Q = P + S; 

Q.plot('color','r','alpha',0.5); hold on;
	 S.minus([5;0]).plot('color','b','alpha',0.5);
	 P.minus([2.5;0]).plot('color','g','alpha',0.5);

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus_img_3.png

Example 4

Sum of lower dimensional polytopes
P = Polyhedron('lb',-ones(3,1),'ub',ones(3,1),'He',[1 1 1 0.2]);

S = Polyhedron('lb',-ones(3,1),'ub',ones(3,1),'He',[-1 1 1 0.4]);

Q = P + S;

P.plot('color','g','alpha',0.5); hold on;
	 S.plot('color','b','alpha',0.5);
	 Q.plot('color','r','alpha',0.2);

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus_img_4.png

Example 5

Build a zonotope by adding 5 line segments.
Z = Polyhedron;

for (i=1:5) Z = Z + Polyhedron('V',[0 0 0;randn(1,3)]); end; 

Z.plot('color','b','alpha',0.7);

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/plus_img_5.png

See Also

minus


© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch