VTK
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 =========================================================================*/
34 #ifndef vtkDataSetSurfaceFilter_h
35 #define vtkDataSetSurfaceFilter_h
36 
37 #include "vtkFiltersGeometryModule.h" // For export macro
38 #include "vtkPolyDataAlgorithm.h"
39 
40 
41 class vtkPointData;
42 class vtkPoints;
43 class vtkIdTypeArray;
44 
45 // Helper structure for hashing faces.
47 {
50  int numPts;
52 };
54 
55 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
56 {
57 public:
58  static vtkDataSetSurfaceFilter *New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
63 
68  vtkSetMacro(UseStrips, int);
69  vtkGetMacro(UseStrips, int);
70  vtkBooleanMacro(UseStrips, int);
72 
74 
79  vtkSetMacro(PieceInvariant, int);
80  vtkGetMacro(PieceInvariant, int);
82 
84 
92  vtkSetMacro(PassThroughCellIds,int);
93  vtkGetMacro(PassThroughCellIds,int);
94  vtkBooleanMacro(PassThroughCellIds,int);
95  vtkSetMacro(PassThroughPointIds,int);
96  vtkGetMacro(PassThroughPointIds,int);
97  vtkBooleanMacro(PassThroughPointIds,int);
99 
101 
107  vtkSetStringMacro(OriginalCellIdsName);
108  virtual const char *GetOriginalCellIdsName()
109  {
110  return ( this->OriginalCellIdsName
111  ? this->OriginalCellIdsName : "vtkOriginalCellIds");
112  }
113  vtkSetStringMacro(OriginalPointIdsName);
114  virtual const char *GetOriginalPointIdsName()
115  {
116  return ( this->OriginalPointIdsName
117  ? this->OriginalPointIdsName : "vtkOriginalPointIds");
118  }
120 
122 
133  vtkSetMacro(NonlinearSubdivisionLevel, int);
134  vtkGetMacro(NonlinearSubdivisionLevel, int);
136 
138 
142  virtual int StructuredExecute(vtkDataSet *input,
143  vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt);
144 #ifdef VTK_USE_64BIT_IDS
145  virtual int StructuredExecute(vtkDataSet *input,
146  vtkPolyData *output, int *ext32, int *wholeExt32)
147  {
148  vtkIdType ext[6]; vtkIdType wholeExt[6];
149  for (int cc=0; cc < 6; cc++)
150  {
151  ext[cc] = ext32[cc];
152  wholeExt[cc] = wholeExt32[cc];
153  }
154  return this->StructuredExecute(input, output, ext, wholeExt);
155  }
156 #endif
157  virtual int UnstructuredGridExecute(vtkDataSet *input,
158  vtkPolyData *output);
159  virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output);
160  virtual int UniformGridExecute(
161  vtkDataSet *input, vtkPolyData *output,
162  vtkIdType *ext, vtkIdType *wholeExt, bool extractface[6] );
163 #ifdef VTK_USE_64BIT_IDS
164  virtual int UniformGridExecute(vtkDataSet *input,
165  vtkPolyData *output, int *ext32, int *wholeExt32, bool extractface[6] )
166  {
167  vtkIdType ext[6]; vtkIdType wholeExt[6];
168  for (int cc=0; cc < 6; cc++)
169  {
170  ext[cc] = ext32[cc];
171  wholeExt[cc] = wholeExt32[cc];
172  }
173  return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
174  }
175 #endif
176 
177 
178 protected:
180  ~vtkDataSetSurfaceFilter() VTK_OVERRIDE;
181 
182  int UseStrips;
183 
184  int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
185 
186  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
187  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
188 
189 
190  // Helper methods.
191 
199  void EstimateStructuredDataArraySizes(
200  vtkIdType *ext, vtkIdType *wholeExt,
201  vtkIdType &numPoints, vtkIdType &numCells );
202 
203  void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output,
204  int maxFlag, vtkIdType *ext,
205  int aAxis, int bAxis, int cAxis,
206  vtkIdType *wholeExt);
207 
208  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
209  int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis,
210  vtkIdType *wholeExt, bool checkVisibility );
211 
212  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
213  int maxFlag, vtkIdType *ext,
214  int aAxis, int bAxis, int cAxis,
215  vtkIdType *wholeExt);
216 
217  void InitializeQuadHash(vtkIdType numPoints);
218  void DeleteQuadHash();
219  virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d,
220  vtkIdType sourceId);
221  virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c,
222  vtkIdType sourceId, vtkIdType faceId = -1);
223  virtual void InsertPolygonInHash(vtkIdType* ids, int numpts,
224  vtkIdType sourceId);
225  void InitQuadHashTraversal();
226  vtkFastGeomQuad *GetNextVisibleQuadFromHash();
227 
228  vtkFastGeomQuad **QuadHash;
229  vtkIdType QuadHashLength;
230  vtkFastGeomQuad *QuadHashTraversal;
231  vtkIdType QuadHashTraversalIndex;
232 
233  vtkIdType *PointMap;
234  vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input,
235  vtkPoints *outPts, vtkPointData *outPD);
236 
237  class vtkEdgeInterpolationMap;
238 
239  vtkEdgeInterpolationMap *EdgeMap;
240  vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB,
241  vtkDataSet *input, vtkCell *cell,
242  double pcoords[3], vtkPoints *outPts,
243  vtkPointData *outPD);
244 
245  vtkIdType NumberOfNewCells;
246 
247  // Better memory allocation for faces (hash)
248  void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
249  vtkFastGeomQuad* NewFastGeomQuad(int numPts);
250  void DeleteAllFastGeomQuads();
251  // -----
252  vtkIdType FastGeomQuadArrayLength;
253  vtkIdType NumberOfFastGeomQuadArrays;
254  unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
255  // These indexes allow us to find the next available face.
256  vtkIdType NextArrayIndex;
257  vtkIdType NextQuadIndex;
258 
259  int PieceInvariant;
260 
261  int PassThroughCellIds;
262  void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
263  virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad);
264  vtkIdTypeArray *OriginalCellIds;
265  char *OriginalCellIdsName;
266 
267  int PassThroughPointIds;
268  void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
269  vtkIdTypeArray *OriginalPointIds;
270  char *OriginalPointIdsName;
271 
272  int NonlinearSubdivisionLevel;
273 
274 private:
275  vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&) VTK_DELETE_FUNCTION;
276  void operator=(const vtkDataSetSurfaceFilter&) VTK_DELETE_FUNCTION;
277 };
278 
279 #endif
represent and manipulate point attribute data
Definition: vtkPointData.h:37
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
virtual const char * GetOriginalCellIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
static vtkPolyDataAlgorithm * New()
abstract class to specify cell behavior
Definition: vtkCell.h:59
Superclass for algorithms that produce only polydata as output.
struct vtkFastGeomQuadStruct * Next
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual const char * GetOriginalPointIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Extracts outer (polygonal) surface.
represent and manipulate 3D points
Definition: vtkPoints.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.