VTK
vtkSimpleCellTessellator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSimpleCellTessellator.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 =========================================================================*/
45 #ifndef vtkSimpleCellTessellator_h
46 #define vtkSimpleCellTessellator_h
47 
48 #include "vtkCommonDataModelModule.h" // For export macro
50 
51 class vtkTriangleTile;
52 class vtkTetraTile;
53 class vtkCellArray;
54 class vtkDoubleArray;
60 class vtkPointData;
62 class vtkPolygon;
63 class vtkIdList;
64 
65 //-----------------------------------------------------------------------------
66 //
67 // The tessellation object
68 class VTKCOMMONDATAMODEL_EXPORT vtkSimpleCellTessellator : public vtkGenericCellTessellator
69 {
70 public:
71  static vtkSimpleCellTessellator *New();
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
79  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
81 
99  vtkCellArray *cellArray,
100  vtkPointData *internalPd) override;
101 
115  vtkCellArray *cellArray,
116  vtkPointData *internalPd ) override;
117 
131  vtkCellArray *cellArray,
132  vtkPointData *internalPd) override;
133 
137  void Reset();
138 
139 
143  void Initialize(vtkGenericDataSet *ds) override;
144 
158  int GetFixedSubdivisions();
159 
168  int GetMaxSubdivisionLevel();
169 
174  int GetMaxAdaptiveSubdivisions();
175 
182  void SetFixedSubdivisions(int level);
183 
190  void SetMaxSubdivisionLevel(int level);
191 
201  void SetSubdivisionLevels(int fixed,
202  int maxLevel);
203 
204 
205 protected:
207  ~vtkSimpleCellTessellator() override;
208 
213  void CopyPoint(vtkIdType pointId);
214 
219 
220  void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
221  void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
222  void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
223 
224  void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
225  void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
226 
243  void InitTetraTile(vtkTetraTile &root,
244  vtkIdType *localIds,
245  vtkIdType *ids,
246  int *edgeIds,
247  int *faceIds);
248 
264  void TriangulateTriangle(vtkGenericAdaptorCell *cell,
265  vtkIdType *localIds,
266  vtkIdType *ids,
267  int *edgeIds,
270  vtkCellArray *cellArray,
271  vtkPointData *internalPd);
272 
277 
282  void AllocateScalars(int size);
283 
290  // Scalar buffer that stores the global coordinates, parametric coordinates,
291  // attributes at left, mid and right point. The format is:
292  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
293  // rxryrz rrrsrt [rarb rcrdre...]
294  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
295 
296  double *Scalars;
298 
304 
309 
314 
316 
319  vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
323 
324  int FindEdgeReferenceCount(double p1[3], double p2[3],
325  vtkIdType &e1, vtkIdType &e2);
326 
327  int GetNumberOfCellsUsingFace( int faceId );
328  int GetNumberOfCellsUsingEdge( int edgeId );
329 
338  int IsEdgeOnFace(double p1[3], double p2[3]);
339 
348  int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
349 
359  int FindEdgeParent(double p1[3], double p2[3], int &localId);
360 
365  void AllocatePointIds(int size);
366 
372  int FacesAreEqual(int *originalFace,
373  int face[3]);
374 
379 
383 
388  int *EdgeIds;
393  int *FaceIds;
394 
395  // The following variables are for complex cells.
396 
397  // Used to create tetra from more complex cells, because the tessellator
398  // is supposed to deal with simplices only.
400 
401  // Used to store the sub-tetra during the tessellation of complex
402  // cells.
404 
405  // Used to create triangles from a face of a complex cell.
407 
408  // Used to store the sub-triangles during the tessellation of complex cells.
410 
413 
414 private:
416  void operator=(const vtkSimpleCellTessellator&) = delete;
417 
418  friend class vtkTetraTile;
419  friend class vtkTriangleTile;
420 
421 };
422 
423 #endif
vtkOrderedTriangulator * Triangulator
int * EdgeIds
For each edge (6) of the sub-tetra, there is the id of the original edge or -1 if the edge is not an ...
double * Scalars
Scalar buffer used to save the interpolate values of the attributes The capacity is at least the numb...
represent and manipulate point attribute data
Definition: vtkPointData.h:31
helper class to perform cell tessellation
vtkGenericCellIterator * CellIterator
Used to iterate over edges boundaries in GetNumberOfCellsUsingEdges()
virtual void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a face of a 3D ‘cell’.
vtkGenericAdaptorCell * GenericCell
To access the higher order cell from third party library.
helper class to perform cell tessellation
keep track of edges (defined by pair of integer id's)
vtkGenericEdgeTable * EdgeTable
HashTable instead of vtkPointLocator.
vtkCellArray * TessellateCellArray
To avoid New/Delete.
helper class to generate triangulations
int vtkIdType
Definition: vtkType.h:345
vtkGenericAttributeCollection * AttributeCollection
To access the higher order field from third party library.
virtual void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Triangulate a 2D ‘cell’.
dynamic, self-adjusting array of double
iterator used to traverse cells
vtkIdType NumberOfPoints
Number of points in the dataset to be tessellated.
vtkDoubleArray * TessellatePoints
To avoid New/Delete.
defines cell interface
vtkPointData * TessellatePointData
To avoid New/Delete.
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a 3D ‘cell’.
list of point or cell ids
Definition: vtkIdList.h:30
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
virtual void Initialize(vtkGenericDataSet *ds)=0
Initialize the tessellator with a data set ‘ds’.
Objects that compute error during cell tessellation.
object to represent cell connectivity
Definition: vtkCellArray.h:44
int PointOffset
Number of double value to skip to go to the next point into Scalars array It is 6+attributeCollection...
int * FaceIds
For each face (4) of the sub-tetra, there is the id of the original face or -1 if the face is not an ...
defines dataset interface
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.