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

Common/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 =========================================================================*/
00054 #ifndef __vtkCell_h
00055 #define __vtkCell_h
00056 
00057 #define VTK_CELL_SIZE 512
00058 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
00059 
00060 #include "vtkObject.h"
00061 
00062 #include "vtkIdList.h" // Needed for inline methods
00063 #include "vtkCellType.h" // Needed to define cell types
00064 
00065 class vtkCellArray;
00066 class vtkCellData;
00067 class vtkDataArray;
00068 class vtkPointData;
00069 class vtkPointLocator;
00070 class vtkPoints;
00071 
00072 class VTK_COMMON_EXPORT vtkCell : public vtkObject
00073 {
00074 public:
00075   vtkTypeRevisionMacro(vtkCell,vtkObject);
00076   void PrintSelf(ostream& os, vtkIndent indent);
00077 
00080   void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
00081 
00082 #ifndef VTK_REMOVE_LEGACY_CODE
00083 
00084   virtual vtkCell* MakeObject();
00085 #endif
00086 
00090   virtual void ShallowCopy(vtkCell *c);
00091 
00094   virtual void DeepCopy(vtkCell *c);
00095 
00097   virtual int GetCellType() = 0;
00098 
00100   virtual int GetCellDimension() = 0;
00101 
00105   virtual int IsLinear() {return 1;}
00106 
00108 
00111   virtual int RequiresInitialization() {return 0;}
00112   virtual void Initialize() {}
00114 
00118   virtual int IsExplicitCell() {return 0;}
00119 
00121   vtkPoints *GetPoints() {return this->Points;}
00122 
00124   int GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
00125 
00127   virtual int GetNumberOfEdges() = 0;
00128 
00130   virtual int GetNumberOfFaces() = 0;
00131 
00133   vtkIdList *GetPointIds() {return this->PointIds;}
00134 
00136   vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
00137 
00139   virtual vtkCell *GetEdge(int edgeId) = 0;
00140 
00142   virtual vtkCell *GetFace(int faceId) = 0;
00143 
00149   virtual int CellBoundary(int subId, float pcoords[3], vtkIdList *pts) = 0;
00150 
00152 
00166   virtual int EvaluatePosition(float x[3], float* closestPoint, 
00167                                int& subId, float pcoords[3], 
00168                                float& dist2, float *weights) = 0;
00170 
00172 
00175   virtual void EvaluateLocation(int& subId, float pcoords[3], 
00176                                 float x[3], float *weights) = 0;
00178 
00180 
00191   virtual void Contour(float value, vtkDataArray *cellScalars, 
00192                        vtkPointLocator *locator, vtkCellArray *verts, 
00193                        vtkCellArray *lines, vtkCellArray *polys, 
00194                        vtkPointData *inPd, vtkPointData *outPd,
00195                        vtkCellData *inCd, vtkIdType cellId,
00196                        vtkCellData *outCd) = 0;
00198 
00200 
00211   virtual void Clip(float value, vtkDataArray *cellScalars, 
00212                     vtkPointLocator *locator, vtkCellArray *connectivity,
00213                     vtkPointData *inPd, vtkPointData *outPd,
00214                     vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 
00215                     int insideOut) = 0;
00217 
00219 
00222   virtual int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
00223                                 float x[3], float pcoords[3], int& subId) = 0;
00225 
00233   virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
00234 
00236 
00248   virtual void Derivatives(int subId, float pcoords[3], float *values, 
00249                            int dim, float *derivs) = 0;
00251 
00252 
00255   void GetBounds(float bounds[6]);
00256 
00257 
00260   float *GetBounds();
00261 
00262 
00264   float GetLength2();
00265 
00266 
00272   virtual int GetParametricCenter(float pcoords[3]);
00273 
00274 
00276 
00283   static char HitBBox(float bounds[6], float origin[3], float dir[3], 
00284                       float coord[3], float& t);
00286 
00287   
00288   // left public for quick computational access
00289   vtkPoints *Points;
00290   vtkIdList *PointIds;
00291 
00292 protected:
00293   vtkCell();
00294   ~vtkCell();
00295 
00296   float Bounds[6];
00297 private:
00298   vtkCell(const vtkCell&);  // Not implemented.
00299   void operator=(const vtkCell&);  // Not implemented.
00300 };
00301 
00302 #endif
00303 
00304