VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDataSetSurfaceFilter.h,v $ 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 vtkTypeRevisionMacro(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 protected: 00092 vtkDataSetSurfaceFilter(); 00093 ~vtkDataSetSurfaceFilter(); 00094 00095 int UseStrips; 00096 00097 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00098 00099 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00100 virtual int FillInputPortInformation(int port, vtkInformation *info); 00101 int StructuredExecute(vtkDataSet *input, vtkPolyData *output, vtkIdType *ext, 00102 vtkInformation *inInfo); 00103 int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output); 00104 int DataSetExecute(vtkDataSet *input, vtkPolyData *output); 00105 00106 // Helper methods. 00107 void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output, 00108 int maxFlag, vtkIdType *ext, 00109 int aAxis, int bAxis, int cAxis, 00110 vtkInformation *inInfo); 00111 void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, 00112 int maxFlag, vtkIdType *ext, 00113 int aAxis, int bAxis, int cAxis, 00114 vtkInformation *inInfo); 00115 00116 void InitializeQuadHash(vtkIdType numPoints); 00117 void DeleteQuadHash(); 00118 virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, 00119 vtkIdType sourceId); 00120 virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c, 00121 vtkIdType sourceId); 00122 virtual void InsertPolygonInHash(vtkIdType* ids, int numpts, 00123 vtkIdType sourceId); 00124 void InitQuadHashTraversal(); 00125 vtkFastGeomQuad *GetNextVisibleQuadFromHash(); 00126 00127 vtkFastGeomQuad **QuadHash; 00128 vtkIdType QuadHashLength; 00129 vtkFastGeomQuad *QuadHashTraversal; 00130 vtkIdType QuadHashTraversalIndex; 00131 00132 vtkIdType *PointMap; 00133 vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input, 00134 vtkPoints *outPts, vtkPointData *outPD); 00135 00136 vtkIdType NumberOfNewCells; 00137 00138 // Better memory allocation for faces (hash) 00139 void InitFastGeomQuadAllocation(int numberOfCells); 00140 vtkFastGeomQuad* NewFastGeomQuad(int numPts); 00141 void DeleteAllFastGeomQuads(); 00142 // ----- 00143 int FastGeomQuadArrayLength; 00144 int NumberOfFastGeomQuadArrays; 00145 unsigned char** FastGeomQuadArrays; // store this data as an array of bytes 00146 // These indexes allow us to find the next available face. 00147 int NextArrayIndex; 00148 int NextQuadIndex; 00149 00150 int PieceInvariant; 00151 00152 int PassThroughCellIds; 00153 void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId); 00154 vtkIdTypeArray *OriginalCellIds; 00155 00156 int PassThroughPointIds; 00157 void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId); 00158 vtkIdTypeArray *OriginalPointIds; 00159 00160 private: 00161 vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&); // Not implemented. 00162 void operator=(const vtkDataSetSurfaceFilter&); // Not implemented. 00163 }; 00164 00165 #endif