vertex.h

Go to the documentation of this file.
00001 // Author: Justin Kinney
00002 // Date: Sep 2008
00003 
00004 #ifndef VERTEX_H
00005 #define VERTEX_H 1
00006 
00007 #include "meshmorph.h"
00008 
00009 #include "face.h"
00010 #include "object.h"
00011 
00012 class Vertex
00013 {
00014 private:
00015   int     index; // from file, unaltered
00016   Face *     cl; // pointer to face on which closest mesh position lies
00017   Object *    o; // pointer to parent object
00018   vec_fp      f; // pointers to adjacent faces
00019   vector3     n; // vertex normal
00020   vector3     p; // current position coordinates (x,y,z)
00021   int         r; // last refractory iteration
00022 public:
00023   Vertex                                (int const &,double const & x,double const & y,double const & z,Object * const);
00024 //  Vertex                                (int,double x,double y,double z,Object * const);
00025   //Vertex                                (char const * triplet,Object * const);
00026   Vertex                                (Vertex const &);
00027   Vertex & operator =                   (Vertex const &);
00028   void    print                         (std::ostream &) const;
00029   void    printCP                       (std::ostream &) const;
00030   void    setNewPos                     (vector3 const * const);
00031   void    setNormal                     (void);
00032   void    getBoundingBox                (vector3 &,vector3 &) const;
00033   void    updateAdjFaceBoundingBoxes    (void);
00034   void    defineLocalRegion             (vector3 &,vector3 &);
00035   void    getAdjVertices                (vec_vp&) const;
00036   void    getAdjacentEdges              (vec_ep&) const;
00037   double  getSqSepDist                  (void) const; 
00038   double  getSqVirtualDisp              (double);
00039   vector3 getNewPos                     (double);
00040   void    recordAdjFaceBoundingBoxes    (hxa7241_graphics::Vector3r * const adjacent_face_lower,
00041                                          hxa7241_graphics::Vector3r * const adjacent_face_upper);
00042   // force
00043   void    getTotalForceEnergy           (vector3 &) const;
00044   void    getAdjFaceIntForce            (vector3 &) const;
00045   double  getEcwForceEnergy             (vector3 &,bool) const;
00046   double  getEdgeStretchForceEnergy     (vector3 &,bool) const;
00047   double  getFaceAspectRatioForceEnergy (vector3 &,bool) const;
00048   double  getEdgeAngleForceEnergy       (vector3 &,bool) const;
00049   Face *  getFaceNotAdjToVertex         (Vertex const * const) const;
00050   void    updateAdjacentFaceNormals     (void);
00051 
00052 
00053   int getLastRefractoryIter (void)
00054   {
00055     return r;
00056   }
00057 
00058   void setLastRefractoryIter (int i)
00059   {
00060     r = i;
00061   }
00062 
00066   void sortAdjacentFaces (void)
00067   {
00068     sort(f.begin(),f.end());
00069   }
00070 
00077   vector3 getNormal (void) const
00078   {
00079     return n;
00080   }
00081 
00087   int getIndex (void) const
00088   {
00089     return index;
00090   }
00091 
00096   int getNumAdjFaces (void) const
00097   {
00098     return f.size();
00099   }
00100 
00107   bool faceIsAdjacent (Face * face) const
00108   {
00109     return binary_search(f.begin(),f.end(),face);
00110   }
00111 
00119   bool isMatch (int const & i, std::string const & name) const
00120   {
00121     return i==index && name==o->getName();
00122   }
00123 
00128   void addAdjacentFace (Face * face)
00129   {
00130     f.push_back(face);
00131   }
00132 
00138   double const * getCoord (int const & axis) const
00139   {
00140     return &p.p[axis];
00141   }
00142 
00148   Face * getClosestFace (void)
00149   {
00150     return cl;
00151   }
00152 
00158   void setFace (Face * const face)
00159   {
00160     cl=face;
00161   }
00162 
00167   vector3 const * getPos (void) const
00168   {
00169     return &p;
00170   }
00171 
00178   void setPos (double const & x, double const & y, double const & z)
00179   {
00180     p.p[0] = x;
00181     p.p[1] = y;
00182     p.p[2] = z;
00183   }
00184 
00189   Object const * getObject (void) const
00190   {
00191     return o;
00192   }
00193 
00199   fp_cit begin (void) const
00200   {
00201     return f.begin();
00202   }
00203 
00209   fp_cit end (void) const
00210   {
00211     return f.end();
00212   }
00213 };
00214 
00215 struct my_ltv
00216 {
00217   bool operator () (const Vertex * s1, const Vertex * s2) const
00218   {
00219     return s1->getIndex()<s2->getIndex();
00220   }
00221 };
00222 
00223 #endif

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