VTK
vtkCell.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCell.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 =========================================================================*/
39 #ifndef __vtkCell_h
40 #define __vtkCell_h
41 
42 #define VTK_CELL_SIZE 512
43 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
44 
45 #include "vtkObject.h"
46 
47 #include "vtkIdList.h" // Needed for inline methods
48 #include "vtkCellType.h" // Needed to define cell types
49 
50 class vtkCellArray;
51 class vtkCellData;
52 class vtkDataArray;
53 class vtkPointData;
54 class vtkIncrementalPointLocator;
55 class vtkPoints;
56 
58 {
59 public:
60  vtkTypeMacro(vtkCell,vtkObject);
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
65  void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
66 
70  virtual void ShallowCopy(vtkCell *c);
71 
74  virtual void DeepCopy(vtkCell *c);
75 
77  virtual int GetCellType() = 0;
78 
80  virtual int GetCellDimension() = 0;
81 
85  virtual int IsLinear() {return 1;}
86 
88 
91  virtual int RequiresInitialization() {return 0;}
92  virtual void Initialize() {}
94 
98  virtual int IsExplicitCell() {return 0;}
99 
101 
104  virtual int RequiresExplicitFaceRepresentation() {return 0;}
105  virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {}
106  virtual vtkIdType *GetFaces() {return NULL;}
108 
110  vtkPoints *GetPoints() {return this->Points;}
111 
113  vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
114 
116  virtual int GetNumberOfEdges() = 0;
117 
119  virtual int GetNumberOfFaces() = 0;
120 
122  vtkIdList *GetPointIds() {return this->PointIds;}
123 
125  vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
126 
128  virtual vtkCell *GetEdge(int edgeId) = 0;
129 
131  virtual vtkCell *GetFace(int faceId) = 0;
132 
138  virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0;
139 
141 
156  virtual int EvaluatePosition(double x[3], double* closestPoint,
157  int& subId, double pcoords[3],
158  double& dist2, double *weights) = 0;
160 
162 
165  virtual void EvaluateLocation(int& subId, double pcoords[3],
166  double x[3], double *weights) = 0;
168 
170 
181  virtual void Contour(double value, vtkDataArray *cellScalars,
182  vtkIncrementalPointLocator *locator, vtkCellArray *verts,
183  vtkCellArray *lines, vtkCellArray *polys,
184  vtkPointData *inPd, vtkPointData *outPd,
185  vtkCellData *inCd, vtkIdType cellId,
186  vtkCellData *outCd) = 0;
188 
190 
201  virtual void Clip(double value, vtkDataArray *cellScalars,
202  vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
203  vtkPointData *inPd, vtkPointData *outPd,
204  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
205  int insideOut) = 0;
207 
209 
212  virtual int IntersectWithLine(double p1[3], double p2[3],
213  double tol, double& t, double x[3],
214  double pcoords[3], int& subId) = 0;
216 
226  virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
227 
229 
241  virtual void Derivatives(int subId, double pcoords[3], double *values,
242  int dim, double *derivs) = 0;
244 
245 
248  void GetBounds(double bounds[6]);
249 
250 
253  double *GetBounds();
254 
255 
257  double GetLength2();
258 
259 
265  virtual int GetParametricCenter(double pcoords[3]);
266 
267 
273  virtual double GetParametricDistance(double pcoords[3]);
274 
275 
281  virtual int IsPrimaryCell() {return 1;}
282 
283 
291  virtual double *GetParametricCoords();
292 
294 
297  virtual void InterpolateFunctions(double pcoords[3], double weights[3])
298  {
299  (void)pcoords;
300  (void)weights;
301  }
302  virtual void InterpolateDerivs(double pcoords[3], double derivs[3])
303  {
304  (void)pcoords;
305  (void)derivs;
306  }
308 
309  // left public for quick computational access
312 
313 protected:
314  vtkCell();
315  ~vtkCell();
316 
317  double Bounds[6];
318 
319 private:
320  vtkCell(const vtkCell&); // Not implemented.
321  void operator=(const vtkCell&); // Not implemented.
322 };
323 
324 #endif
325 
326 
vtkIdList * PointIds
Definition: vtkCell.h:311
vtkIdType GetNumberOfPoints()
Definition: vtkCell.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent and manipulate point attribute data
Definition: vtkPointData.h:35
#define VTK_FILTERING_EXPORT
vtkPoints * GetPoints()
Definition: vtkCell.h:110
represent and manipulate cell attribute data
Definition: vtkCellData.h:36
virtual void InterpolateFunctions(double pcoords[3], double weights[3])
Definition: vtkCell.h:297
int vtkIdType
Definition: vtkType.h:255
vtkIdType GetPointId(int ptId)
Definition: vtkCell.h:125
virtual int IsLinear()
Definition: vtkCell.h:85
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:105
abstract class to specify cell behavior
Definition: vtkCell.h:57
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkPoints * Points
Definition: vtkCell.h:310
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
virtual int RequiresInitialization()
Definition: vtkCell.h:91
virtual int RequiresExplicitFaceRepresentation()
Definition: vtkCell.h:104
object to represent cell connectivity
Definition: vtkCellArray.h:48
virtual int IsExplicitCell()
Definition: vtkCell.h:98
virtual int IsPrimaryCell()
Definition: vtkCell.h:281
virtual void InterpolateDerivs(double pcoords[3], double derivs[3])
Definition: vtkCell.h:302
vtkIdList * GetPointIds()
Definition: vtkCell.h:122
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:106
virtual void Initialize()
Definition: vtkCell.h:92
represent and manipulate 3D points
Definition: vtkPoints.h:38