container.h

Go to the documentation of this file.
00001 // Author: Justin Kinney
00002 // Date: Sep 2008
00003 
00004 #ifndef CONTAINER_H
00005 #define CONTAINER_H 1
00006 
00007 #include "meshmorph.h"
00008 
00009 #include "octree_visitor_face.h"
00010 
00011 typedef std::multimap<Object*,int,lto>            mmap_oi;
00012 typedef std::multimap<Object*,int,lto>::iterator  oi_it;
00013 
00014 struct Complex
00015 {
00016   Object * o;
00017   int index;
00018   Complex (Object *oo,int i)
00019         :o(oo),index(i)
00020   {
00021   }
00022 };
00023 
00024 class Container
00025 {
00026 private:
00027   static Container * only_one;
00028   Object     *fo; // pointer to first object to detect vector copies
00029   vec_s    files; // array of input file names
00030   vec_vp  frozen; // sorted vector of Vertex* to frozen vertices
00031   vec_d    world; // minX, maxX, minY, maxY, minZ, maxZ of world
00032   Container                        (void);
00033   Container                        (Container const &);
00034   Container & operator =           (Container const &);
00035   ~Container                       (void);
00036 public:
00037   hxa7241_graphics::Octree<Face> * octree;
00038   vec_o        o; //vector of object pointers
00039   static Container & instance                  (void);
00040   int      getVertexCount                      (void) const;
00041   int      getFaceCount                        (void) const;
00042   int      getEdgeCount                        (void) const;
00043   void     boundWorld                          (void);
00044   void     writeSummary                        (std::ostream &);
00045   void     scanDir                             (void);
00046   void     scanFiles                           (void);
00047   void     assessFile                          (Object * const,char const *);
00048   void     scanFile                            (Object * const,char const *);
00049   void     computeVertexNormals                (void);
00050   void     createEdges                         (void);
00051   void     findVertAdj                         (void);
00052   void     readFrozen                          (char const *);
00053   void     sortAdjacentFaces                   (void);
00054   void     deleteme_checkClosestFace           (int const &,int const &,std::string);
00055   void     checkClosestFace                    (int const &,std::string);
00056   void     checkClosestFace2                   (int const &,std::string);
00057   void     checkClosestFace3                   (int const &,std::string);
00058   void     checkFaces                          (std::string);
00059   void     checkFacesInOctree                  (void);
00060   void     printRegionInOctree                 (void);
00061   void     writeMeshData                       (int const &)  const;
00062   void     findClosestFaceToEachVertex         (void);
00063   void     findClosestPtInFaceToLocation       (vector3 const & pt,
00064                                                 Face const * const face,
00065                                                 vector3 & p,
00066                                                 double & squareD) const;
00067   void     findPtInFaceWhereNormalInt          (vector3 const & pt,
00068                                                 vector3 n,
00069                                                 double const &,
00070                                                 Face const * const face,
00071                                                 vector3 & p,
00072                                                 double & squareD) const;
00073   bool     faceLiesOppositeToNormal            (vector3 const &,
00074                                                 Face const * const face,
00075                                                 vector3 const & n) const;
00076   bool     boundingBoxFullyInSearchRegion      (vec_d const & sr,
00077                                                 vec_d const & bb) const;
00078   bool     vertexOutsideOctreeBounds           (vector3 const * const new_pos);
00079   bool     closestPtIsInSearchCone             (vector3 const & pt,
00080                                                 vector3 const & p,
00081                                                 vector3 const & n,
00082                                                 double const &) const;
00083   bool     findClosestPtToBarycenterAmongFaces (vector3 const &,Face * const f,
00084                                                 fp_cit,fp_cit,
00085                                                 double const & cone_radius,
00086                                                 vector3 &,
00087                                                 double &,
00088                                                 Face * &,int &) const;
00089   bool     findClosestPtToVertexAmongFaces     (Vertex const * const,
00090                                                 fp_cit,
00091                                                 fp_cit,
00092                                                 double const &,
00093                                                 vector3 &,
00094                                                 double &,
00095                                                 Face * &,int &) const;
00096   bool     findClosestPtToVertex               (Vertex const * const,
00097                                                 vector3 &,double &,
00098                                                 Face * &) const;
00099   bool     findClosestPtToBarycenter           (vector3 const & pt,Face * const f,
00100                                                 vector3 &,double &,
00101                                                 Face * &) const;
00102   double   getMinEdgeAngle                     (void) const;
00103   double   getWorld                            (int const &) const;
00104   vec_d    getSphericalConeBoundingBox         (vector3 const & pt,
00105                                                 vector3 n,
00106                                                 double const & cone_radius) const;
00107   mmap_oi  loadMap                       (char const *,s_set &);
00108   Object * getObjectPointer                    (std::string) const;
00109 //  vec_d    getTruncatedConeBoundingBox         (vector3 const & pt,
00110 //                                                vector3 n,
00111 //                                                double const &) const;
00112 
00113   std::vector<Complex> loadVector              (const char *filename,s_set & not_found);
00119   bool vertexIsFrozen (Vertex * const v) const
00120   {
00121     return binary_search(frozen.begin(),frozen.end(),v);
00122   }
00123 
00128   int getFileCount (void) const
00129   {
00130     return files.size();
00131   }
00132 };
00133 
00134 #endif

Generated on Fri Feb 13 13:58:10 2009 for meshmorph by  doxygen 1.5.1