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 =========================================================================*/
48 #ifndef vtkSimpleCellTessellator_h
49 #define vtkSimpleCellTessellator_h
50 
51 #include "vtkCommonDataModelModule.h" // For export macro
53 
54 class vtkTriangleTile;
55 class vtkTetraTile;
56 class vtkCellArray;
57 class vtkDoubleArray;
63 class vtkPointData;
65 class vtkPolygon;
66 class vtkIdList;
67 
68 //-----------------------------------------------------------------------------
69 //
70 // The tessellation object
71 class VTKCOMMONDATAMODEL_EXPORT vtkSimpleCellTessellator : public vtkGenericCellTessellator
72 {
73 public:
74  static vtkSimpleCellTessellator *New();
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
82  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
84 
102  vtkCellArray *cellArray,
103  vtkPointData *internalPd) override;
104 
118  vtkCellArray *cellArray,
119  vtkPointData *internalPd ) override;
120 
134  vtkCellArray *cellArray,
135  vtkPointData *internalPd) override;
136 
140  void Reset();
141 
142 
146  void Initialize(vtkGenericDataSet *ds) override;
147 
161  int GetFixedSubdivisions();
162 
171  int GetMaxSubdivisionLevel();
172 
177  int GetMaxAdaptiveSubdivisions();
178 
185  void SetFixedSubdivisions(int level);
186 
193  void SetMaxSubdivisionLevel(int level);
194 
204  void SetSubdivisionLevels(int fixed,
205  int maxLevel);
206 
207 
208 protected:
210  ~vtkSimpleCellTessellator() override;
211 
216  void CopyPoint(vtkIdType pointId);
217 
222 
223  void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
224  void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
225  void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
226 
227  void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
228  void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
229 
246  void InitTetraTile(vtkTetraTile &root,
247  vtkIdType *localIds,
248  vtkIdType *ids,
249  int *edgeIds,
250  int *faceIds);
251 
267  void TriangulateTriangle(vtkGenericAdaptorCell *cell,
268  vtkIdType *localIds,
269  vtkIdType *ids,
270  int *edgeIds,
273  vtkCellArray *cellArray,
274  vtkPointData *internalPd);
275 
280 
285  void AllocateScalars(int size);
286 
293  // Scalar buffer that stores the global coordinates, parametric coordinates,
294  // attributes at left, mid and right point. The format is:
295  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
296  // rxryrz rrrsrt [rarb rcrdre...]
297  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
298 
299  double *Scalars;
301 
307 
312 
317 
319 
322  vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
326 
327  int FindEdgeReferenceCount(double p1[3], double p2[3],
328  vtkIdType &e1, vtkIdType &e2);
329 
330  int GetNumberOfCellsUsingFace( int faceId );
331  int GetNumberOfCellsUsingEdge( int edgeId );
332 
341  int IsEdgeOnFace(double p1[3], double p2[3]);
342 
351  int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
352 
362  int FindEdgeParent(double p1[3], double p2[3], int &localId);
363 
368  void AllocatePointIds(int size);
369 
375  int FacesAreEqual(int *originalFace,
376  int face[3]);
377 
382 
386 
391  int *EdgeIds;
396  int *FaceIds;
397 
398  // The following variables are for complex cells.
399 
400  // Used to create tetra from more complex cells, because the tessellator
401  // is supposed to deal with simplices only.
403 
404  // Used to store the sub-tetra during the tessellation of complex
405  // cells.
407 
408  // Used to create triangles from a face of a complex cell.
410 
411  // Used to store the sub-triangles during the tessellation of complex cells.
413 
416 
417 private:
419  void operator=(const vtkSimpleCellTessellator&) = delete;
420 
421  friend class vtkTetraTile;
422  friend class vtkTriangleTile;
423 
424 };
425 
426 #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:37
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:347
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:39
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:36
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:45
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:50
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.