00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00055 #ifndef __vtkCell_h
00056 #define __vtkCell_h
00057
00058 #define VTK_CELL_SIZE 512
00059 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
00060
00061 #include "vtkObject.h"
00062
00063 #include "vtkIdList.h"
00064 #include "vtkCellType.h"
00065
00066 class vtkCellArray;
00067 class vtkCellData;
00068 class vtkDataArray;
00069 class vtkPointData;
00070 class vtkPointLocator;
00071 class vtkPoints;
00072
00073 class VTK_COMMON_EXPORT vtkCell : public vtkObject
00074 {
00075 public:
00076 vtkTypeRevisionMacro(vtkCell,vtkObject);
00077 void PrintSelf(ostream& os, vtkIndent indent);
00078
00081 void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
00082
00083 #ifndef VTK_REMOVE_LEGACY_CODE
00084
00085 virtual vtkCell* MakeObject();
00086 #endif
00087
00091 virtual void ShallowCopy(vtkCell *c);
00092
00095 virtual void DeepCopy(vtkCell *c);
00096
00098 virtual int GetCellType() = 0;
00099
00101 virtual int GetCellDimension() = 0;
00102
00106 virtual int IsLinear() {return 1;}
00107
00109
00112 virtual int RequiresInitialization() {return 0;}
00113 virtual void Initialize() {}
00115
00119 virtual int IsExplicitCell() {return 0;}
00120
00122 vtkPoints *GetPoints() {return this->Points;}
00123
00125 int GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
00126
00128 virtual int GetNumberOfEdges() = 0;
00129
00131 virtual int GetNumberOfFaces() = 0;
00132
00134 vtkIdList *GetPointIds() {return this->PointIds;}
00135
00137 vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
00138
00140 virtual vtkCell *GetEdge(int edgeId) = 0;
00141
00143 virtual vtkCell *GetFace(int faceId) = 0;
00144
00150 virtual int CellBoundary(int subId, float pcoords[3], vtkIdList *pts) = 0;
00151
00153
00167 virtual int EvaluatePosition(float x[3], float* closestPoint,
00168 int& subId, float pcoords[3],
00169 float& dist2, float *weights) = 0;
00171
00173
00176 virtual void EvaluateLocation(int& subId, float pcoords[3],
00177 float x[3], float *weights) = 0;
00179
00181
00192 virtual void Contour(float value, vtkDataArray *cellScalars,
00193 vtkPointLocator *locator, vtkCellArray *verts,
00194 vtkCellArray *lines, vtkCellArray *polys,
00195 vtkPointData *inPd, vtkPointData *outPd,
00196 vtkCellData *inCd, vtkIdType cellId,
00197 vtkCellData *outCd) = 0;
00199
00201
00212 virtual void Clip(float value, vtkDataArray *cellScalars,
00213 vtkPointLocator *locator, vtkCellArray *connectivity,
00214 vtkPointData *inPd, vtkPointData *outPd,
00215 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00216 int insideOut) = 0;
00218
00220
00223 virtual int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00224 float x[3], float pcoords[3], int& subId) = 0;
00226
00234 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00235
00237
00249 virtual void Derivatives(int subId, float pcoords[3], float *values,
00250 int dim, float *derivs) = 0;
00252
00253
00256 void GetBounds(float bounds[6]);
00257
00258
00261 float *GetBounds();
00262
00263
00265 float GetLength2();
00266
00267
00273 virtual int GetParametricCenter(float pcoords[3]);
00274
00275
00277
00284 static char HitBBox(float bounds[6], float origin[3], float dir[3],
00285 float coord[3], float& t);
00287
00288
00289
00290 vtkPoints *Points;
00291 vtkIdList *PointIds;
00292
00293 protected:
00294 vtkCell();
00295 ~vtkCell();
00296
00297 float Bounds[6];
00298 private:
00299 vtkCell(const vtkCell&);
00300 void operator=(const vtkCell&);
00301 };
00302
00303 #endif
00304
00305