VTK
vtkTetra.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTetra.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
35 #ifndef __vtkTetra_h
36 #define __vtkTetra_h
37 
38 #include "vtkCell3D.h"
39 
40 class vtkLine;
41 class vtkTriangle;
44 
46 {
47 public:
48  static vtkTetra *New();
49  vtkTypeMacro(vtkTetra,vtkCell3D);
50  void PrintSelf(ostream& os, vtkIndent indent);
51 
53 
54  virtual void GetEdgePoints(int edgeId, int* &pts);
55  virtual void GetFacePoints(int faceId, int* &pts);
57 
59 
60  int GetCellType() {return VTK_TETRA;}
61  int GetNumberOfEdges() {return 6;}
62  int GetNumberOfFaces() {return 4;}
63  vtkCell *GetEdge(int edgeId);
64  vtkCell *GetFace(int faceId);
65  void Contour(double value, vtkDataArray *cellScalars,
67  vtkCellArray *lines, vtkCellArray *polys,
68  vtkPointData *inPd, vtkPointData *outPd,
69  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
70  void Clip(double value, vtkDataArray *cellScalars,
71  vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
72  vtkPointData *inPd, vtkPointData *outPd,
73  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
74  int insideOut);
75  int EvaluatePosition(double x[3], double* closestPoint,
76  int& subId, double pcoords[3],
77  double& dist2, double *weights);
78  void EvaluateLocation(int& subId, double pcoords[3], double x[3],
79  double *weights);
80  int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
81  double x[3], double pcoords[3], int& subId);
82  int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
83  void Derivatives(int subId, double pcoords[3], double *values,
84  int dim, double *derivs);
85  virtual double *GetParametricCoords();
87 
91  int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
92 
94  int GetParametricCenter(double pcoords[3]);
95 
98  double GetParametricDistance(double pcoords[3]);
99 
101 
102  static void TetraCenter(double p1[3], double p2[3], double p3[3], double p4[3],
103  double center[3]);
105 
107 
110  static double Circumsphere(double p1[3], double p2[3], double p3[3],
111  double p4[3], double center[3]);
113 
115 
118  static double Insphere(double p1[3], double p2[3], double p3[3],
119  double p4[3], double center[3]);
121 
123 
134  static int BarycentricCoords(double x[3], double x1[3], double x2[3],
135  double x3[3], double x4[3], double bcoords[4]);
137 
139 
141  static double ComputeVolume(double p1[3], double p2[3], double p3[3],
142  double p4[3]);
144 
148  int JacobianInverse(double **inverse, double derivs[12]);
149 
151  static void InterpolationFunctions(double pcoords[3], double weights[4]);
153  static void InterpolationDerivs(double pcoords[3], double derivs[12]);
155 
157  virtual void InterpolateFunctions(double pcoords[3], double weights[4])
158  {
159  vtkTetra::InterpolationFunctions(pcoords,weights);
160  }
161  virtual void InterpolateDerivs(double pcoords[3], double derivs[12])
162  {
163  vtkTetra::InterpolationDerivs(pcoords,derivs);
164  }
166 
168 
170  static int *GetEdgeArray(int edgeId);
171  static int *GetFaceArray(int faceId);
173 
174 protected:
175  vtkTetra();
176  ~vtkTetra();
177 
180 
181 private:
182  vtkTetra(const vtkTetra&); // Not implemented.
183  void operator=(const vtkTetra&); // Not implemented.
184 };
185 
186 inline int vtkTetra::GetParametricCenter(double pcoords[3])
187 {
188  pcoords[0] = pcoords[1] = pcoords[2] = 0.25;
189  return 0;
190 }
191 
192 #endif
193 
194 
195