slice

Purpose

Slice the polyhedron through given dimensions at specified values.

Syntax

S = P.slice(dims, values)
S = slice(P, dims, values)
S = P.slice(dims, values, 'keepDim', true/false)

Description

Compute the intersection of ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/slice1.png with a subspace spanning the dimensions dims at given values. If the argument values are omitted, the value is assumed to be zero, i.e. values = zeros(size(dims)). For a polyhedron given in H-representation

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

the slice operation over dims at given values returns a polyhedron in a reduced dimension P.Dim-length(dims)

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

This corresponds to the default choice keepdim=false.

Alternatively, by invoking keepdim=true, the polyhedron S will be returned in the same dimension as P

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

Input Arguments

P

Polyhedron in any format

Class: Polyhedron

dims

Dimensions to cut through

Class: double

values

Set of values at which to compute the slices.

Class: double

Default: 0

Output Arguments

S

Polyhedron that represents the cut of the polyhedron P over the specified dimensions.

Class: Polyhedron

Example(s)

Example 1

Create random symmetric polytope in dimension 3.
P = ExamplePoly.poly3d_sin('d',3);
Compute slices over the dimension 2 but preserve the dimension 
S = P.slice(2,0,'keepDim',true);
Plot the result
P.plot('alpha',0.2,'color','lightblue'); hold on;
              S.plot('color','blue','alpha',0.2,'linestyle','--','linewidth',3);
              axis tight;
          

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

Example 2

Create a polytope in 4D from five points.
v = [-7, -3, -10, 2; 1,-5, 6, 8; -2, 6, -5, -5; 4, -4, 9, -8; 3, -4, 5, -3]; 

P = Polyhedron(v);
Slice it over dimensions 2 and 4 at values [1;-5] 
S = P.slice([2,4], [1;-5])
Polyhedron in R^2 with representations:
    H-rep (redundant)   : Inequalities   5 | Equalities   0
    V-rep               : Unknown (call computeVRep() to compute)
Functions : none
The resulting polyhedron S is in reduced dimension and can be plotted.
 S.plot('color','green','alpha',0.5); 

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

See Also

projection, project


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

© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk