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 =========================================================================*/
31 #ifndef vtkDataSetSurfaceFilter_h
32 #define vtkDataSetSurfaceFilter_h
33 
34 #include "vtkFiltersGeometryModule.h" // For export macro
35 #include "vtkPolyDataAlgorithm.h"
36 
37 class vtkPointData;
38 class vtkPoints;
39 class vtkIdTypeArray;
40 class vtkStructuredGrid;
41 
42 // Helper structure for hashing faces.
44 {
47  int numPts;
49 };
51 
52 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
53 {
54 public:
55  static vtkDataSetSurfaceFilter *New();
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
65  vtkSetMacro(UseStrips, vtkTypeBool);
66  vtkGetMacro(UseStrips, vtkTypeBool);
67  vtkBooleanMacro(UseStrips, vtkTypeBool);
69 
71 
76  vtkSetMacro(PieceInvariant, int);
77  vtkGetMacro(PieceInvariant, int);
79 
81 
89  vtkSetMacro(PassThroughCellIds,vtkTypeBool);
90  vtkGetMacro(PassThroughCellIds,vtkTypeBool);
91  vtkBooleanMacro(PassThroughCellIds,vtkTypeBool);
92  vtkSetMacro(PassThroughPointIds,vtkTypeBool);
93  vtkGetMacro(PassThroughPointIds,vtkTypeBool);
94  vtkBooleanMacro(PassThroughPointIds,vtkTypeBool);
96 
98 
104  vtkSetStringMacro(OriginalCellIdsName);
105  virtual const char *GetOriginalCellIdsName()
106  {
107  return ( this->OriginalCellIdsName
108  ? this->OriginalCellIdsName : "vtkOriginalCellIds");
109  }
110  vtkSetStringMacro(OriginalPointIdsName);
111  virtual const char *GetOriginalPointIdsName()
112  {
113  return ( this->OriginalPointIdsName
114  ? this->OriginalPointIdsName : "vtkOriginalPointIds");
115  }
117 
119 
130  vtkSetMacro(NonlinearSubdivisionLevel, int);
131  vtkGetMacro(NonlinearSubdivisionLevel, int);
133 
135 
139  virtual int StructuredExecute(vtkDataSet *input,
140  vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt);
141 #ifdef VTK_USE_64BIT_IDS
142  virtual int StructuredExecute(vtkDataSet *input,
143  vtkPolyData *output, int *ext32, int *wholeExt32)
144  {
145  vtkIdType ext[6]; vtkIdType wholeExt[6];
146  for (int cc=0; cc < 6; cc++)
147  {
148  ext[cc] = ext32[cc];
149  wholeExt[cc] = wholeExt32[cc];
150  }
151  return this->StructuredExecute(input, output, ext, wholeExt);
152  }
153 #endif
154  virtual int UnstructuredGridExecute(vtkDataSet *input,
155  vtkPolyData *output);
156  virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output);
157  virtual int StructuredWithBlankingExecute(vtkStructuredGrid *input, vtkPolyData *output);
158  virtual int UniformGridExecute(
159  vtkDataSet *input, vtkPolyData *output,
160  vtkIdType *ext, vtkIdType *wholeExt, bool extractface[6] );
161 #ifdef VTK_USE_64BIT_IDS
162  virtual int UniformGridExecute(vtkDataSet *input,
163  vtkPolyData *output, int *ext32, int *wholeExt32, bool extractface[6] )
164  {
165  vtkIdType ext[6]; vtkIdType wholeExt[6];
166  for (int cc=0; cc < 6; cc++)
167  {
168  ext[cc] = ext32[cc];
169  wholeExt[cc] = wholeExt32[cc];
170  }
171  return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
172  }
173 #endif
174 
175 
176 protected:
178  ~vtkDataSetSurfaceFilter() override;
179 
181 
183 
185  int FillInputPortInformation(int port, vtkInformation *info) override;
186 
187 
188  // Helper methods.
189 
197  void EstimateStructuredDataArraySizes(
198  vtkIdType *ext, vtkIdType *wholeExt,
199  vtkIdType &numPoints, vtkIdType &numCells );
200 
201  void ExecuteFaceStrips(vtkDataSet *input, vtkPolyData *output,
202  int maxFlag, vtkIdType *ext,
203  int aAxis, int bAxis, int cAxis,
204  vtkIdType *wholeExt);
205 
206  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
207  int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis,
208  vtkIdType *wholeExt, bool checkVisibility );
209 
210  void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output,
211  int maxFlag, vtkIdType *ext,
212  int aAxis, int bAxis, int cAxis,
213  vtkIdType *wholeExt);
214 
215  void InitializeQuadHash(vtkIdType numPoints);
216  void DeleteQuadHash();
217  virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d,
218  vtkIdType sourceId);
219  virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c,
220  vtkIdType sourceId, vtkIdType faceId = -1);
221  virtual void InsertPolygonInHash(vtkIdType* ids, int numpts,
222  vtkIdType sourceId);
223  void InitQuadHashTraversal();
224  vtkFastGeomQuad *GetNextVisibleQuadFromHash();
225 
230 
232  vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input,
233  vtkPoints *outPts, vtkPointData *outPD);
234 
235  class vtkEdgeInterpolationMap;
236 
237  vtkEdgeInterpolationMap *EdgeMap;
238  vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB,
239  vtkDataSet *input, vtkCell *cell,
240  double pcoords[3], vtkPoints *outPts,
241  vtkPointData *outPD);
242 
244 
245  // Better memory allocation for faces (hash)
246  void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
247  vtkFastGeomQuad* NewFastGeomQuad(int numPts);
248  void DeleteAllFastGeomQuads();
249  // -----
252  unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
253  // These indexes allow us to find the next available face.
256 
258 
260  void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
261  virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad);
264 
266  void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
269 
271 
272 private:
274  void operator=(const vtkDataSetSurfaceFilter&) = delete;
275 };
276 
277 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkFastGeomQuadStruct::ptArray
vtkIdType * ptArray
Definition: vtkDataSetSurfaceFilter.h:48
vtkFastGeomQuadStruct::SourceId
vtkIdType SourceId
Definition: vtkDataSetSurfaceFilter.h:46
vtkFastGeomQuadStruct::numPts
int numPts
Definition: vtkDataSetSurfaceFilter.h:47
vtkDataSetSurfaceFilter::NextArrayIndex
vtkIdType NextArrayIndex
Definition: vtkDataSetSurfaceFilter.h:254
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:37
vtkFastGeomQuadStruct::Next
struct vtkFastGeomQuadStruct * Next
Definition: vtkDataSetSurfaceFilter.h:45
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkDataSetSurfaceFilter::FastGeomQuadArrays
unsigned char ** FastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:252
vtkDataSetSurfaceFilter::FastGeomQuadArrayLength
vtkIdType FastGeomQuadArrayLength
Definition: vtkDataSetSurfaceFilter.h:250
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkDataSetSurfaceFilter::QuadHashLength
vtkIdType QuadHashLength
Definition: vtkDataSetSurfaceFilter.h:227
vtkDataSetSurfaceFilter::QuadHashTraversal
vtkFastGeomQuad * QuadHashTraversal
Definition: vtkDataSetSurfaceFilter.h:228
vtkPolyDataAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:63
vtkDataSetSurfaceFilter::GetOriginalCellIdsName
virtual const char * GetOriginalCellIdsName()
Definition: vtkDataSetSurfaceFilter.h:105
vtkDataSetSurfaceFilter::QuadHashTraversalIndex
vtkIdType QuadHashTraversalIndex
Definition: vtkDataSetSurfaceFilter.h:229
vtkDataSetSurfaceFilter::OriginalCellIds
vtkIdTypeArray * OriginalCellIds
Definition: vtkDataSetSurfaceFilter.h:262
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataSetSurfaceFilter::PointMap
vtkIdType * PointMap
Definition: vtkDataSetSurfaceFilter.h:231
vtkDataSetSurfaceFilter::PassThroughCellIds
vtkTypeBool PassThroughCellIds
Definition: vtkDataSetSurfaceFilter.h:259
vtkPolyDataAlgorithm.h
vtkDataSetSurfaceFilter
Extracts outer (polygonal) surface.
Definition: vtkDataSetSurfaceFilter.h:52
vtkX3D::port
Definition: vtkX3D.h:447
vtkDataSetSurfaceFilter::OriginalCellIdsName
char * OriginalCellIdsName
Definition: vtkDataSetSurfaceFilter.h:263
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkDataSetSurfaceFilter::OriginalPointIdsName
char * OriginalPointIdsName
Definition: vtkDataSetSurfaceFilter.h:268
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDataSetSurfaceFilter::NumberOfFastGeomQuadArrays
vtkIdType NumberOfFastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:251
vtkDataSetSurfaceFilter::PieceInvariant
int PieceInvariant
Definition: vtkDataSetSurfaceFilter.h:257
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkDataSetSurfaceFilter::NumberOfNewCells
vtkIdType NumberOfNewCells
Definition: vtkDataSetSurfaceFilter.h:243
vtkDataSetSurfaceFilter::NextQuadIndex
vtkIdType NextQuadIndex
Definition: vtkDataSetSurfaceFilter.h:255
vtkDataSetSurfaceFilter::OriginalPointIds
vtkIdTypeArray * OriginalPointIds
Definition: vtkDataSetSurfaceFilter.h:267
vtkDataSetSurfaceFilter::GetOriginalPointIdsName
virtual const char * GetOriginalPointIdsName()
Definition: vtkDataSetSurfaceFilter.h:111
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkDataSetSurfaceFilter::EdgeMap
vtkEdgeInterpolationMap * EdgeMap
Definition: vtkDataSetSurfaceFilter.h:235
vtkFastGeomQuadStruct
Definition: vtkDataSetSurfaceFilter.h:43
vtkDataSetSurfaceFilter::UseStrips
vtkTypeBool UseStrips
Definition: vtkDataSetSurfaceFilter.h:180
vtkDataSetSurfaceFilter::QuadHash
vtkFastGeomQuad ** QuadHash
Definition: vtkDataSetSurfaceFilter.h:226
vtkDataSetSurfaceFilter::PassThroughPointIds
vtkTypeBool PassThroughPointIds
Definition: vtkDataSetSurfaceFilter.h:265
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkDataSetSurfaceFilter::NonlinearSubdivisionLevel
int NonlinearSubdivisionLevel
Definition: vtkDataSetSurfaceFilter.h:270
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44