changed name to topology functions

This commit is contained in:
Nico Pietroni 2004-05-05 17:03:25 +00:00
parent bdb47046da
commit e605dc6d74
1 changed files with 112 additions and 42 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.7 2004/04/28 11:37:14 pietroni
*** empty log message ***
Revision 1.6 2004/04/26 09:40:15 pietroni Revision 1.6 2004/04/26 09:40:15 pietroni
*** empty log message *** *** empty log message ***
@ -57,7 +60,7 @@ Edited Comments and GPL license
#include<vcg/space/tcoord2.h> #include<vcg/space/tcoord2.h>
class DUMMYFACETYPE; class DUMMYFACETYPE;
class DUMMYTETRATYPE;
namespace vcg { namespace vcg {
/** /**
@ -68,7 +71,7 @@ namespace vcg {
@param FLTYPE (Template Parameter) Specifies the scalar field of the vertex coordinate type. @param FLTYPE (Template Parameter) Specifies the scalar field of the vertex coordinate type.
@param VFTYPE (Template Parameter) Specifies the type for the face, needed only for VF adjacency. @param VFTYPE (Template Parameter) Specifies the type for the face, needed only for VF adjacency.
*/ */
template <class FLTYPE, class VFTYPE = DUMMYFACETYPE, class TCTYPE = TCoord2<float,1> > class VERTEX_TYPE template <class FLTYPE, class VFTYPE = DUMMYFACETYPE, class VTTYPE = DUMMYTETRATYPE,class TCTYPE = TCoord2<float,1> > class VERTEX_TYPE
{ {
public: public:
@ -250,7 +253,7 @@ static inline bool DeleteUserBit(int bitval)
**/ **/
//@{ //@{
#ifdef __VCGLIB_VERTEX_T #ifdef __VCGLIB_VERTEX_VT
protected: protected:
TCTYPE _t; TCTYPE _t;
#endif #endif
@ -258,7 +261,7 @@ protected:
public: public:
TCTYPE & T() TCTYPE & T()
{ {
#ifdef __VCGLIB_VERTEX_T #ifdef __VCGLIB_VERTEX_VT
return _t; return _t;
#else #else
assert(0); assert(0);
@ -268,7 +271,7 @@ public:
const TCTYPE & T() const const TCTYPE & T() const
{ {
#ifdef __VCGLIB_VERTEX_T #ifdef __VCGLIB_VERTEX_VT
return _t; return _t;
#else #else
assert(0); assert(0);
@ -285,7 +288,7 @@ public:
**/ **/
//@{ //@{
#ifdef __VCGLIB_VERTEX_C #ifdef __VCGLIB_VERTEX_VC
protected: protected:
Color4b _c; Color4b _c;
#endif #endif
@ -293,7 +296,7 @@ protected:
public: public:
Color4b & C() Color4b & C()
{ {
#ifdef __VCGLIB_VERTEX_C #ifdef __VCGLIB_VERTEX_VC
return _c; return _c;
#else #else
assert(0); assert(0);
@ -303,7 +306,7 @@ public:
const Color4b & C() const const Color4b & C() const
{ {
#ifdef __VCGLIB_VERTEX_C #ifdef __VCGLIB_VERTEX_VC
return _c; return _c;
#else #else
return Color4b(Color4b::White); return Color4b(Color4b::White);
@ -318,7 +321,7 @@ public:
**/ **/
//@{ //@{
#ifdef __VCGLIB_VERTEX_Q #ifdef __VCGLIB_VERTEX_VQ
protected: protected:
float _q; float _q;
#endif #endif
@ -326,7 +329,7 @@ protected:
public: public:
float & Q() float & Q()
{ {
#ifdef __VCGLIB_VERTEX_Q #ifdef __VCGLIB_VERTEX_VQ
return _q; return _q;
#else #else
assert(0); assert(0);
@ -336,7 +339,7 @@ public:
const float & Q() const const float & Q() const
{ {
#ifdef __VCGLIB_VERTEX_Q #ifdef __VCGLIB_VERTEX_VQ
return _q; return _q;
#else #else
return 1; return 1;
@ -351,49 +354,109 @@ public:
**/ **/
//@{ //@{
#if ((defined __VCGLIB_VERTEX_A) || (defined __VCGLIB_VERTEX_AS)) #if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
// Puntatore ad una faccia appartenente alla stella del vertice, implementa l'adiacenza vertice-faccia // Puntatore ad una faccia appartenente alla stella del vertice, implementa l'adiacenza vertice-faccia
protected: protected:
VFTYPE *_fp; VFTYPE *_vfb;
int _zp; int _vfi;
#endif #endif
public: public:
inline VFTYPE * & Fp() inline VFTYPE * & VFb()
{ {
#if ((defined __VCGLIB_VERTEX_A) || (defined __VCGLIB_VERTEX_AS)) #if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _fp; return _vfb;
#else #else
assert(0);// you are probably trying to use VF topology in a vertex without it assert(0);// you are probably trying to use VF topology in a vertex without it
return *((VFTYPE **)(_flags)); return *((VFTYPE **)(_flags));
#endif #endif
} }
inline const VFTYPE * & Fp() const inline const VFTYPE * & VFb() const
{ {
#if ((defined __VCGLIB_VERTEX_A) || (defined __VCGLIB_VERTEX_AS)) #if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _fp; return _vfb;
#else #else
assert(0);// you are probably trying to use VF topology in a vertex without it assert(0);// you are probably trying to use VF topology in a vertex without it
return (VFTYPE *)this; return (VFTYPE *)this;
#endif #endif
} }
inline int & Zp() inline int & _VFi()
{ {
#if ((defined __VCGLIB_VERTEX_A) || (defined __VCGLIB_VERTEX_AS)) #if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _zp; return _vfi;
#else #else
assert(0);// you are probably trying to use VF topology in a vertex without it assert(0);// you are probably trying to use VF topology in a vertex without it
return _flags; return _flags;
#endif #endif
} }
inline const int & Zp() const inline const int & _VFi() const
{ {
#if ((defined __VCGLIB_VERTEX_A) || (defined __VCGLIB_VERTEX_AS)) #if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _zp; return _vfi;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (void *)this;
#endif
}
//@}
/***********************************************/
/** @name Vertex-Tetrahedron Adjacency
blah
blah
**/
//@{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
// Pointer to first tetrahedron of the start implements the Vertex-Tetrahedron Topology
protected:
VTTYPE *_vtb;
int _vti;
#endif
public:
inline VTTYPE * & VTb()
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vtb;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return *((VTTYPE **)(_flags));
#endif
}
inline const VTTYPE * & VTb() const
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vtb;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (VTTYPE *)this;
#endif
}
inline int & VTi()
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vti;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return _flags;
#endif
}
inline const int & VTi() const
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vti;
#else #else
assert(0);// you are probably trying to use VF topology in a vertex without it assert(0);// you are probably trying to use VF topology in a vertex without it
return (void *)this; return (void *)this;
@ -411,13 +474,13 @@ inline const int & Zp() const
**/ **/
//@{ //@{
#ifdef __VCGLIB_VERTEX_M #ifdef __VCGLIB_VERTEX_VM
protected: protected:
/// The incremental vertex mark /// The incremental vertex mark
int _imark; int _imark;
#endif // Mark #endif // Mark
public: public:
#ifdef __VCGLIB_VERTEX_M #ifdef __VCGLIB_VERTEX_VM
/// This function return the vertex incremental mark /// This function return the vertex incremental mark
inline int & IMark() inline int & IMark()
{ {
@ -439,7 +502,7 @@ public:
/// Initialize the _imark system of the vertex /// Initialize the _imark system of the vertex
inline void InitIMark() inline void InitIMark()
{ {
#ifdef __VCGLIB_VERTEX_M #ifdef __VCGLIB_VERTEX_VM
_imark = 0; _imark = 0;
#endif #endif
} }
@ -453,7 +516,7 @@ public:
**/ **/
//@{ //@{
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
protected: protected:
CoordType _n; CoordType _n;
#endif #endif
@ -465,7 +528,7 @@ public:
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 ); assert( (_flags & NOTWRITE) == 0 );
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return _n; return _n;
#else #else
assert(0); assert(0);
@ -478,7 +541,7 @@ public:
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return _n; return _n;
#else #else
assert(0); assert(0);
@ -490,7 +553,7 @@ public:
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return _n; return _n;
#else #else
return CoordType(0,0,0); return CoordType(0,0,0);
@ -499,7 +562,7 @@ public:
/// Return the Normal of the vertex /// Return the Normal of the vertex
inline CoordType & UberN() inline CoordType & UberN()
{ {
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return _n; return _n;
#else #else
assert(0); assert(0);
@ -510,7 +573,7 @@ public:
/// Return the constant normal of the vertex /// Return the constant normal of the vertex
inline const CoordType & UberN() const inline const CoordType & UberN() const
{ {
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return _n; return _n;
#else #else
assert(0); assert(0);
@ -527,42 +590,49 @@ Reflection is a mechanism making it possible to investigate yourself. Reflection
//@{ //@{
static bool HasNormal() { static bool HasNormal() {
#ifdef __VCGLIB_VERTEX_N #ifdef __VCGLIB_VERTEX_VN
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasColor() { static bool HasColor() {
#ifdef __VCGLIB_VERTEX_C #ifdef __VCGLIB_VERTEX_VC
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasMark() { static bool HasMark() {
#ifdef __VCGLIB_VERTEX_M #ifdef __VCGLIB_VERTEX_VM
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasQuality() { static bool HasQuality() {
#ifdef __VCGLIB_VERTEX_Q #ifdef __VCGLIB_VERTEX_VQ
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasTexture() { static bool HasTexture() {
#ifdef __VCGLIB_VERTEX_T #ifdef __VCGLIB_VERTEX_VT
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasVFAdjacency() { static bool HasVFAdjacency() {
#ifdef __VCGLIB_VERTEX_A #ifdef __VCGLIB_VERTEX_AF
return true;
#else
return false;
#endif
}
static bool HasVTAdjacency() {
#ifdef __VCGLIB_VERTEX_AT
return true; return true;
#else #else
return false; return false;
@ -584,7 +654,7 @@ inline Convert( VERT_TYPE &v )
N()=v.N(); N()=v.N();
if ((HasColor())&&(v.HasColor())) if ((HasColor())&&(v.HasColor()))
C()=v.C(); C()=v.C();
#ifdef __VCGLIB_VERTEX_M #ifdef __VCGLIB_VERTEX_VM
if ((HasMark())&&(v.HasMark())) if ((HasMark())&&(v.HasMark()))
IMark()=v.IMark(); IMark()=v.IMark();
#endif #endif