00001 /* Polyhedron disjoint intersections 00002 */ 00003 00004 /* 00005 This file is part of PolyLib. 00006 00007 PolyLib is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 PolyLib is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with PolyLib. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 /* 00022 disjoint_union_adj computes the disjoint union of the given list of domains. 00023 input: 00024 (integer) # of polyhedra 00025 list of polyhedra in the usual matrix (constraints) format 00026 00027 output: 00028 list of polyhedra (constraint matrices) having their facets in common 00029 00030 */ 00031 00032 #include <stdio.h> 00033 #include <stdlib.h> 00034 00035 #include <polylib/polylib.h> 00036 00037 #define WS 0 00038 00039 00040 /* Procedure to print constraints of a domain */ 00041 void AffContraintes(Polyhedron *p) 00042 { 00043 for( ;p;p=p->next) 00044 { 00045 Polyhedron_PrintConstraints(stdout, P_VALUE_FMT, p ); 00046 printf("\n"); 00047 } 00048 } 00049 00050 00051 int main() { 00052 00053 int np, i; 00054 00055 Matrix *a; 00056 Polyhedron *A, *tmp, *DD; 00057 00058 scanf( "%d", &np ); 00059 00060 A = NULL; 00061 for( i=0 ; i<np ; i++ ) 00062 { 00063 a = Matrix_Read(); 00064 tmp = Constraints2Polyhedron(a,WS); 00065 Matrix_Free(a); 00066 tmp ->next = A; 00067 A = tmp; 00068 } 00069 00070 00071 DD = Disjoint_Domain( A, 1, WS ); 00072 00073 AffContraintes(DD); 00074 00075 return 0; 00076 } 00077 00078 00079