00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef  _MxTriangleCellExtract_h
00024 #define  _MxTriangleCellExtract_h
00025 
00026 #include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
00027 
00028 #include <Inventor/STL/vector>
00029 #include <Inventor/STL/utility>
00030 
00031 class MiSurfaceCell;
00032 
00056 class MESHIVIZ_API MxTriangleCellExtract 
00057 {
00058 public:
00059 
00073   static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiSurfaceCell* triangleCell, const MbVec3d &point);
00074   
00080   static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00081 
00101   static void getWeight(const MiGeometryI& meshGeometry, const MiSurfaceCell* triangleCell, const MbVec3d &point, std::vector<double>& weights)
00102   {
00103     getWeight(getIsoParametricCoord(meshGeometry,triangleCell,point),weights);
00104   }
00105 
00118   static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00119   {
00120     weights[1] = ipcoord[0];
00121     weights[2] = ipcoord[1];
00122     weights[0] = 1.0 - weights[1] - weights[2];
00123   }
00124 
00138   static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiSurfaceCell* triangleCell, const MbVec3d &point, std::vector<double>& weights)
00139   {
00140     getWeight(getIsoParametricCoord(meshGeometry,triangleCell,point),weights);
00141     return ( -1.E-5 < weights[0] &&  weights[0] < 1 + 1.E-5 &&
00142              -1.E-5 < weights[1] &&  weights[1] < 1 + 1.E-5 &&
00143              -1.E-5 < weights[2] &&  weights[2] < 1 + 1.E-5);
00144   }
00145 
00149   static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiSurfaceCell* cell);
00150 
00154   static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiSurfaceCell* cell);
00155 
00156 private:
00157 
00158   static double s_nodesIsoParametricCoords[3][3];
00159 };
00160 
00161 #endif 
00162 
00163