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 =========================================================================*/ 00042 #ifndef vtkCell_h 00043 #define vtkCell_h 00044 00045 #define VTK_CELL_SIZE 512 00046 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation 00047 00048 #include "vtkCommonDataModelModule.h" // For export macro 00049 #include "vtkObject.h" 00050 00051 #include "vtkIdList.h" // Needed for inline methods 00052 #include "vtkCellType.h" // Needed to define cell types 00053 00054 class vtkCellArray; 00055 class vtkCellData; 00056 class vtkDataArray; 00057 class vtkPointData; 00058 class vtkIncrementalPointLocator; 00059 class vtkPoints; 00060 00061 class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject 00062 { 00063 public: 00064 vtkTypeMacro(vtkCell,vtkObject); 00065 void PrintSelf(ostream& os, vtkIndent indent); 00066 00069 void Initialize(int npts, vtkIdType *pts, vtkPoints *p); 00070 00074 virtual void ShallowCopy(vtkCell *c); 00075 00078 virtual void DeepCopy(vtkCell *c); 00079 00081 virtual int GetCellType() = 0; 00082 00084 virtual int GetCellDimension() = 0; 00085 00089 virtual int IsLinear() {return 1;} 00090 00092 00095 virtual int RequiresInitialization() {return 0;} 00096 virtual void Initialize() {} 00098 00102 virtual int IsExplicitCell() {return 0;} 00103 00105 00108 virtual int RequiresExplicitFaceRepresentation() {return 0;} 00109 virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {} 00110 virtual vtkIdType *GetFaces() {return NULL;} 00112 00114 vtkPoints *GetPoints() {return this->Points;} 00115 00117 vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();} 00118 00120 virtual int GetNumberOfEdges() = 0; 00121 00123 virtual int GetNumberOfFaces() = 0; 00124 00126 vtkIdList *GetPointIds() {return this->PointIds;} 00127 00129 vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);} 00130 00132 virtual vtkCell *GetEdge(int edgeId) = 0; 00133 00135 virtual vtkCell *GetFace(int faceId) = 0; 00136 00142 virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0; 00143 00145 00160 virtual int EvaluatePosition(double x[3], double* closestPoint, 00161 int& subId, double pcoords[3], 00162 double& dist2, double *weights) = 0; 00164 00166 00169 virtual void EvaluateLocation(int& subId, double pcoords[3], 00170 double x[3], double *weights) = 0; 00172 00174 00185 virtual void Contour(double value, vtkDataArray *cellScalars, 00186 vtkIncrementalPointLocator *locator, vtkCellArray *verts, 00187 vtkCellArray *lines, vtkCellArray *polys, 00188 vtkPointData *inPd, vtkPointData *outPd, 00189 vtkCellData *inCd, vtkIdType cellId, 00190 vtkCellData *outCd) = 0; 00192 00194 00205 virtual void Clip(double value, vtkDataArray *cellScalars, 00206 vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, 00207 vtkPointData *inPd, vtkPointData *outPd, 00208 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 00209 int insideOut) = 0; 00211 00213 00221 virtual int IntersectWithLine(double p1[3], double p2[3], 00222 double tol, double& t, double x[3], 00223 double pcoords[3], int& subId) = 0; 00225 00235 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0; 00236 00238 00250 virtual void Derivatives(int subId, double pcoords[3], double *values, 00251 int dim, double *derivs) = 0; 00253 00254 00257 void GetBounds(double bounds[6]); 00258 00259 00262 double *GetBounds(); 00263 00264 00266 double GetLength2(); 00267 00268 00274 virtual int GetParametricCenter(double pcoords[3]); 00275 00276 00282 virtual double GetParametricDistance(double pcoords[3]); 00283 00284 00290 virtual int IsPrimaryCell() {return 1;} 00291 00292 00300 virtual double *GetParametricCoords(); 00301 00303 00306 virtual void InterpolateFunctions(double pcoords[3], double weights[3]) 00307 { 00308 (void)pcoords; 00309 (void)weights; 00310 } 00311 virtual void InterpolateDerivs(double pcoords[3], double derivs[3]) 00312 { 00313 (void)pcoords; 00314 (void)derivs; 00315 } 00317 00318 // left public for quick computational access 00319 vtkPoints *Points; 00320 vtkIdList *PointIds; 00321 00322 protected: 00323 vtkCell(); 00324 ~vtkCell(); 00325 00326 double Bounds[6]; 00327 00328 private: 00329 vtkCell(const vtkCell&); // Not implemented. 00330 void operator=(const vtkCell&); // Not implemented. 00331 }; 00332 00333 #endif 00334 00335