00001 
00002 
00008 #if !defined(__geom_mesh_simplicial__FaceRemoval_h__)
00009 #define __geom_mesh_simplicial__FaceRemoval_h__
00010 
00011 #if defined(DEBUG_geom) && !defined(DEBUG_FaceRemoval)
00012 #define DEBUG_FaceRemoval
00013 #endif
00014 
00015 #include "../simplex/SimplexModCondNum.h"
00016 
00017 #include "../../../ads/array/Array.h"
00018 
00019 #include <cassert>
00020 
00021 BEGIN_NAMESPACE_GEOM
00022 
00023 
00025 template<class _QualityMetric = SimplexModCondNum<3>,
00026          class _Point = ads::FixedArray<3>,
00027          typename _Number = typename _Point::value_type>
00028 class FaceRemoval {
00029 
00030 public:
00031 
00032   
00033   
00034   
00035 
00037   typedef _QualityMetric QualityMetric;
00039   typedef _Point Point;
00041   typedef _Number Number;
00042 
00043 private:
00044       
00045   
00046   
00047   
00048 
00049   typedef typename QualityMetric::Simplex Simplex;
00050 
00051   
00052   
00053   
00054 
00055   
00056   Point _source, _target;
00057   
00058   ads::FixedArray<3,Point> _face;
00059   
00060   mutable QualityMetric _qualityFunction;
00061   
00062   
00063   
00064   
00065 
00066   
00067   FaceRemoval(const FaceRemoval&);
00068 
00069   
00070   FaceRemoval& 
00071   operator=(const FaceRemoval&);
00072 
00073 public:
00074 
00075   
00078 
00080   FaceRemoval() :
00081     _source(),
00082     _target(),
00083     _face(),
00084     _qualityFunction()
00085   {}
00086 
00088   ~FaceRemoval()
00089   {}
00090 
00092   
00095 
00097   void
00098   setSource(const Point& src) {
00099     _source = src;
00100   }
00101 
00103   void
00104   setTarget(const Point& tgt) {
00105     _target = tgt;
00106   }
00107 
00109 
00112   void
00113   setFace(const Point& a, const Point& b, const Point& c) {
00114     _face[0] = a;
00115     _face[1] = b;
00116     _face[2] = c;
00117   }
00118 
00120   
00123 
00125   bool
00126   flip23() {
00127     return computeQuality3() > computeQuality2();
00128   }
00129 
00131 
00132   
00133   
00134   
00135   
00136   
00137   
00138   
00139   
00140   
00142   Number
00143   computeQuality2() const;
00144 
00145   
00146   
00147   
00148   
00150   Number
00151   computeQuality3() const;
00152 };
00153 
00154 
00155 END_NAMESPACE_GEOM
00156 
00157 
00158 #define __geom_mesh_simplicial_FaceRemoval_ipp__
00159 #include "FaceRemoval.ipp"
00160 #undef __geom_mesh_simplicial_FaceRemoval_ipp__
00161 
00162 #endif