VTK
dox/Filtering/vtkCell.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCell.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013      
00014 =========================================================================*/
00039 #ifndef __vtkCell_h
00040 #define __vtkCell_h
00041 
00042 #define VTK_CELL_SIZE 512
00043 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
00044 
00045 #include "vtkObject.h"
00046 
00047 #include "vtkIdList.h" // Needed for inline methods
00048 #include "vtkCellType.h" // Needed to define cell types
00049 
00050 class vtkCellArray;
00051 class vtkCellData;
00052 class vtkDataArray;
00053 class vtkPointData;
00054 class vtkIncrementalPointLocator;
00055 class vtkPoints;
00056 
00057 class VTK_FILTERING_EXPORT vtkCell : public vtkObject
00058 {
00059 public:
00060   vtkTypeMacro(vtkCell,vtkObject);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00065   void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
00066 
00070   virtual void ShallowCopy(vtkCell *c);
00071 
00074   virtual void DeepCopy(vtkCell *c);
00075 
00077   virtual int GetCellType() = 0;
00078 
00080   virtual int GetCellDimension() = 0;
00081 
00085   virtual int IsLinear() {return 1;}
00086 
00088 
00091   virtual int RequiresInitialization() {return 0;}
00092   virtual void Initialize() {}
00094 
00098   virtual int IsExplicitCell() {return 0;}
00099 
00101 
00104   virtual int RequiresExplicitFaceRepresentation() {return 0;}
00105   virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {}
00106   virtual vtkIdType *GetFaces() {return NULL;}
00108 
00110   vtkPoints *GetPoints() {return this->Points;}
00111 
00113   vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
00114 
00116   virtual int GetNumberOfEdges() = 0;
00117 
00119   virtual int GetNumberOfFaces() = 0;
00120 
00122   vtkIdList *GetPointIds() {return this->PointIds;}
00123 
00125   vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
00126 
00128   virtual vtkCell *GetEdge(int edgeId) = 0;
00129 
00131   virtual vtkCell *GetFace(int faceId) = 0;
00132 
00138   virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0;
00139 
00141 
00156   virtual int EvaluatePosition(double x[3], double* closestPoint, 
00157                                int& subId, double pcoords[3], 
00158                                double& dist2, double *weights) = 0;
00160 
00162 
00165   virtual void EvaluateLocation(int& subId, double pcoords[3], 
00166                                 double x[3], double *weights) = 0;
00168 
00170 
00181   virtual void Contour(double value, vtkDataArray *cellScalars, 
00182                        vtkIncrementalPointLocator *locator, vtkCellArray *verts,
00183                        vtkCellArray *lines, vtkCellArray *polys, 
00184                        vtkPointData *inPd, vtkPointData *outPd,
00185                        vtkCellData *inCd, vtkIdType cellId,
00186                        vtkCellData *outCd) = 0;
00188 
00190 
00201   virtual void Clip(double value, vtkDataArray *cellScalars, 
00202                     vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
00203                     vtkPointData *inPd, vtkPointData *outPd,
00204                     vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 
00205                     int insideOut) = 0;
00207 
00209 
00212   virtual int IntersectWithLine(double p1[3], double p2[3], 
00213                                 double tol, double& t, double x[3], 
00214                                 double pcoords[3], int& subId) = 0;
00216 
00226   virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00227 
00229 
00241   virtual void Derivatives(int subId, double pcoords[3], double *values, 
00242                            int dim, double *derivs) = 0;
00244 
00245 
00248   void GetBounds(double bounds[6]);
00249 
00250 
00253   double *GetBounds();
00254 
00255 
00257   double GetLength2();
00258 
00259 
00265   virtual int GetParametricCenter(double pcoords[3]);
00266 
00267 
00273   virtual double GetParametricDistance(double pcoords[3]);
00274 
00275 
00281   virtual int IsPrimaryCell() {return 1;}
00282 
00283 
00291   virtual double *GetParametricCoords();
00292 
00294 
00297   virtual void InterpolateFunctions(double pcoords[3], double weights[3])
00298     {
00299     (void)pcoords;
00300     (void)weights;
00301     }
00302   virtual void InterpolateDerivs(double pcoords[3], double derivs[3])
00303     {
00304     (void)pcoords;
00305     (void)derivs;
00306     }
00308 
00309   // left public for quick computational access
00310   vtkPoints *Points;
00311   vtkIdList *PointIds;
00312 
00313 protected:
00314   vtkCell();
00315   ~vtkCell();
00316 
00317   double Bounds[6];
00318 
00319 private:
00320   vtkCell(const vtkCell&);  // Not implemented.
00321   void operator=(const vtkCell&);  // Not implemented.
00322 };
00323 
00324 #endif
00325 
00326