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