00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00036 #ifndef __vtkTetra_h
00037 #define __vtkTetra_h
00038
00039 #include "vtkCell3D.h"
00040
00041 class vtkLine;
00042 class vtkTriangle;
00043 class vtkUnstructuredGrid;
00044
00045 class VTK_COMMON_EXPORT vtkTetra : public vtkCell3D
00046 {
00047 public:
00048 static vtkTetra *New();
00049 vtkTypeRevisionMacro(vtkTetra,vtkCell3D);
00050
00052
00053 virtual void GetEdgePoints(int edgeId, int* &pts);
00054 virtual void GetFacePoints(int faceId, int* &pts);
00055 virtual float *GetParametricCoords();
00057
00059
00060 int GetCellType() {return VTK_TETRA;}
00061 int GetNumberOfEdges() {return 6;}
00062 int GetNumberOfFaces() {return 4;}
00063 vtkCell *GetEdge(int edgeId);
00064 vtkCell *GetFace(int faceId);
00065 void Contour(float value, vtkDataArray *cellScalars,
00066 vtkPointLocator *locator, vtkCellArray *verts,
00067 vtkCellArray *lines, vtkCellArray *polys,
00068 vtkPointData *inPd, vtkPointData *outPd,
00069 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00070 void Clip(float value, vtkDataArray *cellScalars,
00071 vtkPointLocator *locator, vtkCellArray *connectivity,
00072 vtkPointData *inPd, vtkPointData *outPd,
00073 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00074 int insideOut);
00075 int EvaluatePosition(float x[3], float* closestPoint,
00076 int& subId, float pcoords[3],
00077 float& dist2, float *weights);
00078 void EvaluateLocation(int& subId, float pcoords[3], float x[3],
00079 float *weights);
00080 int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00081 float x[3], float pcoords[3], int& subId);
00082 int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00083 void Derivatives(int subId, float pcoords[3], float *values,
00084 int dim, float *derivs);
00086
00090 int CellBoundary(int subId, float pcoords[3], vtkIdList *pts);
00091
00093 int GetParametricCenter(float pcoords[3]);
00094
00096
00097 static void TetraCenter(float p1[3], float p2[3], float p3[3], float p4[3],
00098 float center[3]);
00100
00102
00104 static double Circumsphere(double p1[3], double p2[3], double p3[3],
00105 double p4[3], double center[3]);
00107
00109
00112 static double Insphere(double p1[3], double p2[3], double p3[3],
00113 double p4[3], double center[3]);
00115
00117
00128 static int BarycentricCoords(double x[3], double x1[3], double x2[3],
00129 double x3[3], double x4[3], double bcoords[4]);
00131
00133
00135 static double ComputeVolume(double p1[3], double p2[3], double p3[3],
00136 double p4[3]);
00138
00142 int JacobianInverse(double **inverse, float derivs[12]);
00143
00145
00146 static void InterpolationFunctions(float pcoords[3], float weights[4]);
00147 static void InterpolationDerivs(float derivs[12]);
00148 static int *GetEdgeArray(int edgeId);
00149 static int *GetFaceArray(int faceId);
00151
00152 protected:
00153 vtkTetra();
00154 ~vtkTetra();
00155
00156 vtkLine *Line;
00157 vtkTriangle *Triangle;
00158
00159 private:
00160 vtkTetra(const vtkTetra&);
00161 void operator=(const vtkTetra&);
00162 };
00163
00164 inline int vtkTetra::GetParametricCenter(float pcoords[3])
00165 {
00166 pcoords[0] = pcoords[1] = pcoords[2] = 0.25;
00167 return 0;
00168 }
00169
00170 #endif
00171
00172
00173