VTK
|
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 =========================================================================*/ 00033 #ifndef __vtkDataSetSurfaceFilter_h 00034 #define __vtkDataSetSurfaceFilter_h 00035 00036 #include "vtkFiltersGeometryModule.h" // For export macro 00037 #include "vtkPolyDataAlgorithm.h" 00038 00039 00040 class vtkPointData; 00041 class vtkPoints; 00042 class vtkIdTypeArray; 00043 00044 //BTX 00045 // Helper structure for hashing faces. 00046 struct vtkFastGeomQuadStruct 00047 { 00048 struct vtkFastGeomQuadStruct *Next; 00049 vtkIdType SourceId; 00050 int numPts; 00051 vtkIdType ptArray[4]; // actually a variable length array. MUST be last 00052 }; 00053 typedef struct vtkFastGeomQuadStruct vtkFastGeomQuad; 00054 //ETX 00055 00056 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm 00057 { 00058 public: 00059 static vtkDataSetSurfaceFilter *New(); 00060 vtkTypeMacro(vtkDataSetSurfaceFilter,vtkPolyDataAlgorithm); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00062 00064 00067 vtkSetMacro(UseStrips, int); 00068 vtkGetMacro(UseStrips, int); 00069 vtkBooleanMacro(UseStrips, int); 00071 00073 00076 vtkSetMacro(PieceInvariant, int); 00077 vtkGetMacro(PieceInvariant, int); 00079 00081 00087 vtkSetMacro(PassThroughCellIds,int); 00088 vtkGetMacro(PassThroughCellIds,int); 00089 vtkBooleanMacro(PassThroughCellIds,int); 00090 vtkSetMacro(PassThroughPointIds,int); 00091 vtkGetMacro(PassThroughPointIds,int); 00092 vtkBooleanMacro(PassThroughPointIds,int); 00094 00096 00100 vtkSetStringMacro(OriginalCellIdsName); 00101 virtual const char *GetOriginalCellIdsName() 00102 { 00103 return ( this->OriginalCellIdsName 00104 ? this->OriginalCellIdsName : "vtkOriginalCellIds"); 00105 } 00106 vtkSetStringMacro(OriginalPointIdsName); 00107 virtual const char *GetOriginalPointIdsName() 00108 { 00109 return ( this->OriginalPointIdsName 00110 ? this->OriginalPointIdsName : "vtkOriginalPointIds"); 00111 } 00113 00115 00125 vtkSetMacro(NonlinearSubdivisionLevel, int); 00126 vtkGetMacro(NonlinearSubdivisionLevel, int); 00128 00130 00132 virtual int StructuredExecute(vtkDataSet *input, 00133 vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt); 00134 #ifdef VTK_USE_64BIT_IDS 00135 virtual int StructuredExecute(vtkDataSet *input, 00136 vtkPolyData *output, int *ext32, int *wholeExt32) 00137 { 00138 vtkIdType ext[6]; vtkIdType wholeExt[6]; 00139 for (int cc=0; cc < 6; cc++) 00140 { 00141 ext[cc] = ext32[cc]; 00142 wholeExt[cc] = wholeExt32[cc]; 00143 } 00144 return this->StructuredExecute(input, output, ext, wholeExt); 00145 } 00146 #endif 00147 virtual int UnstructuredGridExecute(vtkDataSet *input, 00148 vtkPolyData *output, 00149 int updateghostlevel); 00150 virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output); 00151 virtual int UniformGridExecute( 00152 vtkDataSet *input, vtkPolyData *output, 00153 vtkIdType *ext, vtkIdType *wholeExt, bool extractface[6] ); 00154 #ifdef VTK_USE_64BIT_IDS 00155 virtual int UniformGridExecute(vtkDataSet *input, 00156 vtkPolyData *output, int *ext32, int *wholeExt32, bool extractface[6] ) 00157 { 00158 vtkIdType ext[6]; vtkIdType wholeExt[6]; 00159 for (int cc=0; cc < 6; cc++) 00160 { 00161 ext[cc] = ext32[cc]; 00162 wholeExt[cc] = wholeExt32[cc]; 00163 } 00164 return this->UniformGridExecute(input, output, ext, wholeExt, extractface); 00165 } 00166 #endif 00167 00168 00169 protected: 00170 vtkDataSetSurfaceFilter(); 00171 ~vtkDataSetSurfaceFilter(); 00172 00173 int UseStrips; 00174 00175 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00176 00177 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00178 virtual int FillInputPortInformation(int port, vtkInformation *info); 00179 00180 00181 // Helper methods. 00182 00184 00189 void EstimateStructuredDataArraySizes( 00190 vtkIdType *ext, vtkIdType *wholeExt, 00191 vtkIdType &numPoints, vtkIdType &numCells ); 00193 00194 void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output, 00195 int maxFlag, vtkIdType *ext, 00196 int aAxis, int bAxis, int cAxis, 00197 vtkIdType *wholeExt); 00198 00199 void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, 00200 int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis, 00201 vtkIdType *wholeExt, bool checkVisibility ); 00202 00203 void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, 00204 int maxFlag, vtkIdType *ext, 00205 int aAxis, int bAxis, int cAxis, 00206 vtkIdType *wholeExt); 00207 00208 void InitializeQuadHash(vtkIdType numPoints); 00209 void DeleteQuadHash(); 00210 virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, 00211 vtkIdType sourceId); 00212 virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c, 00213 vtkIdType sourceId, vtkIdType faceId = -1); 00214 virtual void InsertPolygonInHash(vtkIdType* ids, int numpts, 00215 vtkIdType sourceId); 00216 void InitQuadHashTraversal(); 00217 vtkFastGeomQuad *GetNextVisibleQuadFromHash(); 00218 00219 vtkFastGeomQuad **QuadHash; 00220 vtkIdType QuadHashLength; 00221 vtkFastGeomQuad *QuadHashTraversal; 00222 vtkIdType QuadHashTraversalIndex; 00223 00224 vtkIdType *PointMap; 00225 vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input, 00226 vtkPoints *outPts, vtkPointData *outPD); 00227 //BTX 00228 class vtkEdgeInterpolationMap; 00229 //ETX 00230 vtkEdgeInterpolationMap *EdgeMap; 00231 vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, 00232 vtkDataSet *input, vtkCell *cell, 00233 double pcoords[3], vtkPoints *outPts, 00234 vtkPointData *outPD); 00235 00236 vtkIdType NumberOfNewCells; 00237 00238 // Better memory allocation for faces (hash) 00239 void InitFastGeomQuadAllocation(vtkIdType numberOfCells); 00240 vtkFastGeomQuad* NewFastGeomQuad(int numPts); 00241 void DeleteAllFastGeomQuads(); 00242 // ----- 00243 vtkIdType FastGeomQuadArrayLength; 00244 vtkIdType NumberOfFastGeomQuadArrays; 00245 unsigned char** FastGeomQuadArrays; // store this data as an array of bytes 00246 // These indexes allow us to find the next available face. 00247 vtkIdType NextArrayIndex; 00248 vtkIdType NextQuadIndex; 00249 00250 int PieceInvariant; 00251 00252 int PassThroughCellIds; 00253 void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId); 00254 virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad); 00255 vtkIdTypeArray *OriginalCellIds; 00256 char *OriginalCellIdsName; 00257 00258 int PassThroughPointIds; 00259 void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId); 00260 vtkIdTypeArray *OriginalPointIds; 00261 char *OriginalPointIdsName; 00262 00263 int NonlinearSubdivisionLevel; 00264 00265 private: 00266 vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&); // Not implemented. 00267 void operator=(const vtkDataSetSurfaceFilter&); // Not implemented. 00268 }; 00269 00270 #endif