00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020
00021 #include <polylib/polylib.h>
00022
00023 #define WS 0
00024
00025 int main() {
00026
00027 Matrix *a, *b;
00028 Polyhedron *A, *B;
00029 Param_Polyhedron *PA;
00030 Param_Domain *P;
00031 Param_Vertices *V;
00032 int nbPV, i, j;
00033 const char **param_name;
00034
00035 a = Matrix_Read();
00036 if(!a || a->NbColumns == 0) {
00037 fprintf(stderr,"Input error: empty matrix\n");
00038 exit(0);
00039 }
00040 A = Constraints2Polyhedron(a, WS);
00041 Matrix_Free(a);
00042 b = Matrix_Read();
00043
00044 if(!b || b->NbColumns == 0) {
00045 fprintf(stderr, "Input error: empty matrix\n");
00046 exit(0);
00047 }
00048 B = Constraints2Polyhedron(b, WS);
00049 Matrix_Free(b);
00050
00051
00052 param_name = Read_ParamNames(stdin, B->Dimension);
00053 PA = Polyhedron2Param_Domain(A,B,WS);
00054 if(!PA || PA->D==NULL) {
00055 printf("---------------------------------------\n");
00056 printf("Empty polyhedron\n");
00057 return 0;
00058 }
00059 nbPV = PA->nbV;
00060 Domain_Free(A);
00061 Domain_Free(B);
00062
00063 if (PA->Rays->NbRows > 0) {
00064 printf( "---------------------------------------\n" );
00065 printf( "Overall rays :\n");
00066 for (i = 0; i < PA->Rays->NbRows; i++) {
00067 if (value_zero_p(PA->Rays->p[i][0]))
00068 printf("Line: [");
00069 else
00070 printf("Ray: [");
00071 for (j = 1; j < PA->Rays->NbColumns-1; j++) {
00072 value_print(stdout,P_VALUE_FMT,PA->Rays->p[i][j]);
00073 }
00074 printf(" ]\n");
00075 }
00076 }
00077
00078
00079
00080 for(P=PA->D;P;P=P->next) {
00081
00082
00083 printf( "---------------------------------------\n" );
00084 printf( "Domain :\n");
00085 Print_Domain( stdout, P->Domain, param_name );
00086
00087
00088 printf( "Vertices :\n");
00089 FORALL_PVertex_in_ParamPolyhedron(V,P,PA) {
00090
00091
00092 Print_Vertex( stdout, V->Vertex, param_name );
00093 printf( "\n" );
00094 }
00095 END_FORALL_PVertex_in_ParamPolyhedron;
00096 }
00097
00098
00099 Param_Polyhedron_Free( PA );
00100 free(param_name);
00101
00102 return 0;
00103 }
00104