isAdjacent

Purpose

Test if a polyhedron shares a facet with another polyhedron.

Syntax

ts = P.isAdjacent(Q)
ts = isAdjacent(P,Q)
[ts, iP, iQ] = isAdjacent(P,Q,fP,fQ)

Description

Return true if the polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent1.png has a facet to facet property with the polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent2.png. Both polyhedrons must be in H-representation. If they are not, the irredundant H-representation will be computed. Basically, the function tests if polyhedra ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent3.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent4.png are adjacent by solving LP problem consecutively for each facet. The polyhedra are declared as adjacent if their intersection is of dimension ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent5.png and if the facet of polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent6.png is also a facet for the polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent7.png. If you want to test just specific facets, you can provide them in fP and fQ arguments.

Input Arguments

P

Polyhedron in H-representation

Class: Polyhedron

Q

Polyhedron in H-representation

Class: Polyhedron

fP

Index of a facet to test from polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent8.png.

Class: double

fQ

Index of a facet to test from polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent9.png.

Class: double

Output Arguments

ts

Logical statement if the polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent10.png is in a face to face property with ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent11.png.

Class: logical

Allowed values:

  • true
  • false

iP

Index of a facet from polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent12.png that is common with polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent13.png.

Class: double

iQ

Index of a facet from polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent14.png that is common with polyhedron ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent15.png.

Class: double

Example(s)

Example 1

Create two polyhedra ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent16.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent17.png.
 H1 = [ 0.8905, 0.23614, 10;
            -0.055625, 0.030184, 0;
            -0.21887, -0.06688, 0;
            0, -1, 10;
            1,  0, 10;
            0,  1,  5;
        0,  1, 20]; 

 H2 = [0.055625, -0.030184, 0;
            -0.053731, -0.010858, 0;
        0,  1,  10];

 P = Polyhedron('H',H1); 

 Q = Polyhedron('H',H2); 
 Plot the polyhedrons. 
 plot([P,Q]); 

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

The polyhedrons are touching but are not adjacent because the common part is a facet of P but not a facet of Q.
 P.isAdjacent(Q) 
ans =

     0

If the polyhedrons are touching on the facet, they are neighbors that can be checked by isNeighbor method.
 P.isNeighbor(Q) 
ans =

     1

Example 2

Create two polyhedra ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent18.png and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/isadjacent19.png.
 H1 = [ 0.8905, 0.23614, 10;
            -0.055625, 0.030184, 0;
            -0.21887, -0.06688, 0;
            0, -1, 10;
            1,  0, 10;
            0,  1,  5;
        0,  1, 20]; 

 H2 = [ 1.84286377 -1 0;
               1.05619465 1 7.865634;
              -4.9485172  -1 0];

 P = Polyhedron('H',H1); 

 Q = Polyhedron('H',H2); 
 Plot the polyhedrons. 
 plot([P,Q]); 

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

The polyhedra share the same facet so they are in face to face property and declared as adjacent. The indices of the common facet are returned in variables iP and iQ.
 [ts, iP, iQ] = P.isAdjacent(Q) 
ts =

     1


iP =

     2


iQ =

     1

See Also

isneighbor


© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch