intersect

Purpose

Intersect two polyhedra.

Syntax

PnS = intersect(P, S)

Description

Compute the intersection of two polyhedra:

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

Note: If ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/intersect1.png or ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/intersect2.png are in V-rep, then this function will first compute their convex hull.

Input Arguments

P

Polyhedron in any format

Class: Polyhedron

S

Polyhedron in any format

Class: Polyhedron

Output Arguments

PnS

Intersection of ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/intersect3.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/intersect4.png.

Class: Polyhedron

Example(s)

Example 1

Intersect two polytopes.
P = ExamplePoly.randVrep;

S = ExamplePoly.randHrep;

PnS = intersect(P,S)
Polyhedron in R^2 with representations:
    H-rep (redundant)   : Inequalities  15 | Equalities   0
    V-rep               : Unknown (call computeVRep() to compute)
Functions : none
plot([P;S],'alpha',0.1);hold on; 
	    plot(PnS,'color','r','alpha',0.6);

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

Example 2

Intersect a polytope and an unbounded polyhedron.
P = Polyhedron('V', [1 1;0 1;1 0], 'R', -[1 0]);

S = Polyhedron('H', [randn(10,2) 4*ones(10,1)]);

PnS = intersect(P,S)
Polyhedron in R^2 with representations:
    H-rep (redundant)   : Inequalities  13 | Equalities   0
    V-rep               : Unknown (call computeVRep() to compute)
Functions : none
plot(P,'color','b','alpha',0.1);hold on;
	       plot(S,'color','g','alpha',0.1); plot(PnS,'color','r','alpha',0.6);

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

Example 3

Intersect a 3D polytope and a lower dimensional cone.
P = Polyhedron('lb',-0.5*ones(3,1), 'ub', 0.5*ones(3,1));

S = Polyhedron('R', [-1 0 .5;-1 2 2]);

PnS = intersect(P,S)
Polyhedron in R^3 with representations:
    H-rep (redundant)   : Inequalities   8 | Equalities   1
    V-rep               : Unknown (call computeVRep() to compute)
Functions : none
plot(P,'color','b','alpha',0.1);hold on;
	       plot(S,'color','g','alpha',0.1); plot(PnS,'color','r','alpha',1);

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


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