VTK
dox/Graphics/vtkDataSetSurfaceFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataSetSurfaceFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00030 #ifndef __vtkDataSetSurfaceFilter_h
00031 #define __vtkDataSetSurfaceFilter_h
00032 
00033 #include "vtkPolyDataAlgorithm.h"
00034 
00035 
00036 class vtkPointData;
00037 class vtkPoints;
00038 class vtkIdTypeArray;
00039 
00040 //BTX
00041 // Helper structure for hashing faces.
00042 struct vtkFastGeomQuadStruct
00043 {
00044   struct vtkFastGeomQuadStruct *Next;
00045   vtkIdType SourceId;
00046   int numPts;
00047   vtkIdType ptArray[4]; // actually a variable length array.  MUST be last
00048 };
00049 typedef struct vtkFastGeomQuadStruct vtkFastGeomQuad;
00050 //ETX
00051 
00052 class VTK_GRAPHICS_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
00053 {
00054 public:
00055   static vtkDataSetSurfaceFilter *New();
00056   vtkTypeMacro(vtkDataSetSurfaceFilter,vtkPolyDataAlgorithm);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00058 
00060 
00063   vtkSetMacro(UseStrips, int);
00064   vtkGetMacro(UseStrips, int);
00065   vtkBooleanMacro(UseStrips, int);
00067 
00069 
00072   vtkSetMacro(PieceInvariant, int);
00073   vtkGetMacro(PieceInvariant, int);
00075 
00077 
00083   vtkSetMacro(PassThroughCellIds,int);
00084   vtkGetMacro(PassThroughCellIds,int);
00085   vtkBooleanMacro(PassThroughCellIds,int);
00086   vtkSetMacro(PassThroughPointIds,int);
00087   vtkGetMacro(PassThroughPointIds,int);
00088   vtkBooleanMacro(PassThroughPointIds,int);
00090 
00091 
00093 
00095   virtual int StructuredExecute(vtkDataSet *input,
00096     vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt);
00097 #ifdef VTK_USE_64BIT_IDS
00098   virtual int StructuredExecute(vtkDataSet *input,
00099     vtkPolyData *output, int *ext32, int *wholeExt32)
00100     {
00101     vtkIdType ext[6]; vtkIdType wholeExt[6];
00102     for (int cc=0; cc < 6; cc++)
00103       {
00104       ext[cc] = ext32[cc];
00105       wholeExt[cc] = wholeExt32[cc];
00106       }
00107     return this->StructuredExecute(input, output, ext, wholeExt);
00108     }
00110 #endif
00111   virtual int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output);
00112   virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output);
00113 
00114 protected:
00115   vtkDataSetSurfaceFilter();
00116   ~vtkDataSetSurfaceFilter();
00117 
00118   int UseStrips;
00119   
00120   virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00121 
00122   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00123   virtual int FillInputPortInformation(int port, vtkInformation *info);
00124 
00125 
00126   // Helper methods.
00127   void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output,
00128                          int maxFlag, vtkIdType *ext,
00129                          int aAxis, int bAxis, int cAxis,
00130                          vtkIdType *wholeExt);
00131   void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
00132                         int maxFlag, vtkIdType *ext,
00133                         int aAxis, int bAxis, int cAxis,
00134                         vtkIdType *wholeExt);
00135 
00136   void InitializeQuadHash(vtkIdType numPoints);
00137   void DeleteQuadHash();
00138   virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d,
00139                         vtkIdType sourceId);
00140   virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c,
00141                        vtkIdType sourceId, vtkIdType faceId = -1);
00142   virtual void InsertPolygonInHash(vtkIdType* ids, int numpts,
00143                            vtkIdType sourceId);
00144   void InitQuadHashTraversal();
00145   vtkFastGeomQuad *GetNextVisibleQuadFromHash();
00146 
00147   vtkFastGeomQuad **QuadHash;
00148   vtkIdType QuadHashLength;
00149   vtkFastGeomQuad *QuadHashTraversal;
00150   vtkIdType QuadHashTraversalIndex;
00151 
00152   vtkIdType *PointMap;
00153   vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input, 
00154                              vtkPoints *outPts, vtkPointData *outPD);
00155   
00156   vtkIdType NumberOfNewCells;
00157   
00158   // Better memory allocation for faces (hash)
00159   void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
00160   vtkFastGeomQuad* NewFastGeomQuad(int numPts);
00161   void DeleteAllFastGeomQuads();
00162   // -----
00163   vtkIdType FastGeomQuadArrayLength;
00164   vtkIdType NumberOfFastGeomQuadArrays;
00165   unsigned char** FastGeomQuadArrays;  // store this data as an array of bytes
00166   // These indexes allow us to find the next available face.
00167   vtkIdType NextArrayIndex;
00168   vtkIdType NextQuadIndex;
00169 
00170   int PieceInvariant;
00171 
00172   int PassThroughCellIds;
00173   void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
00174   virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad);
00175   vtkIdTypeArray *OriginalCellIds;
00176 
00177   int PassThroughPointIds;
00178   void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
00179   vtkIdTypeArray *OriginalPointIds;
00180 
00181 private:
00182   vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&);  // Not implemented.
00183   void operator=(const vtkDataSetSurfaceFilter&);  // Not implemented.
00184 };
00185 
00186 #endif