00001
00002
00003
00004 #ifndef INTERSECTING_FACES_H
00005 #define INTERSECTING_FACES_H 1
00006
00007 #include "meshmorph.h"
00008
00009 typedef __gnu_cxx::hash_map<Face*,vec_fp,f_hash,eqf> hmap_f_f;
00010 typedef __gnu_cxx::hash_map<Face*,vec_fp,f_hash,eqf>::iterator htff_it;
00011 typedef __gnu_cxx::hash_map<Face*,vec_fp,f_hash,eqf>::const_iterator htff_cit;
00012 typedef __gnu_cxx::hash_set<Vertex*,v_hash,eqv>::iterator hv_it;
00013
00014 class Intersecting_Faces
00015 {
00016 private:
00017 hmap_f_f intf;
00018
00019
00020 static Intersecting_Faces * only_one;
00021 Intersecting_Faces (void);
00022 Intersecting_Faces (Intersecting_Faces const &);
00023 Intersecting_Faces & operator = (Intersecting_Faces const &);
00024 ~Intersecting_Faces (void);
00025 public:
00026 static Intersecting_Faces & instance (void);
00027 vec_fp * getIntersectingFacesRHS (Face const * const);
00028 int getNumUniqueVerts (Face const * const,
00029 Face const * const,
00030 int * const) const;
00031 int getCountOfIntFaces (bool);
00032 bool checkFaceEdgeInt (Face const * const,
00033 Face const * const) const;
00034 bool checkEdgeEdgeIntersection (Face const * const,
00035 Face const * const) const;
00036 bool facesParallel (Face const * const,
00037 Face const * const) const;
00038 bool facesCoplanar (Face const * const,
00039 Face const * const) const;
00040 bool faceIntersectsFace (Face const * const haystack,
00041 Face const * const needle);
00042 bool faceIsIntersectedRHS (Face const * const) const;
00043 bool findAndRecordNewFaceInt (Face * const);
00044 bool vertAdjFacesHaveNewInt (Vertex const * const);
00045 bool checkFaceFaceInts (Face const * const,
00046 Face const * const) const;
00047 bool detectNewFaceInts (Face * const);
00048 void getNiceSet (v_set &,hashset_v &);
00049 hashset_v getNiceCheckSet (Vertex const * const);
00050 void addFaceToFace (Face * const,Face const * const);
00051 void removeOldIntersections (Vertex const * const,hashset_v &);
00052 void updateNewIntersections (Vertex const * const,hashset_v &);
00053 void findAllFaceIntersections (void);
00054 void setFaceNotIntersectedLHS (Face const * const);
00055 void removeFaceFromFaceInt (Face * const haystack,
00056 Face const * const needle);
00057
00058 void getFaceIntersectionForce (Face * const f,
00059 vector3 & total_force);
00060 void getFaceFaceIntForce (Face * const lhs,
00061 Face * const rhs,
00062 vector3 &);
00063
00070 bool faceIsIntersectedLHS (Face const * const face) const
00071 {
00072 return intf.find(const_cast<Face*>(face))!=intf.end();
00073 }
00074
00079 htff_cit begin (void)
00080 {
00081 return intf.begin();
00082 }
00083
00088 htff_cit end (void)
00089 {
00090 return intf.end();
00091 }
00092
00093 };
00094
00095 #endif