C() ,Q() ,hastetracolor(),hasqualityt()....

plus some misuse of tetra3 corrected
This commit is contained in:
ganovelli 2004-07-09 10:13:00 +00:00
parent 24583cbed2
commit 2b9cd14fec
1 changed files with 73 additions and 19 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.9 2004/07/08 08:43:22 pietroni
changed functions used to compute the aspect ratio
Revision 1.8 2004/05/20 13:04:23 pietroni Revision 1.8 2004/05/20 13:04:23 pietroni
modified setBorderV function modified setBorderV function
@ -140,6 +143,12 @@ static inline bool DeleteBitFlag(int bitval)
return false; return false;
} }
/// Get the flags without any control
inline int & UberFlags()
{
return _flags;
}
/// This function checks if the given user bit is true. /// This function checks if the given user bit is true.
bool IsUserBit(int userBit){return (_flags & userBit) != 0;} bool IsUserBit(int userBit){return (_flags & userBit) != 0;}
/// This function set the given user bit. /// This function set the given user bit.
@ -202,6 +211,10 @@ public:
return _v[j]; return _v[j];
} }
inline CoordType & P( const int j ) { return V(j)->P();}
inline const CoordType & cP( const int j ) const { return V(j)->cP();}
/***********************************************/ /***********************************************/
/** @name Topology Structures /** @name Topology Structures
For each Tetrahedron we store 2 array for Tatrahedron - Tetrahedron topology ( sharing Face) For each Tetrahedron we store 2 array for Tatrahedron - Tetrahedron topology ( sharing Face)
@ -268,7 +281,7 @@ public:
_v[2]=p2; _v[2]=p2;
_v[3]=p3; _v[3]=p3;
if(ComputeVolume()<0 ) if(vcg::ComputeVolume(*this)<0 )
std::swap(_v[1],_v[2]); std::swap(_v[1],_v[2]);
#ifdef __VCGLIB_TETRA_TA #ifdef __VCGLIB_TETRA_TA
@ -316,12 +329,12 @@ public:
#ifdef __VCGLIB_TETRA_TN #ifdef __VCGLIB_TETRA_TN
return _n[i]; return _n[i];
#else #else
Tetra3<ScalarType> T=Tetra3<ScalarType>(); /* Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->P(); T.P0(0)=V(0)->P();
T.P1(0)=V(1)->P(); T.P1(0)=V(1)->P();
T.P2(0)=V(2)->P(); T.P2(0)=V(2)->P();
T.P3(0)=V(3)->P(); T.P3(0)=V(3)->P();*/
return (Normal<Tetra3<ScalarType> >(T,i)); return (Normal(*this,i));
#endif #endif
} }
@ -349,21 +362,34 @@ void ComputeNormal()
#ifdef __VCGLIB_TETRA_TQ #ifdef __VCGLIB_TETRA_TQ
ScalarType _volume; ScalarType _volume;
ScalarType _aspect_ratio; ScalarType _aspect_ratio;
ScalarType _q;
#endif #endif
ScalarType & Q(){
#ifdef __VCGLIB_TETRA_TQ
return _q;
#else
assert(0);
return 0;
#endif
}
const ScalarType & Q()const{
#ifdef __VCGLIB_TETRA_TQ
return _q;
#else
assert(0);
return 0;
#endif
}
ScalarType ComputeVolume(){ ScalarType ComputeVolume(){
Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->cP();
T.P1(0)=V(1)->cP();
T.P2(0)=V(2)->cP();
T.P3(0)=V(3)->cP();
#ifdef __VCGLIB_TETRA_TQ #ifdef __VCGLIB_TETRA_TQ
_volume = T.ComputeVolume(); _volume = vcg::ComputeVolume<BaseTetraType>(*this);
return _volume; return _volume;
#else #else
return (T.ComputeVolume()); return vcg::ComputeVolume<BaseTetraType>(*this);
#endif #endif
} }
@ -387,17 +413,37 @@ void ComputeNormal()
///set if exist local value of aspect ratio ///set if exist local value of aspect ratio
ScalarType ComputeAspectRatio(){ ScalarType ComputeAspectRatio(){
Tetra3<ScalarType> T=Tetra3<ScalarType>(); //Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->cP(); //T.P0(0)=V(0)->cP();
T.P1(0)=V(1)->cP(); //T.P1(0)=V(1)->cP();
T.P2(0)=V(2)->cP(); //T.P2(0)=V(2)->cP();
T.P3(0)=V(3)->cP(); //T.P3(0)=V(3)->cP();
#ifdef __VCGLIB_TETRA_TQ #ifdef __VCGLIB_TETRA_TQ
_aspect_ratio= T.ComputeAspectRatio(); _aspect_ratio= ( (Tetra3<ScalarType>* ) this) -> ComputeAspectRatio();
return(_aspect_ratio); return(_aspect_ratio);
#else #else
return (T.ComputeAspectRatio()); return (( (Tetra3<ScalarType> *) this) -> ComputeAspectRatio());
#endif
}
//@}
/***********************************************/
/** @name Color
**/
//@{
#ifdef __VCGLIB_TETRA_TC
Color4b c;
#endif
Color4b & C(){
#ifdef __VCGLIB_TETRA_TC
return _c;
#else
assert(0);
return (*new Color4b());
#endif #endif
} }
//@} //@}
@ -432,6 +478,14 @@ static bool HasTetraQuality() {
#endif #endif
} }
static bool HasTetraColor() {
#ifdef __VCGLIB_TETRA_TC
return true;
#else
return false;
#endif
}
static bool HasTTAdjacency() { static bool HasTTAdjacency() {
#if (defined(__VCGLIB_TETRA_AT) || defined(__VCGLIB_TETRA_SAT)) #if (defined(__VCGLIB_TETRA_AT) || defined(__VCGLIB_TETRA_SAT))
return true; return true;