00001 #ifndef _FIRE_H_
00002 #define _FIRE_H_
00003
00004 #include <vector>
00005 #include <sstream>
00006 #include <string>
00007
00008
00009
00010 namespace FemViewer {
00011
00012 class Mesh;
00013 class Legend;
00014
00015 template <typename T> class Point3D;
00016 template <typename T> class GraphElement2;
00017
00018 class Fire
00019 {
00020 static const int indexCase[6][3];
00021
00022 public:
00023
00024 const Mesh* pMesh;
00025 const Legend& legend;
00026 public:
00027
00028 Fire(const Mesh* meshp, const Legend& leg)
00029 : pMesh(meshp), legend(leg) {}
00030
00031
00033 void Exe3(GraphElement2<double>& elIn, std::vector<GraphElement2<double> >& elOut);
00034
00036 void CreateLine(GraphElement2<double>& elIn, std::vector<GraphElement2<double> >& elOut);
00037
00038
00039
00040 int GetSorted(const double* values, const int*& index);
00041
00042 protected:
00043 void ExtractPentagram2(GraphElement2<double>& el, const std::vector<double>& values, std::vector<GraphElement2<double> >& elOut,
00044 std::vector<GraphElement2<double> >& subTriangles, int& line1, int& line2);
00045
00046
00047 void CutTriangle(GraphElement2<double>& elIn, const std::vector<double>& values, int line, std::vector<GraphElement2<double> >&elOut);
00048
00049
00050 bool FullTriangleFallage(GraphElement2<double>& elIn, const std::vector<double>& values, std::vector<GraphElement2<double> >& elOut);
00051
00052
00053 bool ValueWithin(const double& val, const double& bnd1, const double& bnd2)
00054 { return (val >= bnd1 && val <= bnd2) || (val >= bnd2 && val <= bnd1); }
00055
00056
00057 template<typename T>
00058 static Point3D<T> GetContourPoint(Point3D<T>& p1, Point3D<T>& p2, T& v, T& v1, T& v2)
00059 {
00060 T t(0);
00061 T diff = v2 - v1;
00062
00063 if(diff != 0) {
00064 t = (v - v1) / diff;
00065 Point3D<T> p;
00066 p.SetInterp(p1,p2,t);
00067
00068 return(p);
00069 }
00070 }
00071 };
00072
00073
00074 }
00075
00076
00077 #endif
00078