Important Change: ** LastBitFlag ** now is named ** FirstUnusedBitFlag **

Corrected the name of the function allocating a user bit among the flags of the simplexes. 
Changed in ALL the simplexes (vertex, edge, face, etc) and updating functions. 
Note that the LastBitFlag should never be used by common users...
This commit is contained in:
Paolo Cignoni 2012-07-18 09:37:32 +00:00
parent 36d9030955
commit 45b0deb7eb
6 changed files with 151 additions and 121 deletions

View File

@ -245,7 +245,7 @@ static void FaceBorderFromVF(MeshType &m)
vfi.f->Flags() |= BORDERFLAG[(vfi.z+2)%3];
}
}
VertexType::DeleteBitFlag(VertexType::LastBitFlag());
VertexType::DeleteBitFlag(visitedBit);
}

View File

@ -141,34 +141,40 @@ public:
void SetV() {this->Flags() |=VISITED;}
void ClearV() {this->Flags() &=~VISITED;}
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// Return the first bit that is not still used
static int &FirstUnusedBitFlag()
{
static int b =USER0;
return b;
}
/// Allocate a bit among the flags that can be used by user. It updates the FirstUnusedBitFlag.
static inline int NewBitFlag()
{
int bitForTheUser = FirstUnusedBitFlag();
FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
return bitForTheUser;
}
/// De-allocate a pre allocated bit. It updates the FirstUnusedBitFlag.
// Note you must deallocate bit in the inverse order of the allocation (as in a stack)
static inline bool DeleteBitFlag(int bitval)
{
if(FirstUnusedBitFlag()>>1==bitval) {
FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
/// This function set the given user bit
/// This function set the given user bit
void SetUserBit(int userBit){this->Flags() |=userBit;}
/// This function clear the given user bit
/// This function clear the given user bit
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
template<class BoxType>

View File

@ -143,34 +143,40 @@ public:
void SetV() {this->Flags() |=VISITED;}
void ClearV() {this->Flags() &=~VISITED;}
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// Return the first bit that is not still used
static int &FirstUnusedBitFlag()
{
static int b =USER0;
return b;
}
/// Allocate a bit among the flags that can be used by user. It updates the FirstUnusedBitFlag.
static inline int NewBitFlag()
{
int bitForTheUser = FirstUnusedBitFlag();
FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
return bitForTheUser;
}
/// De-allocate a pre allocated bit. It updates the FirstUnusedBitFlag.
// Note you must deallocate bit in the inverse order of the allocation (as in a stack)
static inline bool DeleteBitFlag(int bitval)
{
if(FirstUnusedBitFlag()>>1==bitval) {
FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
/// This function set the given user bit
/// This function set the given user bit
void SetUserBit(int userBit){this->Flags() |=userBit;}
/// This function clear the given user bit
/// This function clear the given user bit
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
template<class BoxType>

View File

@ -206,34 +206,40 @@ public:
void ClearF(int i) {this->Flags() &= (~(FAUX0<<i));}
void ClearAllF() { this->Flags() &= (~(FAUX0|FAUX1|FAUX2)); }
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// Return the first bit that is not still used
static int &FirstUnusedBitFlag()
{
static int b =USER0;
return b;
}
/// Allocate a bit among the flags that can be used by user. It updates the FirstUnusedBitFlag.
static inline int NewBitFlag()
{
int bitForTheUser = FirstUnusedBitFlag();
FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
return bitForTheUser;
}
/// De-allocate a pre allocated bit. It updates the FirstUnusedBitFlag.
// Note you must deallocate bit in the inverse order of the allocation (as in a stack)
static inline bool DeleteBitFlag(int bitval)
{
if(FirstUnusedBitFlag()>>1==bitval) {
FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
/// This function set the given user bit
/// This function set the given user bit
void SetUserBit(int userBit){this->Flags() |=userBit;}
/// This function clear the given user bit
/// This function clear the given user bit
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}

View File

@ -232,34 +232,40 @@ public:
/// This funcion execute the inverse operation of SetS()
void ClearB(int i) {this->Flags() &= (~(BORDER0<<i));}
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// Return the first bit that is not still used
static int &FirstUnusedBitFlag()
{
static int b =USER0;
return b;
}
/// Allocate a bit among the flags that can be used by user. It updates the FirstUnusedBitFlag.
static inline int NewBitFlag()
{
int bitForTheUser = FirstUnusedBitFlag();
FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
return bitForTheUser;
}
/// De-allocate a pre allocated bit. It updates the FirstUnusedBitFlag.
// Note you must deallocate bit in the inverse order of the allocation (as in a stack)
static inline bool DeleteBitFlag(int bitval)
{
if(FirstUnusedBitFlag()>>1==bitval) {
FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
/// This function set the given user bit
/// This function set the given user bit
void SetUserBit(int userBit){this->Flags() |=userBit;}
/// This function clear the given user bit
/// This function clear the given user bit
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
template<class BoxType>

View File

@ -190,34 +190,40 @@ public:
void SetV() {this->Flags() |=VISITED;}
void ClearV() {this->Flags() &=~VISITED;}
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// Return the first bit that is not still used
static int &FirstUnusedBitFlag()
{
static int b =USER0;
return b;
}
/// Allocate a bit among the flags that can be used by user. It updates the FirstUnusedBitFlag.
static inline int NewBitFlag()
{
int bitForTheUser = FirstUnusedBitFlag();
FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
return bitForTheUser;
}
/// De-allocate a pre allocated bit. It updates the FirstUnusedBitFlag.
// Note you must deallocate bit in the inverse order of the allocation (as in a stack)
static inline bool DeleteBitFlag(int bitval)
{
if(FirstUnusedBitFlag()>>1==bitval) {
FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
/// This function set the given user bit
/// This function set the given user bit
void SetUserBit(int userBit){this->Flags() |=userBit;}
/// This function clear the given user bit
/// This function clear the given user bit
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
template<class BoxType>