TAPs 0.7.7.3
TAPsVertexRings.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsVertexRings.hpp
00003 
00004 VertexRings class is a class for generic 3D vertex rings.
00005 
00006 Definition:
00007 ===========
00008 The data structure is similar to the data structure for sparse matrices:
00009     std::vector<int> m_viRingLayers contains the size of each ring:
00010         +-+-+-+-+ ... +-+-+
00011         |0|a|b|c| ... |k|n|
00012         +-+-+-+-+ ... +-+-+
00013         where a   is the number of vertices in the zeroth ring,
00014               b-a is the number of vertices in the first ring,
00015               c-b is the number of vertices in the second ring and so on,
00016               n-k is the number of vertices in the last ring.
00017         The number of rings is m_viRingLayers.size()-2.
00018     std::vector<int> m_viRingVertices contains the list of vertices:
00019         +-+-+-+-+ ... +-+
00020         |i|j|k|l| ... |m|
00021         +-+-+-+-+ ... +-+
00022         where each character represents the vertex number in a mesh model.
00023 
00024 SUKITTI PUNAK   (11/12/2004)
00025 UPDATE          (11/14/2004)
00026 ******************************************************************************/
00027 #ifndef TAPs_VERTEX_RINGS_HPP
00028 #define TAPs_VERTEX_RINGS_HPP
00029 
00030 #include "../Core/TAPsStdLib.hpp"
00031 #include <vector>
00032 
00033 BEGIN_NAMESPACE_TAPs
00034 //=============================================================================
00035 class VertexRings {
00036 //=============================================================================
00037 protected:
00038     std::vector<int> m_viRingLayers;    // contains the size of each layer
00039     std::vector<int> m_viRingVertices;  // contains the list of vertices
00040     int * m_piFlagVertexNo;             // size must be number of vertices
00041     int m_iNoVertices;                  // number of vertices
00042     int m_iFlagStep;                    // flag step number
00043 
00044     // This pointer points to the first vertex ring of each vertex, must be known 
00045     // in advanced in order to use this VertexRings operations
00046     // e.g. in class XPolygonalModel has this vertex ring property (data member)
00047     //   std::vector<int> * m_pviVertexRing1List;   // neighbor vertices in ring 1
00048     std::vector<int> const * m_pviVertexRing1List;
00049 //=============================================================================
00050 public:
00051     //-------------------------------------------------------------------------
00052     // Output Operator <<
00053     friend std::ostream & operator<< ( std::ostream &output, VertexRings const &vr )
00054     {
00055         //------------------------------------------------------------
00056         // Display Vertex Rings
00057         output  << "VertexRings";
00058         //------------------------------------------------------------
00059         // Display Face Ring
00060         for ( int i = 0; i < static_cast<int>(vr.m_viRingLayers.size())-1; ++i ) {
00061             output << "\n  Ring#" << i << ":";
00062             for ( int j = vr.m_viRingLayers[i]; j < vr.m_viRingLayers[i+1]; ++j ) {
00063                 output << " " << vr.m_viRingVertices[j];
00064             }
00065         }
00066         return output;
00067     }
00068     //-------------------------------------------------------------------------
00069     // Constructors
00070     VertexRings ( std::vector<int> const * const pviVertexRing1List = NULL );   // default constructor
00071     VertexRings ( std::vector<int> const * const pviVertexRing1List, int iNoVertices ); // constructor
00072     virtual ~VertexRings ();    // destructor
00073     //-------------------------------------------------------------------------
00074     // Get/Set Fn(s)
00075     inline void SetExternalVertexRingInfo ( std::vector<int> * pviVertexRing1List )
00076         { m_pviVertexRing1List = pviVertexRing1List; }
00077     inline std::vector<int> & GetRingLayers()   { return m_viRingLayers; };
00078     inline std::vector<int> & GetRingVertices() { return m_viRingVertices; };
00079     inline int GetNoRings () const  { return static_cast<int>(m_viRingLayers.size())-2; }
00080     //void SetRingLayers ( std::vector<int> faceRing )      { m_viFaceRing = faceRing; }
00081     inline int GetSizeOfRingNo ( int i ) const 
00082         { return m_viRingLayers[i+1]-m_viRingLayers[i]; }
00083     std::vector<int> GetVertexListOfRingZero () const;
00084     //==========================================================================
00085     // OPERATIONS
00086     //-------------------------------------------------------------------------
00087     // Set vertex#i to the list of zeroth ring
00088     inline bool SetVertex ( int i );
00089     //-------------------------------------------------------------------------
00090     // Set vertices to the list of zeroth ring
00091         // v[] is the list of vertices to be set
00092         // size is the size of the list
00093     inline bool SetVertices ( int v[], int size );
00094     //-------------------------------------------------------------------------
00095     // Add vertex#i to the list of zeroth ring
00096     //inline bool AddVertex ( int i );
00097     //-------------------------------------------------------------------------
00098     // Add vertices to the list of zeroth ring
00099         // v[] is the list of vertices to be added
00100         // size is the size of the list
00101     //inline bool AddVertices ( int v[], int size );
00102     //-------------------------------------------------------------------------
00103     // Increase one layer
00104     bool IncreaseOneLayer ();
00105     bool IncreaseOneLayer ( int dummy );
00106     //-------------------------------------------------------------------------
00107     // Decrease one layer
00108     bool DecreaseOneLayer ();
00109     //-------------------------------------------------------------------------
00110     // Assignment Operator
00111 private:
00112     inline VertexRings & operator= ( VertexRings const &vr ) {}
00113     //-------------------------------------------------------------------------
00114 }; // END CLASS VertexRings
00115 //=============================================================================
00116 END_NAMESPACE_TAPs
00117 //-----------------------------------------------------------------------------
00118 // Include definition if TAPs_USE_EXPORT is not defined
00119 #if !defined( TAPs_USE_EXPORT )
00120     #include "TAPsVertexRings.cpp"
00121 #endif
00122 //-----------------------------------------------------------------------------
00123 #endif
00124 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00125 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines