00001
00002
00003
00004 #ifndef FACE_H
00005 #define FACE_H 1
00006
00007 #include <cmath>
00008
00009 #include "meshmorph.h"
00010
00011 #include "Vector3r.h"
00012 #include "vertex.h"
00013
00014 class Face
00015 {
00016 private:
00017 int index;
00018 bool flag;
00019 Edge * e[3];
00020 Vertex * v[3];
00021 vector3 n;
00022 public:
00023 Face & operator = (Face const &);
00024
00025 Face (int const &,int const &,int const &,int const &,vec_vp &);
00026 Face (Face const &);
00027 bool isMatch (int i, std::string const & name) const;
00028 void print (std::ostream &) const;
00029 void printCP (std::ostream &) const;
00030 void addEdge (Edge *);
00031 void getBoundingBox (hxa7241_graphics::Vector3r & lower,
00032 hxa7241_graphics::Vector3r & upper) const;
00033 void getVertexCoord (vector3 const * &,
00034 vector3 const * &,
00035 vector3 const * &) const;
00036 double getAngle (Vertex const * const v) const;
00037 double getAngleProxy (Vertex const * const) const;
00038 double getAspectRatio (vector3 &,Vertex const *&) const;
00039 double getAspectRatioForceEnergy (Vertex const * const v,
00040 vector3 & force,
00041 bool compute_force) const;
00042 void updateNormal (void);
00043
00048 bool getFlag (void) const
00049 {
00050 return flag;
00051 }
00052
00056 void setFlag (void)
00057 {
00058 flag = true;
00059 }
00060
00064 void clearFlag (void)
00065 {
00066 flag = false;
00067 }
00068
00073 int getIndex (void) const
00074 {
00075 return index;
00076 }
00077
00083 Edge * getEdge (int const & i)
00084 {
00085 return e[i];
00086 }
00087
00093 Vertex * getVertex (int const & i) const
00094 {
00095 return v[i];
00096 }
00097
00102 vector3 const *getNormal (void) const
00103 {
00104 return &n;
00105 }
00106
00111 double computeArea (void)
00112 {
00113
00114 return sqrt(n.dot(n))/2.0;
00115 }
00116 };
00117
00118 #endif