VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkDataSetSurfaceFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataSetSurfaceFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef __vtkDataSetSurfaceFilter_h
34 #define __vtkDataSetSurfaceFilter_h
35 
36 #include "vtkFiltersGeometryModule.h" // For export macro
37 #include "vtkPolyDataAlgorithm.h"
38 
39 
40 class vtkPointData;
41 class vtkPoints;
42 class vtkIdTypeArray;
43 
44 //BTX
45 // Helper structure for hashing faces.
47 {
49  vtkIdType SourceId;
50  int numPts;
51  vtkIdType ptArray[4]; // actually a variable length array. MUST be last
52 };
54 //ETX
55 
56 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
57 {
58 public:
59  static vtkDataSetSurfaceFilter *New();
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
64 
67  vtkSetMacro(UseStrips, int);
68  vtkGetMacro(UseStrips, int);
69  vtkBooleanMacro(UseStrips, int);
71 
73 
76  vtkSetMacro(PieceInvariant, int);
77  vtkGetMacro(PieceInvariant, int);
79 
81 
87  vtkSetMacro(PassThroughCellIds,int);
88  vtkGetMacro(PassThroughCellIds,int);
89  vtkBooleanMacro(PassThroughCellIds,int);
90  vtkSetMacro(PassThroughPointIds,int);
91  vtkGetMacro(PassThroughPointIds,int);
92  vtkBooleanMacro(PassThroughPointIds,int);
94 
96 
100  vtkSetStringMacro(OriginalCellIdsName);
101  virtual const char *GetOriginalCellIdsName()
102  {
103  return ( this->OriginalCellIdsName
104  ? this->OriginalCellIdsName : "vtkOriginalCellIds");
105  }
106  vtkSetStringMacro(OriginalPointIdsName);
107  virtual const char *GetOriginalPointIdsName()
108  {
109  return ( this->OriginalPointIdsName
110  ? this->OriginalPointIdsName : "vtkOriginalPointIds");
111  }
113 
115 
125  vtkSetMacro(NonlinearSubdivisionLevel, int);
126  vtkGetMacro(NonlinearSubdivisionLevel, int);
128 
130 
132  virtual int StructuredExecute(vtkDataSet *input,
133  vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt);
134 #ifdef VTK_USE_64BIT_IDS
135  virtual int StructuredExecute(vtkDataSet *input,
136  vtkPolyData *output, int *ext32, int *wholeExt32)
137  {
138  vtkIdType ext[6]; vtkIdType wholeExt[6];
139  for (int cc=0; cc < 6; cc++)
140  {
141  ext[cc] = ext32[cc];
142  wholeExt[cc] = wholeExt32[cc];
143  }
144  return this->StructuredExecute(input, output, ext, wholeExt);
145  }
146 #endif
147  virtual int UnstructuredGridExecute(vtkDataSet *input,
148  vtkPolyData *output,
149  int updateghostlevel);
150  virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output);
151  virtual int UniformGridExecute(
152  vtkDataSet *input, vtkPolyData *output,
153  vtkIdType *ext, vtkIdType *wholeExt, bool extractface[6] );
154 #ifdef VTK_USE_64BIT_IDS
155  virtual int UniformGridExecute(vtkDataSet *input,
156  vtkPolyData *output, int *ext32, int *wholeExt32, bool extractface[6] )
157  {
158  vtkIdType ext[6]; vtkIdType wholeExt[6];
159  for (int cc=0; cc < 6; cc++)
160  {
161  ext[cc] = ext32[cc];
162  wholeExt[cc] = wholeExt32[cc];
163  }
164  return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
165  }
166 #endif
167 
168 
169 protected:
172 
174 
175  virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
176 
177  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
178  virtual int FillInputPortInformation(int port, vtkInformation *info);
179 
180 
181  // Helper methods.
182 
184 
189  void EstimateStructuredDataArraySizes(
190  vtkIdType *ext, vtkIdType *wholeExt,
191  vtkIdType &numPoints, vtkIdType &numCells );
193 
194  void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output,
195  int maxFlag, vtkIdType *ext,
196  int aAxis, int bAxis, int cAxis,
197  vtkIdType *wholeExt);
198 
199  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
200  int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis,
201  vtkIdType *wholeExt, bool checkVisibility );
202 
203  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
204  int maxFlag, vtkIdType *ext,
205  int aAxis, int bAxis, int cAxis,
206  vtkIdType *wholeExt);
207 
208  void InitializeQuadHash(vtkIdType numPoints);
209  void DeleteQuadHash();
210  virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d,
211  vtkIdType sourceId);
212  virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c,
213  vtkIdType sourceId, vtkIdType faceId = -1);
214  virtual void InsertPolygonInHash(vtkIdType* ids, int numpts,
215  vtkIdType sourceId);
216  void InitQuadHashTraversal();
217  vtkFastGeomQuad *GetNextVisibleQuadFromHash();
218 
220  vtkIdType QuadHashLength;
223 
224  vtkIdType *PointMap;
225  vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input,
226  vtkPoints *outPts, vtkPointData *outPD);
227 //BTX
228  class vtkEdgeInterpolationMap;
229 //ETX
230  vtkEdgeInterpolationMap *EdgeMap;
231  vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB,
232  vtkDataSet *input, vtkCell *cell,
233  double pcoords[3], vtkPoints *outPts,
234  vtkPointData *outPD);
235 
236  vtkIdType NumberOfNewCells;
237 
238  // Better memory allocation for faces (hash)
239  void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
240  vtkFastGeomQuad* NewFastGeomQuad(int numPts);
241  void DeleteAllFastGeomQuads();
242  // -----
245  unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
246  // These indexes allow us to find the next available face.
247  vtkIdType NextArrayIndex;
248  vtkIdType NextQuadIndex;
249 
251 
253  void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
254  virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad);
255  vtkIdTypeArray *OriginalCellIds;
257 
259  void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
260  vtkIdTypeArray *OriginalPointIds;
262 
264 
265 private:
266  vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&); // Not implemented.
267  void operator=(const vtkDataSetSurfaceFilter&); // Not implemented.
268 };
269 
270 #endif
virtual int FillInputPortInformation(int port, vtkInformation *info)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual const char * GetOriginalCellIdsName()
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:82
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Superclass for algorithms that produce only polydata as output.
struct vtkFastGeomQuadStruct * Next
virtual const char * GetOriginalPointIdsName()
Extracts outer (polygonal) surface.
vtkEdgeInterpolationMap * EdgeMap