![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsAbstractPolyhedron.hpp 00003 00004 AbstractPolyhedron class is a class for an AbstractPolyhedron. 00005 00006 SUKITTI PUNAK (09/13/2005) 00007 UPDATE (09/30/2005) 00008 ******************************************************************************/ 00009 #ifndef TAPs_ABSTRACT_POLYHEDRON_HPP 00010 #define TAPs_ABSTRACT_POLYHEDRON_HPP 00011 00012 #include "../../Core/TAPsLib.hpp" 00013 #include <vector> 00014 00015 BEGIN_NAMESPACE_TAPs 00016 //============================================================================= 00017 template <typename T> 00018 class AbstractPolyhedron { 00019 //============================================================================= 00020 // Data Members 00021 protected: 00022 std::vector< Vector3<T> > m_vVertex; // list of vertices 00023 std::vector< Vector3<T> > m_vVertexNormal; // list of vertex normals 00024 std::vector< Vector3<T> > m_vFaceNormal; // list of face normals 00025 /* This has to be defined and used in subclass 00026 static bool m_gbHasBeenSet; // for determining whether to set static members 00027 typedef typename std::vector<int> LIST; 00028 static std::vector< LIST > m_vVertexValence;// list of vertex valence 00029 static std::vector< LIST > m_vVertexFace; // list of faces having the vertex 00030 static std::vector< LIST > m_vFace; // list of vertices comprising the face 00031 static std::vector< LIST >::const_iterator m_itor; // iterator 00032 //*/ 00033 //============================================================================= 00034 // Member Functions 00035 public: 00036 //------------------------------------------------------------------------- 00037 // Output Operator << 00038 friend std::ostream & operator<< ( std::ostream &output, AbstractPolyhedron<T> const &obj ) 00039 { 00040 output << "AbstractPolyhedron<" << typeid(T).name() 00041 // << "> with " << static_cast<int>(obj.m_vVertices.size()) << " nodes:" 00042 // << "\n"; 00043 //for ( int i = 0; i < static_cast<int>(obj.m_vVertices.size()); ++i ) { 00044 // output << " Node#" << i << ": " << obj.m_vVertices[i]; 00045 //} 00046 return output; 00047 } 00048 //------------------------------------------------------------------------- 00049 // Constructors and Destructor 00050 protected: 00051 AbstractPolyhedron ( int iNumVertices, int iNumFaces ); 00052 virtual ~AbstractPolyhedron (); 00053 //------------------------------------------------------------------------- 00054 // Helper Function(s) 00055 virtual void Setup () = 0; 00056 virtual void CalNormals () = 0; 00057 //------------------------------------------------------------------------- 00058 #if defined(__gl_h_) || defined(__GL_H__) 00059 public: 00060 // DrawByOpenGL 00061 virtual void DrawByOpenGL () = 0; 00062 void DrawVertexNormals (); 00063 void DrawFaceNormals (); 00064 #endif 00065 //------------------------------------------------------------------------- 00066 }; // END CLASS AbstractPolyhedron 00067 //============================================================================= 00068 END_NAMESPACE_TAPs 00069 //----------------------------------------------------------------------------- 00070 // Include definition if TAPs_USE_EXPORT is not defined 00071 //#if !defined( TAPs_USE_EXPORT ) 00072 #include "TAPsAbstractPolyhedron.cpp" 00073 //#endif 00074 //----------------------------------------------------------------------------- 00075 #endif 00076 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00077 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8