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 =========================================================================*/ 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 00092 00096 vtkSetStringMacro(OriginalCellIdsName); 00097 virtual const char *GetOriginalCellIdsName() { 00098 return ( this->OriginalCellIdsName 00099 ? this->OriginalCellIdsName : "vtkOriginalCellIds"); 00100 } 00101 vtkSetStringMacro(OriginalPointIdsName); 00102 virtual const char *GetOriginalPointIdsName() { 00103 return ( this->OriginalPointIdsName 00104 ? this->OriginalPointIdsName : "vtkOriginalPointIds"); 00105 } 00107 00109 00119 vtkSetMacro(NonlinearSubdivisionLevel, int); 00120 vtkGetMacro(NonlinearSubdivisionLevel, int); 00122 00124 00126 virtual int StructuredExecute(vtkDataSet *input, 00127 vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt); 00128 #ifdef VTK_USE_64BIT_IDS 00129 virtual int StructuredExecute(vtkDataSet *input, 00130 vtkPolyData *output, int *ext32, int *wholeExt32) 00131 { 00132 vtkIdType ext[6]; vtkIdType wholeExt[6]; 00133 for (int cc=0; cc < 6; cc++) 00134 { 00135 ext[cc] = ext32[cc]; 00136 wholeExt[cc] = wholeExt32[cc]; 00137 } 00138 return this->StructuredExecute(input, output, ext, wholeExt); 00139 } 00140 #endif 00141 virtual int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output); 00142 virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output); 00144 00145 protected: 00146 vtkDataSetSurfaceFilter(); 00147 ~vtkDataSetSurfaceFilter(); 00148 00149 int UseStrips; 00150 00151 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00152 00153 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00154 virtual int FillInputPortInformation(int port, vtkInformation *info); 00155 00156 00157 // Helper methods. 00158 void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output, 00159 int maxFlag, vtkIdType *ext, 00160 int aAxis, int bAxis, int cAxis, 00161 vtkIdType *wholeExt); 00162 void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, 00163 int maxFlag, vtkIdType *ext, 00164 int aAxis, int bAxis, int cAxis, 00165 vtkIdType *wholeExt); 00166 00167 void InitializeQuadHash(vtkIdType numPoints); 00168 void DeleteQuadHash(); 00169 virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, 00170 vtkIdType sourceId); 00171 virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c, 00172 vtkIdType sourceId, vtkIdType faceId = -1); 00173 virtual void InsertPolygonInHash(vtkIdType* ids, int numpts, 00174 vtkIdType sourceId); 00175 void InitQuadHashTraversal(); 00176 vtkFastGeomQuad *GetNextVisibleQuadFromHash(); 00177 00178 vtkFastGeomQuad **QuadHash; 00179 vtkIdType QuadHashLength; 00180 vtkFastGeomQuad *QuadHashTraversal; 00181 vtkIdType QuadHashTraversalIndex; 00182 00183 vtkIdType *PointMap; 00184 vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input, 00185 vtkPoints *outPts, vtkPointData *outPD); 00186 //BTX 00187 class vtkEdgeInterpolationMap; 00188 //ETX 00189 vtkEdgeInterpolationMap *EdgeMap; 00190 vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, 00191 vtkDataSet *input, vtkCell *cell, 00192 double pcoords[3], vtkPoints *outPts, 00193 vtkPointData *outPD); 00194 00195 vtkIdType NumberOfNewCells; 00196 00197 // Better memory allocation for faces (hash) 00198 void InitFastGeomQuadAllocation(vtkIdType numberOfCells); 00199 vtkFastGeomQuad* NewFastGeomQuad(int numPts); 00200 void DeleteAllFastGeomQuads(); 00201 // ----- 00202 vtkIdType FastGeomQuadArrayLength; 00203 vtkIdType NumberOfFastGeomQuadArrays; 00204 unsigned char** FastGeomQuadArrays; // store this data as an array of bytes 00205 // These indexes allow us to find the next available face. 00206 vtkIdType NextArrayIndex; 00207 vtkIdType NextQuadIndex; 00208 00209 int PieceInvariant; 00210 00211 int PassThroughCellIds; 00212 void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId); 00213 virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad); 00214 vtkIdTypeArray *OriginalCellIds; 00215 char *OriginalCellIdsName; 00216 00217 int PassThroughPointIds; 00218 void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId); 00219 vtkIdTypeArray *OriginalPointIds; 00220 char *OriginalPointIdsName; 00221 00222 int NonlinearSubdivisionLevel; 00223 00224 private: 00225 vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&); // Not implemented. 00226 void operator=(const vtkDataSetSurfaceFilter&); // Not implemented. 00227 }; 00228 00229 #endif