VTK  9.0.1
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 ? this->OriginalCellIdsName : "vtkOriginalCellIds");
105  }
106  vtkSetStringMacro(OriginalPointIdsName);
107  virtual const char* GetOriginalPointIdsName()
108  {
109  return (this->OriginalPointIdsName ? this->OriginalPointIdsName : "vtkOriginalPointIds");
110  }
112 
114 
125  vtkSetMacro(NonlinearSubdivisionLevel, int);
126  vtkGetMacro(NonlinearSubdivisionLevel, int);
128 
130 
134  virtual int StructuredExecute(
135  vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt);
136 #ifdef VTK_USE_64BIT_IDS
137  virtual int StructuredExecute(vtkDataSet* input, vtkPolyData* output, int* ext32, int* wholeExt32)
138  {
139  vtkIdType ext[6];
140  vtkIdType wholeExt[6];
141  for (int cc = 0; cc < 6; cc++)
142  {
143  ext[cc] = ext32[cc];
144  wholeExt[cc] = wholeExt32[cc];
145  }
146  return this->StructuredExecute(input, output, ext, wholeExt);
147  }
148 #endif
149  virtual int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output);
150  virtual int DataSetExecute(vtkDataSet* input, vtkPolyData* output);
151  virtual int StructuredWithBlankingExecute(vtkStructuredGrid* input, vtkPolyData* output);
152  virtual int UniformGridExecute(vtkDataSet* input, vtkPolyData* output, vtkIdType* ext,
153  vtkIdType* wholeExt, bool extractface[6]);
154 #ifdef VTK_USE_64BIT_IDS
155  virtual int UniformGridExecute(
156  vtkDataSet* input, vtkPolyData* output, int* ext32, int* wholeExt32, bool extractface[6])
157  {
158  vtkIdType ext[6];
159  vtkIdType wholeExt[6];
160  for (int cc = 0; cc < 6; cc++)
161  {
162  ext[cc] = ext32[cc];
163  wholeExt[cc] = wholeExt32[cc];
164  }
165  return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
166  }
167 #endif
168 
169 
170 protected:
172  ~vtkDataSetSurfaceFilter() override;
173 
175 
177 
179  int FillInputPortInformation(int port, vtkInformation* info) override;
180 
181  // Helper methods.
182 
190  void EstimateStructuredDataArraySizes(
191  vtkIdType* ext, vtkIdType* wholeExt, vtkIdType& numPoints, vtkIdType& numCells);
192 
193  void ExecuteFaceStrips(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
194  int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt);
195 
196  void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
197  int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt, bool checkVisibility);
198 
199  void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
200  int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt);
201 
202  void InitializeQuadHash(vtkIdType numPoints);
203  void DeleteQuadHash();
204  virtual void InsertQuadInHash(
205  vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, vtkIdType sourceId);
206  virtual void InsertTriInHash(
207  vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType faceId = -1);
208  virtual void InsertPolygonInHash(const vtkIdType* ids, int numpts, vtkIdType sourceId);
209  void InitQuadHashTraversal();
210  vtkFastGeomQuad* GetNextVisibleQuadFromHash();
211 
216 
218  vtkIdType GetOutputPointId(
219  vtkIdType inPtId, vtkDataSet* input, vtkPoints* outPts, vtkPointData* outPD);
220 
221  class vtkEdgeInterpolationMap;
222 
223  vtkEdgeInterpolationMap* EdgeMap;
224  vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, vtkDataSet* input,
225  vtkCell* cell, double pcoords[3], vtkPoints* outPts, vtkPointData* outPD);
226 
228 
229  // Better memory allocation for faces (hash)
230  void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
231  vtkFastGeomQuad* NewFastGeomQuad(int numPts);
232  void DeleteAllFastGeomQuads();
233  // -----
236  unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
237  // These indexes allow us to find the next available face.
240 
242 
244  void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
245  virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad* quad);
248 
250  void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
253 
255 
256 private:
258  void operator=(const vtkDataSetSurfaceFilter&) = delete;
259 };
260 
261 #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:238
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:338
vtkDataSetSurfaceFilter::FastGeomQuadArrays
unsigned char ** FastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:236
vtkDataSetSurfaceFilter::FastGeomQuadArrayLength
vtkIdType FastGeomQuadArrayLength
Definition: vtkDataSetSurfaceFilter.h:234
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkDataSetSurfaceFilter::QuadHashLength
vtkIdType QuadHashLength
Definition: vtkDataSetSurfaceFilter.h:213
vtkDataSetSurfaceFilter::QuadHashTraversal
vtkFastGeomQuad * QuadHashTraversal
Definition: vtkDataSetSurfaceFilter.h:214
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:215
vtkDataSetSurfaceFilter::OriginalCellIds
vtkIdTypeArray * OriginalCellIds
Definition: vtkDataSetSurfaceFilter.h:246
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:217
vtkDataSetSurfaceFilter::PassThroughCellIds
vtkTypeBool PassThroughCellIds
Definition: vtkDataSetSurfaceFilter.h:243
vtkPolyDataAlgorithm.h
vtkDataSetSurfaceFilter
Extracts outer (polygonal) surface.
Definition: vtkDataSetSurfaceFilter.h:49
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkDataSetSurfaceFilter::OriginalCellIdsName
char * OriginalCellIdsName
Definition: vtkDataSetSurfaceFilter.h:247
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:252
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkDataSetSurfaceFilter::NumberOfFastGeomQuadArrays
vtkIdType NumberOfFastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:235
vtkDataSetSurfaceFilter::PieceInvariant
int PieceInvariant
Definition: vtkDataSetSurfaceFilter.h:241
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:73
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkDataSetSurfaceFilter::NumberOfNewCells
vtkIdType NumberOfNewCells
Definition: vtkDataSetSurfaceFilter.h:227
vtkDataSetSurfaceFilter::NextQuadIndex
vtkIdType NextQuadIndex
Definition: vtkDataSetSurfaceFilter.h:239
vtkDataSetSurfaceFilter::OriginalPointIds
vtkIdTypeArray * OriginalPointIds
Definition: vtkDataSetSurfaceFilter.h:251
vtkDataSetSurfaceFilter::GetOriginalPointIdsName
virtual const char * GetOriginalPointIdsName()
Definition: vtkDataSetSurfaceFilter.h:107
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkDataSetSurfaceFilter::EdgeMap
vtkEdgeInterpolationMap * EdgeMap
Definition: vtkDataSetSurfaceFilter.h:221
vtkFastGeomQuadStruct
Definition: vtkDataSetSurfaceFilter.h:40
vtkDataSetSurfaceFilter::UseStrips
vtkTypeBool UseStrips
Definition: vtkDataSetSurfaceFilter.h:174
vtkDataSetSurfaceFilter::QuadHash
vtkFastGeomQuad ** QuadHash
Definition: vtkDataSetSurfaceFilter.h:212
vtkDataSetSurfaceFilter::PassThroughPointIds
vtkTypeBool PassThroughPointIds
Definition: vtkDataSetSurfaceFilter.h:249
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkDataSetSurfaceFilter::NonlinearSubdivisionLevel
int NonlinearSubdivisionLevel
Definition: vtkDataSetSurfaceFilter.h:254
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41