00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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"
00048 #include "vtkCellType.h"
00049
00050 class vtkCellArray;
00051 class vtkCellData;
00052 class vtkDataArray;
00053 class vtkPointData;
00054 class vtkPointLocator;
00055 class vtkPoints;
00056
00057 class VTK_FILTERING_EXPORT vtkCell : public vtkObject
00058 {
00059 public:
00060 vtkTypeRevisionMacro(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 int 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
00146 virtual int EvaluatePosition(double x[3], double* closestPoint,
00147 int& subId, double pcoords[3],
00148 double& dist2, double *weights) = 0;
00150
00152
00155 virtual void EvaluateLocation(int& subId, double pcoords[3],
00156 double x[3], double *weights) = 0;
00158
00160
00171 virtual void Contour(double value, vtkDataArray *cellScalars,
00172 vtkPointLocator *locator, vtkCellArray *verts,
00173 vtkCellArray *lines, vtkCellArray *polys,
00174 vtkPointData *inPd, vtkPointData *outPd,
00175 vtkCellData *inCd, vtkIdType cellId,
00176 vtkCellData *outCd) = 0;
00178
00180
00191 virtual void Clip(double value, vtkDataArray *cellScalars,
00192 vtkPointLocator *locator, vtkCellArray *connectivity,
00193 vtkPointData *inPd, vtkPointData *outPd,
00194 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00195 int insideOut) = 0;
00197
00199
00202 virtual int IntersectWithLine(double p1[3], double p2[3],
00203 double tol, double& t, double x[3],
00204 double pcoords[3], int& subId) = 0;
00206
00216 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00217
00219
00231 virtual void Derivatives(int subId, double pcoords[3], double *values,
00232 int dim, double *derivs) = 0;
00234
00235
00238 void GetBounds(double bounds[6]);
00239
00240
00243 double *GetBounds();
00244
00245
00247 double GetLength2();
00248
00249
00255 virtual int GetParametricCenter(double pcoords[3]);
00256
00257
00263 virtual double GetParametricDistance(double pcoords[3]);
00264
00265
00271 virtual int IsPrimaryCell() {return 1;}
00272
00273
00281 virtual double *GetParametricCoords();
00282
00284
00287 virtual void InterpolateFunctions(double pcoords[3], double weights[3])
00288 {
00289 (void)pcoords;
00290 (void)weights;
00291 }
00292 virtual void InterpolateDerivs(double pcoords[3], double derivs[3])
00293 {
00294 (void)pcoords;
00295 (void)derivs;
00296 }
00298
00299
00300 vtkPoints *Points;
00301 vtkIdList *PointIds;
00302
00303 protected:
00304 vtkCell();
00305 ~vtkCell();
00306
00307 double Bounds[6];
00308
00309 private:
00310 vtkCell(const vtkCell&);
00311 void operator=(const vtkCell&);
00312 };
00313
00314 #endif
00315
00316