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 "vtkCommonDataModelModule.h" // For export macro 00046 #include "vtkObject.h" 00047 00048 #include "vtkIdList.h" // Needed for inline methods 00049 #include "vtkCellType.h" // Needed to define cell types 00050 00051 class vtkCellArray; 00052 class vtkCellData; 00053 class vtkDataArray; 00054 class vtkPointData; 00055 class vtkIncrementalPointLocator; 00056 class vtkPoints; 00057 00058 class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject 00059 { 00060 public: 00061 vtkTypeMacro(vtkCell,vtkObject); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00066 void Initialize(int npts, vtkIdType *pts, vtkPoints *p); 00067 00071 virtual void ShallowCopy(vtkCell *c); 00072 00075 virtual void DeepCopy(vtkCell *c); 00076 00078 virtual int GetCellType() = 0; 00079 00081 virtual int GetCellDimension() = 0; 00082 00086 virtual int IsLinear() {return 1;} 00087 00089 00092 virtual int RequiresInitialization() {return 0;} 00093 virtual void Initialize() {} 00095 00099 virtual int IsExplicitCell() {return 0;} 00100 00102 00105 virtual int RequiresExplicitFaceRepresentation() {return 0;} 00106 virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {} 00107 virtual vtkIdType *GetFaces() {return NULL;} 00109 00111 vtkPoints *GetPoints() {return this->Points;} 00112 00114 vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();} 00115 00117 virtual int GetNumberOfEdges() = 0; 00118 00120 virtual int GetNumberOfFaces() = 0; 00121 00123 vtkIdList *GetPointIds() {return this->PointIds;} 00124 00126 vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);} 00127 00129 virtual vtkCell *GetEdge(int edgeId) = 0; 00130 00132 virtual vtkCell *GetFace(int faceId) = 0; 00133 00139 virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0; 00140 00142 00157 virtual int EvaluatePosition(double x[3], double* closestPoint, 00158 int& subId, double pcoords[3], 00159 double& dist2, double *weights) = 0; 00161 00163 00166 virtual void EvaluateLocation(int& subId, double pcoords[3], 00167 double x[3], double *weights) = 0; 00169 00171 00182 virtual void Contour(double value, vtkDataArray *cellScalars, 00183 vtkIncrementalPointLocator *locator, vtkCellArray *verts, 00184 vtkCellArray *lines, vtkCellArray *polys, 00185 vtkPointData *inPd, vtkPointData *outPd, 00186 vtkCellData *inCd, vtkIdType cellId, 00187 vtkCellData *outCd) = 0; 00189 00191 00202 virtual void Clip(double value, vtkDataArray *cellScalars, 00203 vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, 00204 vtkPointData *inPd, vtkPointData *outPd, 00205 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 00206 int insideOut) = 0; 00208 00210 00213 virtual int IntersectWithLine(double p1[3], double p2[3], 00214 double tol, double& t, double x[3], 00215 double pcoords[3], int& subId) = 0; 00217 00227 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0; 00228 00230 00242 virtual void Derivatives(int subId, double pcoords[3], double *values, 00243 int dim, double *derivs) = 0; 00245 00246 00249 void GetBounds(double bounds[6]); 00250 00251 00254 double *GetBounds(); 00255 00256 00258 double GetLength2(); 00259 00260 00266 virtual int GetParametricCenter(double pcoords[3]); 00267 00268 00274 virtual double GetParametricDistance(double pcoords[3]); 00275 00276 00282 virtual int IsPrimaryCell() {return 1;} 00283 00284 00292 virtual double *GetParametricCoords(); 00293 00295 00298 virtual void InterpolateFunctions(double pcoords[3], double weights[3]) 00299 { 00300 (void)pcoords; 00301 (void)weights; 00302 } 00303 virtual void InterpolateDerivs(double pcoords[3], double derivs[3]) 00304 { 00305 (void)pcoords; 00306 (void)derivs; 00307 } 00309 00310 // left public for quick computational access 00311 vtkPoints *Points; 00312 vtkIdList *PointIds; 00313 00314 protected: 00315 vtkCell(); 00316 ~vtkCell(); 00317 00318 double Bounds[6]; 00319 00320 private: 00321 vtkCell(const vtkCell&); // Not implemented. 00322 void operator=(const vtkCell&); // Not implemented. 00323 }; 00324 00325 #endif 00326 00327