Merge ssh://repo.or.cz/srv/git/polylib
[polylib.git] / applications / disjoint_union_adj.c
blobfa5ebc79c79cc9db7a0e51b66600e563a88416a5
1 /* Polyhedron disjoint intersections
2 */
4 /*
5 This file is part of PolyLib.
7 PolyLib is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 PolyLib is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with PolyLib. If not, see <http://www.gnu.org/licenses/>.
22 disjoint_union_adj computes the disjoint union of the given list of domains.
23 input:
24 (integer) # of polyhedra
25 list of polyhedra in the usual matrix (constraints) format
27 output:
28 list of polyhedra (constraint matrices) having their facets in common
32 #include <stdio.h>
33 #include <stdlib.h>
35 #include <polylib/polylib.h>
37 #define WS 0
40 /* Procedure to print constraints of a domain */
41 void AffContraintes(Polyhedron *p)
43 for( ;p;p=p->next)
45 Polyhedron_PrintConstraints(stdout, P_VALUE_FMT, p );
46 printf("\n");
51 int main() {
53 int np, i;
55 Matrix *a;
56 Polyhedron *A, *tmp, *DD;
58 scanf( "%d", &np );
60 A = NULL;
61 for( i=0 ; i<np ; i++ )
63 a = Matrix_Read();
64 tmp = Constraints2Polyhedron(a,WS);
65 Matrix_Free(a);
66 tmp ->next = A;
67 A = tmp;
71 DD = Disjoint_Domain( A, 1, WS );
73 AffContraintes(DD);
75 return 0;