00001
00019 #include "mvc.h"
00020
00024
00028
00040 Mvc_Cover_t * Mvc_CoverBooleanOr( Mvc_Cover_t * pCover1, Mvc_Cover_t * pCover2 )
00041 {
00042 Mvc_Cover_t * pCover;
00043 Mvc_Cube_t * pCube, * pCubeCopy;
00044
00045 assert( pCover1->nBits == pCover2->nBits );
00046
00047 pCover = Mvc_CoverClone( pCover1 );
00048
00049
00050 Mvc_CoverForEachCube( pCover1, pCube )
00051 {
00052 pCubeCopy = Mvc_CubeDup( pCover, pCube );
00053 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
00054 }
00055 Mvc_CoverForEachCube( pCover2, pCube )
00056 {
00057 pCubeCopy = Mvc_CubeDup( pCover, pCube );
00058 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
00059 }
00060 return pCover;
00061 }
00062
00063 #if 0
00064
00076 Mvc_Cover_t * Mvc_CoverBooleanAnd( Mvc_Data_t * p, Mvc_Cover_t * pCover1, Mvc_Cover_t * pCover2 )
00077 {
00078 Mvc_Cover_t * pCover;
00079 Mvc_Cube_t * pCube1, * pCube2, * pCubeCopy;
00080
00081 assert( pCover1->nBits == pCover2->nBits );
00082
00083 pCover = Mvc_CoverClone( pCover1 );
00084
00085
00086 Mvc_CoverForEachCube( pCover1, pCube1 )
00087 {
00088 Mvc_CoverForEachCube( pCover2, pCube2 )
00089 {
00090 if ( Mvc_CoverDist0Cubes( p, pCube1, pCube2 ) )
00091 {
00092 pCubeCopy = Mvc_CubeAlloc( pCover );
00093 Mvc_CubeBitAnd( pCubeCopy, pCube1, pCube2 );
00094 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
00095 }
00096 }
00097
00098
00099 if ( Mvc_CoverReadCubeNum( pCover ) > 500 )
00100 Mvc_CoverContain( pCover );
00101 }
00102 return pCover;
00103 }
00104
00116 int Mvc_CoverBooleanEqual( Mvc_Data_t * p, Mvc_Cover_t * pCover1, Mvc_Cover_t * pCover2 )
00117 {
00118 Mvc_Cover_t * pSharp;
00119
00120 pSharp = Mvc_CoverSharp( p, pCover1, pCover2 );
00121 if ( Mvc_CoverReadCubeNum( pSharp ) )
00122 {
00123 Mvc_CoverContain( pSharp );
00124 printf( "Sharp \n" );
00125 Mvc_CoverPrint( pSharp );
00126 Mvc_CoverFree( pSharp );
00127 return 0;
00128 }
00129 Mvc_CoverFree( pSharp );
00130
00131 pSharp = Mvc_CoverSharp( p, pCover2, pCover1 );
00132 if ( Mvc_CoverReadCubeNum( pSharp ) )
00133 {
00134 Mvc_CoverContain( pSharp );
00135 printf( "Sharp \n" );
00136 Mvc_CoverPrint( pSharp );
00137 Mvc_CoverFree( pSharp );
00138 return 0;
00139 }
00140 Mvc_CoverFree( pSharp );
00141
00142 return 1;
00143 }
00144
00145 #endif
00146
00150
00151