Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkCell.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCell.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00043 #ifndef __vtkCell_h
00044 #define __vtkCell_h
00045 
00046 #define VTK_CELL_SIZE 512
00047 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
00048 
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 vtkPointLocator;
00059 class vtkPoints;
00060 
00061 class VTK_COMMON_EXPORT vtkCell : public vtkObject
00062 {
00063 public:
00064   vtkTypeRevisionMacro(vtkCell,vtkObject);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00066 
00069   void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
00070 
00071 #ifndef VTK_REMOVE_LEGACY_CODE
00072 
00073   virtual vtkCell* MakeObject();
00074 #endif
00075 
00079   virtual void ShallowCopy(vtkCell *c);
00080 
00083   virtual void DeepCopy(vtkCell *c);
00084 
00086   virtual int GetCellType() = 0;
00087 
00089   virtual int GetCellDimension() = 0;
00090 
00094   virtual int IsLinear() {return 1;}
00095 
00097 
00100   virtual int RequiresInitialization() {return 0;}
00101   virtual void Initialize() {}
00103 
00107   virtual int IsExplicitCell() {return 0;}
00108 
00110   vtkPoints *GetPoints() {return this->Points;}
00111 
00113   int GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
00114 
00116   virtual int GetNumberOfEdges() = 0;
00117 
00119   virtual int GetNumberOfFaces() = 0;
00120 
00122   vtkIdList *GetPointIds() {return this->PointIds;}
00123 
00125   vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
00126 
00128   virtual vtkCell *GetEdge(int edgeId) = 0;
00129 
00131   virtual vtkCell *GetFace(int faceId) = 0;
00132 
00138   virtual int CellBoundary(int subId, float pcoords[3], vtkIdList *pts) = 0;
00139 
00141 
00155   virtual int EvaluatePosition(float x[3], float* closestPoint, 
00156                                int& subId, float pcoords[3], 
00157                                float& dist2, float *weights) = 0;
00159 
00161 
00164   virtual void EvaluateLocation(int& subId, float pcoords[3], 
00165                                 float x[3], float *weights) = 0;
00167 
00169 
00180   virtual void Contour(float value, vtkDataArray *cellScalars, 
00181                        vtkPointLocator *locator, vtkCellArray *verts, 
00182                        vtkCellArray *lines, vtkCellArray *polys, 
00183                        vtkPointData *inPd, vtkPointData *outPd,
00184                        vtkCellData *inCd, vtkIdType cellId,
00185                        vtkCellData *outCd) = 0;
00187 
00189 
00200   virtual void Clip(float value, vtkDataArray *cellScalars, 
00201                     vtkPointLocator *locator, vtkCellArray *connectivity,
00202                     vtkPointData *inPd, vtkPointData *outPd,
00203                     vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 
00204                     int insideOut) = 0;
00206 
00208 
00211   virtual int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00212                                 float x[3], float pcoords[3], int& subId) = 0;
00214 
00222   virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00223 
00225 
00237   virtual void Derivatives(int subId, float pcoords[3], float *values, 
00238                            int dim, float *derivs) = 0;
00240 
00241 
00244   void GetBounds(float bounds[6]);
00245 
00246 
00249   float *GetBounds();
00250 
00251 
00253   float GetLength2();
00254 
00255 
00261   virtual int GetParametricCenter(float pcoords[3]);
00262 
00263 
00265 
00272   static char HitBBox(float bounds[6], float origin[3], float dir[3], 
00273                       float coord[3], float& t);
00275 
00276   
00277   // left public for quick computational access
00278   vtkPoints *Points;
00279   vtkIdList *PointIds;
00280 
00281 protected:
00282   vtkCell();
00283   ~vtkCell();
00284 
00285   float Bounds[6];
00286 private:
00287   vtkCell(const vtkCell&);  // Not implemented.
00288   void operator=(const vtkCell&);  // Not implemented.
00289 };
00290 
00291 #endif
00292 
00293