VTK
|
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 vtkPoints *GetPoints() {return this->Points;} 00102 00104 vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();} 00105 00107 virtual int GetNumberOfEdges() = 0; 00108 00110 virtual int GetNumberOfFaces() = 0; 00111 00113 vtkIdList *GetPointIds() {return this->PointIds;} 00114 00116 vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);} 00117 00119 virtual vtkCell *GetEdge(int edgeId) = 0; 00120 00122 virtual vtkCell *GetFace(int faceId) = 0; 00123 00129 virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0; 00130 00132 00147 virtual int EvaluatePosition(double x[3], double* closestPoint, 00148 int& subId, double pcoords[3], 00149 double& dist2, double *weights) = 0; 00151 00153 00156 virtual void EvaluateLocation(int& subId, double pcoords[3], 00157 double x[3], double *weights) = 0; 00159 00161 00172 virtual void Contour(double value, vtkDataArray *cellScalars, 00173 vtkIncrementalPointLocator *locator, vtkCellArray *verts, 00174 vtkCellArray *lines, vtkCellArray *polys, 00175 vtkPointData *inPd, vtkPointData *outPd, 00176 vtkCellData *inCd, vtkIdType cellId, 00177 vtkCellData *outCd) = 0; 00179 00181 00192 virtual void Clip(double value, vtkDataArray *cellScalars, 00193 vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, 00194 vtkPointData *inPd, vtkPointData *outPd, 00195 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 00196 int insideOut) = 0; 00198 00200 00203 virtual int IntersectWithLine(double p1[3], double p2[3], 00204 double tol, double& t, double x[3], 00205 double pcoords[3], int& subId) = 0; 00207 00217 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0; 00218 00220 00232 virtual void Derivatives(int subId, double pcoords[3], double *values, 00233 int dim, double *derivs) = 0; 00235 00236 00239 void GetBounds(double bounds[6]); 00240 00241 00244 double *GetBounds(); 00245 00246 00248 double GetLength2(); 00249 00250 00256 virtual int GetParametricCenter(double pcoords[3]); 00257 00258 00264 virtual double GetParametricDistance(double pcoords[3]); 00265 00266 00272 virtual int IsPrimaryCell() {return 1;} 00273 00274 00282 virtual double *GetParametricCoords(); 00283 00285 00288 virtual void InterpolateFunctions(double pcoords[3], double weights[3]) 00289 { 00290 (void)pcoords; 00291 (void)weights; 00292 } 00293 virtual void InterpolateDerivs(double pcoords[3], double derivs[3]) 00294 { 00295 (void)pcoords; 00296 (void)derivs; 00297 } 00299 00300 // left public for quick computational access 00301 vtkPoints *Points; 00302 vtkIdList *PointIds; 00303 00304 protected: 00305 vtkCell(); 00306 ~vtkCell(); 00307 00308 double Bounds[6]; 00309 00310 private: 00311 vtkCell(const vtkCell&); // Not implemented. 00312 void operator=(const vtkCell&); // Not implemented. 00313 }; 00314 00315 #endif 00316 00317