00001 // Author: Justin Kinney 00002 // Date: Sep 2008 00003 00004 #ifndef OCTREE_VISITOR_FACE_H 00005 #define OCTREE_VISITOR_FACE_H 00006 00007 #include "meshmorph.h" 00008 00009 #include "face.h" 00010 #include "Octree.h" 00011 #include <iostream> 00012 00013 using hxa7241_graphics::OctreeVisitor; 00014 using hxa7241_graphics::Vector3r; 00015 using hxa7241_graphics::OctreeCell; 00016 using hxa7241_graphics::OctreeData; 00017 using hxa7241_graphics::Array; 00018 using hxa7241_graphics::OctreeRoot; 00019 using hxa7241_graphics::dword; 00020 using hxa7241_graphics::OctreeBranch; 00021 00022 00023 class Octree_Visitor_Face 00024 : public OctreeVisitor<Face> 00025 { 00027 public: 00028 Octree_Visitor_Face(Vector3r,Vector3r); 00029 00030 virtual ~Octree_Visitor_Face(); 00031 00032 //void print (void) 00033 //{ 00034 // for (fp_it i=matches.begin();i!=matches.end();i++) 00035 // { 00036 // (*i)->print(std::cout); 00037 // } 00038 //} 00039 00040 fp_it mybegin (void) 00041 { 00042 return matches.begin(); 00043 } 00044 00045 fp_it myend (void) 00046 { 00047 return matches.end(); 00048 } 00049 // void sort (void) 00050 // { 00051 // std::sort(matches.begin(),matches.end()); 00052 // matches.assign(matches.begin(),unique(matches.begin(),matches.end())); 00053 // } 00054 int num_faces (void) 00055 { 00056 return matches.size(); 00057 } 00058 int num_leaves (void) 00059 { 00060 return leaves_visited; 00061 } 00062 // virtual void dump_(std::string const &indent); 00063 // void dump_node(std::string const &indent); 00064 // void dump_leaf(std::string const &indent); 00065 private: 00066 Octree_Visitor_Face( const Octree_Visitor_Face& ); 00067 Octree_Visitor_Face& operator=( const Octree_Visitor_Face& ); 00068 00069 00072 protected: 00073 virtual void visitRoot ( const OctreeCell* pRootCell, 00074 const OctreeData& octreeData ); 00075 virtual void visitBranch( const OctreeCell* subCells[8], 00076 const OctreeData& octreeData ); 00077 virtual void visitLeaf ( const Array<const Face*>& items, 00078 const OctreeData& octreeData ); 00079 00080 // any other commands ... 00081 00082 00084 // any queries ... 00085 00086 00088 private: 00089 Vector3r * mylower; 00090 Vector3r * myupper; 00091 // hashset_fp matches; 00092 vec_fp matches; 00093 int leaves_visited; 00094 }; 00095 00096 #endif