Exemplo n.º 1
0
Arquivo: eopd.c Projeto: nvcleemp/eopd
boolean findEOPD(bitset tuple){
    int i, j;
    //first we check the stored OPD's
    for(i = 0; i < eopdCount; i++){
        bitset intersectionOpd = INTERSECTION(tuple, opdFaces[i]);
        bitset intersectionExtensions = INTERSECTION(tuple, extensionFaces[i]);
        if((IS_NOT_EMPTY(intersectionOpd) && IS_NOT_EMPTY(intersectionExtensions)) ||
                (HAS_MORE_THAN_ONE_ELEMENT(intersectionOpd))){
            numberOfTuplesCoveredByStoredOpd++;
            return TRUE;
        }
    }
    
    //then we try to find a new eOPD
    for(i = 0; i < nf; i++){
        if(CONTAINS(tuple, i)){
            //try to find a eOPD with face i as extension
            bitset remainingFaces = MINUS(tuple, i);
            //we use each edge once as a possible shared edge 
            EDGE *sharedEdge = facestart[i];
            for(j = 0; j < 3; j++){
                //construct initial eopd
                int neighbouringFace = sharedEdge->inverse->rightface;
                bitset currentEopdVertices = faceSets[neighbouringFace];
                bitset currentEopdFaces = UNION(SINGLETON(i), SINGLETON(neighbouringFace));
                if(findEOPD_impl(currentEopdVertices, currentEopdFaces, i, remainingFaces, sharedEdge->inverse)){
                    return TRUE;
                }
                sharedEdge = sharedEdge->next->inverse;
            }
        }
    }
    return FALSE;
}
Exemplo n.º 2
0
Arquivo: eopd.c Projeto: nvcleemp/eopd
boolean findEOPD_impl(bitset currentEopdVertices, bitset currentEopdFaces, int eopdExtension, bitset remainingFaces, EDGE *lastExtendedEdge){
    //first check whether this is a covering eOPD
    if(IS_NOT_EMPTY(INTERSECTION(currentEopdFaces, remainingFaces))){
        //store the eOPD
        greedyExtendOpdAndStore(currentEopdVertices, MINUS(currentEopdFaces, eopdExtension));
        return TRUE;
    }
    
    //otherwise try extending the eOPD
    EDGE *extension = lastExtendedEdge->next;
    
    if(INTERSECTION(currentEopdVertices, neighbourhood[extension->next->end]) ==
            extension->vertices){
            //face to the right of extension is addable
            if(findEOPD_impl(UNION(currentEopdVertices, faceSets[extension->rightface]),
                    UNION(currentEopdFaces, SINGLETON(extension->rightface)),
                    eopdExtension, remainingFaces, extension)){
                return TRUE;
            }
    }
    
    extension = lastExtendedEdge->inverse->prev->inverse;
    
    if(INTERSECTION(currentEopdVertices, neighbourhood[extension->next->end]) ==
            extension->vertices){
            //face to the right of extension is addable
            if(findEOPD_impl(UNION(currentEopdVertices, faceSets[extension->rightface]),
                    UNION(currentEopdFaces, SINGLETON(extension->rightface)),
                    eopdExtension, remainingFaces, extension)){
                return TRUE;
            }
    }
    
    return FALSE;
}
Exemplo n.º 3
0
void main(void)
{
  int delay;
  char ch;

  delay = DEF_TIME;

  m.load(word_list);

  if (setup())
    return;

  while(kbhit())
   getch();

  do
   {
    while (! kbhit())
      message(delay);
    ch = getch();
    if (MINUS(ch) &&
        (delay >= MIN_TIME))
      delay -= INC_TIME;
    if (PLUS(ch) &&
        (delay <= MAX_TIME))
      delay += INC_TIME;
   }
  while (ch == '-' || ch == '+');

  cleanup();

  cputs("\n\n\n(C) 1995   N.A.A. MATHEWSON");

}
Exemplo n.º 4
0
int inside(vector2 *normals, vector2 *midpoint,
	   int length,vector2 point)
{
	int i;
	vector2 result;
	for(i = 0; i < length;i++)
	{
		//midpoint[i] - point
		MINUS(midpoint[i],point,result);
		if(dot(normals[i],result) < 0)
			return false; //outside
	}
	return true;//inside
}
Exemplo n.º 5
0
CDataTimeStorage CDataTimeStorage::operator-( const CDataTimeStorage& opRight ) const
{
	CDataTimeStorage dtsResult( *this );

	MINUS( dtsResult, opRight, wMilliseconds );
	MINUS( dtsResult, opRight, wSecond );
	MINUS( dtsResult, opRight, ucMinute );
	MINUS( dtsResult, opRight, ucHour );
	MINUS( dtsResult, opRight, ucDay );
	MINUS( dtsResult, opRight, ucMonth );
	MINUS( dtsResult, opRight, wYear );

	return dtsResult.Normalize();
}
Exemplo n.º 6
0
boolean findEOPD(bitset tuple){
    int i, j;
    
    for(i = 0; i < nf; i++){
        if(CONTAINS(tuple, i)){
            //try to find a eOPD with face i as extension
            bitset remainingFaces = MINUS(tuple, i);
            //we use each edge once as a possible shared edge 
            EDGE *sharedEdge = facestart[i];
            for(j = 0; j < 3; j++){
                //construct initial eopd
                int neighbouringFace = sharedEdge->inverse->rightface;
                bitset currentEopdVertices = faceSets[neighbouringFace];
                bitset currentEopdFaces = UNION(SINGLETON(i), SINGLETON(neighbouringFace));
                if(findEOPD_impl(currentEopdVertices, currentEopdFaces, i, remainingFaces, sharedEdge->inverse)){
                    return TRUE;
                }
                sharedEdge = sharedEdge->next->inverse;
            }
        }
    }
    return FALSE;
}
Exemplo n.º 7
0
#define X() 1
#define PLUS() +
#define MINUS() -
#define DOT() .
#define GREATER() >
#define LESS() <

//R #line 23 "t_9_003.cpp"
X()2                          //R 1 2 
STRINGIZE( X()2 )             //R "12" 
//R 
X() 2                         //R 1 2 
STRINGIZE( X() 2 )            //R "1 2" 
//R 
PLUS()MINUS()                 //R +- 
STRINGIZE( PLUS()MINUS() )    //R "+-" 
//R 
PLUS()PLUS()                  //R + + 
STRINGIZE( PLUS()PLUS() )     //R "++" 
//R 
MINUS()MINUS()                //R - - 
STRINGIZE( MINUS()MINUS() )   //R "--" 
//R 
DOT()DOT()DOT()               //R .. . 
STRINGIZE( DOT()DOT()DOT() )  //R "..." 

// the following are regressions reported by Stefan Seefeld
//R #line 43 "t_9_003.cpp"
GREATER()GREATER()            //R > > 
STRINGIZE( GREATER()GREATER() ) //R ">>" 
//R