Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkTetra.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTetra.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00047 #ifndef __vtkTetra_h
00048 #define __vtkTetra_h
00049 
00050 #include "vtkCell3D.h"
00051 
00052 class vtkLine;
00053 class vtkTriangle;
00054 class vtkUnstructuredGrid;
00055 
00056 class VTK_COMMON_EXPORT vtkTetra : public vtkCell3D
00057 {
00058 public:
00059   static vtkTetra *New();
00060   vtkTypeRevisionMacro(vtkTetra,vtkCell3D);
00061 
00063 
00064   virtual void GetEdgePoints(int edgeId, int* &pts);
00065   virtual void GetFacePoints(int faceId, int* &pts);
00066   virtual float *GetParametricCoords();
00068 
00070 
00071   int GetCellType() {return VTK_TETRA;}
00072   int GetNumberOfEdges() {return 6;}
00073   int GetNumberOfFaces() {return 4;}
00074   vtkCell *GetEdge(int edgeId);
00075   vtkCell *GetFace(int faceId);
00076   void Contour(float value, vtkDataArray *cellScalars, 
00077                vtkPointLocator *locator, vtkCellArray *verts, 
00078                vtkCellArray *lines, vtkCellArray *polys,
00079                vtkPointData *inPd, vtkPointData *outPd,
00080                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00081   void Clip(float value, vtkDataArray *cellScalars, 
00082             vtkPointLocator *locator, vtkCellArray *connectivity,
00083             vtkPointData *inPd, vtkPointData *outPd,
00084             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 
00085             int insideOut);
00086   int EvaluatePosition(float x[3], float* closestPoint,
00087                        int& subId, float pcoords[3],
00088                        float& dist2, float *weights);
00089   void EvaluateLocation(int& subId, float pcoords[3], float x[3],
00090                         float *weights);
00091   int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00092                         float x[3], float pcoords[3], int& subId);
00093   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00094   void Derivatives(int subId, float pcoords[3], float *values, 
00095                    int dim, float *derivs);
00097 
00101   int CellBoundary(int subId, float pcoords[3], vtkIdList *pts);
00102   
00104   int GetParametricCenter(float pcoords[3]);
00105 
00107 
00108   static void TetraCenter(float p1[3], float p2[3], float p3[3], float p4[3], 
00109                           float center[3]);
00111 
00113 
00115   static double Circumsphere(double  p1[3], double p2[3], double p3[3], 
00116                              double p4[3], double center[3]);
00118 
00120 
00123   static double Insphere(double  p1[3], double p2[3], double p3[3], 
00124                          double p4[3], double center[3]);
00126 
00128 
00139   static int BarycentricCoords(double x[3], double  x1[3], double x2[3], 
00140                                double x3[3], double x4[3], double bcoords[4]);
00142   
00144 
00146   static double ComputeVolume(double  p1[3], double p2[3], double p3[3], 
00147                               double p4[3]);
00149 
00153   int JacobianInverse(double **inverse, float derivs[12]);
00154 
00156 
00157   static void InterpolationFunctions(float pcoords[3], float weights[4]);
00158   static void InterpolationDerivs(float derivs[12]);
00159   static int *GetEdgeArray(int edgeId);
00160   static int *GetFaceArray(int faceId);
00162 
00163 protected:
00164   vtkTetra();
00165   ~vtkTetra();
00166 
00167   vtkLine *Line;
00168   vtkTriangle *Triangle;
00169 
00170 private:
00171   vtkTetra(const vtkTetra&);  // Not implemented.
00172   void operator=(const vtkTetra&);  // Not implemented.
00173 };
00174 
00175 inline int vtkTetra::GetParametricCenter(float pcoords[3])
00176 {
00177   pcoords[0] = pcoords[1] = pcoords[2] = 0.25;
00178   return 0;
00179 }
00180 
00181 #endif
00182 
00183 
00184