name of adhacency function updated

This commit is contained in:
ganovelli 2004-05-10 14:41:45 +00:00
parent bb2b0a2013
commit b8463d106f
4 changed files with 57 additions and 48 deletions

View File

@ -154,7 +154,7 @@ static EdgeIterator AddEdges(MeshType &m, int n, PointerUpdater<EdgePointer> &pu
m.edges.back().ClearFlags(); m.edges.back().ClearFlags();
} }
m.fn+=n; m.en+=n;
pu.newBase = &*m.edges.begin(); pu.newBase = &*m.edges.begin();
@ -166,16 +166,16 @@ static EdgeIterator AddEdges(MeshType &m, int n, PointerUpdater<EdgePointer> &pu
{ {
if(EdgeType::HasEEAdjacency()) if(EdgeType::HasEEAdjacency())
{ {
pu.Update((*ei).E(0)); pu.Update((*ei).EEp(0));
pu.Update((*ei).E(1)); pu.Update((*ei).EEp(1));
} }
} }
VertexIterator ei; VertexIterator vi;
for (ei=m.vert.begin(); ei!=m.vert.end(); ++ei) for (vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
if(!(*ei).IsD()) if(!(*vi).IsD())
{ {
if(VertexType::HasVEAdjacency()) if(VertexType::HasVEAdjacency())
pu.Update((*ei).Ep()); pu.Update((*vi).Ep());
} }
// e poiche' lo spazio e' cambiato si ricalcola anche last da zero // e poiche' lo spazio e' cambiato si ricalcola anche last da zero
unsigned int siz=m.edges.size()-n; unsigned int siz=m.edges.size()-n;

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.1 2004/04/26 19:10:04 ganovelli
created
****************************************************************************/ ****************************************************************************/
@ -33,8 +36,8 @@ $Log: not supported by cvs2svn $
People should subclass his vertex class from these one... People should subclass his vertex class from these one...
*/ */
#ifndef __VCGLIB_POLYLINE #ifndef __VCGLIB_EDGEMESH
#define __VCGLIB_POLYLINE #define __VCGLIB_EDGEMESH
namespace vcg { namespace vcg {
namespace edge { namespace edge {
@ -47,7 +50,7 @@ namespace edge {
@param STL_FACE_CONT (Template Parameter) Specifies the type of the faces container any the face type. @param STL_FACE_CONT (Template Parameter) Specifies the type of the faces container any the face type.
*/ */
template < class VertContainerType, class EdgeContainerType > template < class VertContainerType, class EdgeContainerType >
class Polyline{ class EdgeMesh{
public: public:
typedef EdgeContainerType EdgeContainer; typedef EdgeContainerType EdgeContainer;
typedef VertContainerType VertContainer; typedef VertContainerType VertContainer;
@ -61,7 +64,7 @@ class Polyline{
typedef typename EdgeContainerType::const_iterator ConstEdgeIterator; typedef typename EdgeContainerType::const_iterator ConstEdgeIterator;
typedef VertexType * VertexPointer; typedef VertexType * VertexPointer;
typedef const VertexType * ConstVertexPointer; typedef const VertexType * ConstVertexPointer;
typedef EdgeType * SrgmentPointer; typedef EdgeType * EdgePointer;
typedef const EdgeType * ConstEdgePointer; typedef const EdgeType * ConstEdgePointer;
typedef Box3<ScalarType> BoxType; typedef Box3<ScalarType> BoxType;
@ -70,7 +73,7 @@ class Polyline{
/// Real number of vertices /// Real number of vertices
int vn; int vn;
/// Set of faces /// Set of faces
EdgeContainer segment; EdgeContainer edges;
/// Real number of faces /// Real number of faces
int en; int en;
/// Bounding box of the mesh /// Bounding box of the mesh
@ -100,7 +103,7 @@ public:
/// Default constructor /// Default constructor
Polyline() EdgeMesh()
{ {
en = vn = 0; en = vn = 0;
imark = 0; imark = 0;
@ -108,7 +111,7 @@ public:
inline int MemUsed() const inline int MemUsed() const
{ {
return sizeof(Polyline)+sizeof(VertexType)*vert.size()+sizeof(EdgeType)*segment.size(); return sizeof(Polyline)+sizeof(VertexType)*vert.size()+sizeof(EdgeType)*edges.size();
} }
inline int MemNeeded() const inline int MemNeeded() const
@ -122,7 +125,7 @@ public:
void Clear() void Clear()
{ {
vert.clear(); vert.clear();
segment.clear(); edges.clear();
// textures.clear(); // textures.clear();
// normalmaps.clear(); // normalmaps.clear();
vn = 0; vn = 0;
@ -141,9 +144,9 @@ static bool HasPerEdgeNormal() { return EdgeType::HasEdgeNormal() ; }
static bool HasPerEdgeMark() { return EdgeType::HasEdgeMark() ; } static bool HasPerEdgeMark() { return EdgeType::HasEdgeMark() ; }
static bool HasPerEdgeQuality() { return EdgeType::HasEdgeQuality(); } static bool HasPerEdgeQuality() { return EdgeType::HasEdgeQuality(); }
static bool HasSSTopology() { return EdgeType::HasSSAdjacency(); } static bool HasEETopology() { return EdgeType::HasEEAdjacency(); }
static bool HasVSTopology() { return FaceType::HasVSAdjacency(); } static bool HasVETopology() { return FaceType::HasVEAdjacency(); }
static bool HasTopology() { return HasSSTopology() || HasVSTopology(); } static bool HasTopology() { return HasEETopology() || HasVETopology(); }
/// Initialize the imark-system of the faces /// Initialize the imark-system of the faces
@ -151,7 +154,7 @@ void InitEdgeIMark()
{ {
EdgeIterator f; EdgeIterator f;
for(f=segment.begin();f!=segment.end();++f) for(f=edges.begin();f!=edges.end();++f)
if( !(*f).IsDeleted() && (*f).IsR() && (*f).IsW() ) if( !(*f).IsDeleted() && (*f).IsR() && (*f).IsW() )
(*f).InitIMark(); (*f).InitIMark();
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.2 2004/05/10 14:02:29 ganovelli
created
Revision 1.1 2004/04/26 19:04:23 ganovelli Revision 1.1 2004/04/26 19:04:23 ganovelli
created created
@ -350,7 +353,7 @@ const Color4b WC(const int i) const
**/ **/
//@{ //@{
#if (defined(__VCGLIB_EDGE_EA) && defined(__VCGLIB_EDGE_SA)) #if (defined(__VCGLIB_EDGE_AE) && defined(__VCGLIB_EDGE_SA))
#error Error: You cannot specify face-to-face and shared topology together #error Error: You cannot specify face-to-face and shared topology together
#endif #endif
@ -359,7 +362,7 @@ const Color4b WC(const int i) const
#endif #endif
protected: protected:
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
/// Vector of face pointer, it's used to indicate the adjacency relations (defines if FACE_A is defined) /// Vector of face pointer, it's used to indicate the adjacency relations (defines if FACE_A is defined)
EDGENAME *ee[3]; // Facce adiacenti EDGENAME *ee[3]; // Facce adiacenti
/// Index of the face in the arrival face /// Index of the face in the arrival face
@ -382,17 +385,17 @@ public:
/** Return the pointer to the j-th adjacent face. /** Return the pointer to the j-th adjacent edge.
@param j Index of the edge. @param j Index of the edge.
*/ */
inline EDGENAME * & E( const int j ) inline EDGENAME * & EEp( const int j )
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 ); assert( (_flags & NOTWRITE) == 0 );
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return ee[j]; return ee[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return es[j]; return es[j];
@ -403,13 +406,13 @@ public:
#endif #endif
} }
inline const EDGENAME * const & E( const int j ) const inline const EDGENAME * const & EEp( const int j ) const
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return ee[j]; return ee[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return es[j]; return es[j];
@ -418,17 +421,17 @@ public:
return (EDGENAME *)this; return (EDGENAME *)this;
#endif #endif
} }
inline EDGENAME * & E1( const int j ) { return F((j+1)%2);} inline EDGENAME * & EEp1( const int j ) { return EEp((j+1)%2);}
inline const EDGENAME * const& E1( const int j ) const { return F((j+1)%2);} inline const EDGENAME * const& EEp1( const int j ) const { return EEp((j+1)%2);}
/** Return the pointer to the j-th adjacent face. /** Return the pointer to the j-th adjacent face.
@param j Index of the edge. @param j Index of the edge.
*/ */
inline EDGENAME * & UberE( const int j ) inline EDGENAME * & UberEEp( const int j )
{ {
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return ee[j]; return ee[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return es[j]; return es[j];
@ -438,11 +441,11 @@ public:
#endif #endif
} }
inline const EDGENAME * const & UberE( const int j ) const inline const EDGENAME * const & UberEEp( const int j ) const
{ {
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return ee[j]; return ee[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return es[j]; return es[j];
@ -453,7 +456,7 @@ public:
} }
inline EDGENAME * & Ev( const int j ) inline EDGENAME * & VEp( const int j )
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
@ -470,7 +473,7 @@ public:
#endif #endif
} }
inline const EDGENAME * const & Ev( const int j ) const inline const EDGENAME * const & VEp( const int j ) const
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
@ -490,14 +493,14 @@ public:
/** Return the index that the face have in the j-th adjacent face. /** Return the index that the face have in the j-th adjacent face.
@param j Index of the edge. @param j Index of the edge.
*/ */
inline char & Z( const int j ) inline char & EEi( const int j )
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 ); assert( (_flags & NOTWRITE) == 0 );
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return zs[j]; return zs[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return zs[j]; return zs[j];
@ -507,13 +510,13 @@ public:
#endif #endif
} }
inline const char & Z( const int j ) const inline const char & EEi( const int j ) const
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return zs[j]; return zs[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return zs[j]; return zs[j];
@ -530,7 +533,7 @@ public:
{ {
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return zs[j]; return zs[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return zs[j]; return zs[j];
@ -544,7 +547,7 @@ public:
{ {
assert(j>=0); assert(j>=0);
assert(j<2); assert(j<2);
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return zs[j]; return zs[j];
#elif defined(__VCGLIB_EDGE_SA) #elif defined(__VCGLIB_EDGE_SA)
return zs[j]; return zs[j];
@ -555,7 +558,7 @@ public:
} }
inline char & Zv( const int j ) inline char & VEi( const int j )
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
@ -572,7 +575,7 @@ public:
#endif #endif
} }
inline const char & Zv( const int j ) const inline const char & VEi( const int j ) const
{ {
assert( (_flags & DELETED) == 0 ); assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 ); assert( (_flags & NOTREAD) == 0 );
@ -796,21 +799,21 @@ static bool HasEdgeColor() {
#endif #endif
} }
static bool HasEEAdjacency() { static bool HasEEAdjacency() {
#if (defined(__VCGLIB_EDGE_EA) || defined(__VCGLIB_EDGE_EA)) #if (defined(__VCGLIB_EDGE_AE) || defined(__VCGLIB_EDGE_AE))
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasVEAdjacency() { static bool HasVEAdjacency() {
#if (defined(__VCGLIB_EDGE_VA) || defined(__VCGLIB_EDGE_EA)) #if (defined(__VCGLIB_EDGE_VA) || defined(__VCGLIB_EDGE_AE))
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
static bool HasSharedAdjacency() { static bool HasSharedAdjacency() {
#if defined(__VCGLIB_EDGE_EA) #if defined(__VCGLIB_EDGE_AE)
return true; return true;
#else #else
return false; return false;

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.1 2004/05/10 14:01:56 ganovelli
created
****************************************************************************/ ****************************************************************************/
@ -60,8 +63,8 @@ public:
void NextF() void NextF()
{ {
EDGETYPE * t = e; EDGETYPE * t = e;
e = (EDGETYPE *)t->Ev(z); e = (EDGETYPE *)t->VEp(z);
z = t->Zv(z); z = t->VEi(z);
} }
}; };
@ -156,7 +159,7 @@ public:
void FlipE() void FlipE()
{ {
assert( (e->V(0)==v) ||(e->V(1)==v)); assert( (e->V(0)==v) ||(e->V(1)==v));
e = (e->V(0)==v)?e->E(0):e->E(1); e = (e->V(0)==v)?e->EEp(0):e->EEp(1);
} }
int Z(){ int Z(){
return (e->V(0)==v)?0:1; return (e->V(0)==v)?0:1;