00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00066 #ifndef __vtkCell_h
00067 #define __vtkCell_h
00068 
00069 #define VTK_CELL_SIZE 512
00070 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
00071 
00072 #include "vtkObject.h"
00073 #include "vtkPoints.h"
00074 #include "vtkScalars.h"
00075 #include "vtkIdList.h"
00076 
00077 
00078 #include "vtkCellType.h"
00079 
00080 class vtkCellArray;
00081 class vtkPointLocator;
00082 class vtkPointData;
00083 class vtkCellData;
00084 
00085 class VTK_EXPORT vtkCell : public vtkObject
00086 {
00087 public:
00088   vtkTypeMacro(vtkCell,vtkObject);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00093   void Initialize(int npts, int *pts, vtkPoints *p);
00094 
00097   virtual vtkCell *MakeObject() = 0;
00098 
00102   virtual void ShallowCopy(vtkCell *c);
00103 
00106   virtual void DeepCopy(vtkCell *c);
00107 
00109   virtual int GetCellType() = 0;
00110 
00112   virtual int GetCellDimension() = 0;
00113 
00115   virtual int GetInterpolationOrder() {return 1;};
00116 
00118   vtkPoints *GetPoints() {return this->Points;};
00119 
00121   int GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();};
00122 
00124   virtual int GetNumberOfEdges() = 0;
00125 
00127   virtual int GetNumberOfFaces() = 0;
00128 
00130   vtkIdList *GetPointIds() {return this->PointIds;};
00131 
00133   int GetPointId(int ptId) {return this->PointIds->GetId(ptId);};
00134 
00136   virtual vtkCell *GetEdge(int edgeId) = 0;
00137 
00139   virtual vtkCell *GetFace(int faceId) = 0;
00140 
00146   virtual int CellBoundary(int subId, float pcoords[3], vtkIdList *pts) = 0;
00147 
00162   virtual int EvaluatePosition(float x[3], float* closestPoint, 
00163                                int& subId, float pcoords[3], 
00164                                float& dist2, float *weights) = 0;
00165 
00169   virtual void EvaluateLocation(int& subId, float pcoords[3], 
00170                                 float x[3], float *weights) = 0;
00171 
00183   virtual void Contour(float value, vtkScalars *cellScalars, 
00184                        vtkPointLocator *locator, vtkCellArray *verts, 
00185                        vtkCellArray *lines, vtkCellArray *polys, 
00186                        vtkPointData *inPd, vtkPointData *outPd,
00187                        vtkCellData *inCd, int cellId, vtkCellData *outCd) = 0;
00188 
00200   virtual void Clip(float value, vtkScalars *cellScalars, 
00201                     vtkPointLocator *locator, vtkCellArray *connectivity,
00202                     vtkPointData *inPd, vtkPointData *outPd,
00203                     vtkCellData *inCd, int cellId, vtkCellData *outCd, 
00204                     int insideOut) = 0;
00205 
00209   virtual int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00210                                 float x[3], float pcoords[3], int& subId) = 0;
00211 
00219   virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00220 
00233   virtual void Derivatives(int subId, float pcoords[3], float *values, 
00234                            int dim, float *derivs) = 0;
00235 
00236 
00239   void GetBounds(float bounds[6]);
00240 
00241 
00244   float *GetBounds();
00245 
00246 
00248   float GetLength2();
00249 
00250 
00256   virtual int GetParametricCenter(float pcoords[3]);
00257 
00258 
00266   static char HitBBox(float bounds[6], float origin[3], float dir[3], 
00267                       float coord[3], float& t);
00268 
00269   
00270   
00271   vtkPoints *Points;
00272   vtkIdList *PointIds;
00273 
00274 #ifndef VTK_REMOVE_LEGACY_CODE
00275 
00276   void DeepCopy(vtkCell &c) 
00277     {VTK_LEGACY_METHOD(DeepCopy,"3.2"); this->DeepCopy(&c);}
00278   void ShallowCopy(vtkCell &c) 
00279     {VTK_LEGACY_METHOD(ShallowCopy,"3.2"); this->ShallowCopy(&c);}
00280 #endif
00281   
00282 protected:
00283   vtkCell();
00284   ~vtkCell();
00285   vtkCell(const vtkCell&) {};
00286   void operator=(const vtkCell&) {};
00287 
00288   float Bounds[6];
00289 
00290 };
00291 
00292 #endif
00293 
00294