00001
00002
00003
00004 #ifndef STATE_H
00005 #define STATE_H 1
00006
00007 #include "meshmorph.h"
00008
00009 #include "Vector3r.h"
00010
00011 typedef __gnu_cxx::hash_map<Edge*,int,e_hash,eqe> hmap_e;
00012 typedef __gnu_cxx::hash_map<Edge*,float,e_hash,eqe> hmap_e_d;
00013 typedef __gnu_cxx::hash_map<Edge*,float,e_hash,eqe>::iterator edhm_it;
00014 typedef __gnu_cxx::hash_map<Edge*,float,e_hash,eqe>::const_iterator edhm_cit;
00015
00016 struct Search_Stats
00017 {
00018 int fs_changed;
00019 int ps_changed;
00020 int fs_changed_adj;
00021
00022 int ps_changed_adj;
00023
00024 };
00025
00026 class State
00027 {
00028 private:
00029 static State * only_one;
00030 vec_ep ae;
00031 hmap_e_d ea;
00032
00033
00034 float vd2;
00035 State (void);
00036 State (State const &);
00037 State & operator = (State const &);
00038 ~State (void);
00039 public:
00040 static State & instance (void);
00041 v_set getVertsForFullClosestPtSearch (Vertex const * const,
00042 vector3 const &,
00043 vector3 const &);
00044 v_set getVertsForPartialClosestPtSearch (vector3 const &,
00045 vector3 const &);
00046 void recordVertAdjFaceEdgeAngles (Vertex const * const);
00047 Search_Stats updateClosestFaceToVertices (Vertex * const,
00048 v_set &,
00049 v_set &);
00050 void updateAdjacentFacesInTree (Vertex const * const);
00051 void updateVertexVD (Vertex * const);
00052 bool extremeAngleFound (void) const;
00053 bool assignNewVertexCoords (Vertex * const,
00054 vector3 const * const,
00055 vector3 const &,
00056 bool &,
00057 bool &,
00058 bool &);
00059 bool angleChangeIsWrong (float const &,float const &) const;
00060 bool vertexOutsideOctreeBounds (vector3 const * const);
00061 void updateVertexNormals (v_set & fs);
00062 void updateAdjacentFacesInOctree (Vertex * const v,
00063 hxa7241_graphics::Vector3r * const adjacent_face_lower,
00064 hxa7241_graphics::Vector3r * const adjacent_face_upper);
00065 void updateOctree (Vertex * const v,
00066 hxa7241_graphics::Vector3r * const old_adjacent_face_lower,
00067 hxa7241_graphics::Vector3r * const old_adjacent_face_upper,
00068 hxa7241_graphics::Vector3r * const new_adjacent_face_lower,
00069 hxa7241_graphics::Vector3r * const new_adjacent_face_upper);
00070
00075 float getVD2 (void)
00076 {
00077 return vd2;
00078 }
00079
00084 void setVD2 (float const & sqd_disp)
00085 {
00086 vd2 = sqd_disp;
00087 }
00088 };
00089
00090 #endif