VTK  9.2.6
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:
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
82  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
84 
100  vtkPointData* internalPd) override;
101 
113  vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
114 
126  vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
127 
131  void Reset();
132 
136  void Initialize(vtkGenericDataSet* ds) override;
137 
152 
162 
168 
176 
184 
194  void SetSubdivisionLevels(int fixed, int maxLevel);
195 
196 protected:
199 
204  void CopyPoint(vtkIdType pointId);
205 
210 
211  void InsertEdgesIntoEdgeTable(vtkTriangleTile& tri);
212  void RemoveEdgesFromEdgeTable(vtkTriangleTile& tri);
213  void InsertPointsIntoEdgeTable(vtkTriangleTile& tri);
214 
215  void InsertEdgesIntoEdgeTable(vtkTetraTile& tetra);
216  void RemoveEdgesFromEdgeTable(vtkTetraTile& tetra);
217 
235  vtkTetraTile& root, const vtkIdType* localIds, vtkIdType* ids, int* edgeIds, int* faceIds);
236 
257  vtkCellArray* cellArray, vtkPointData* internalPd);
258 
263 
269 
276  // Scalar buffer that stores the global coordinates, parametric coordinates,
277  // attributes at left, mid and right point. The format is:
278  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
279  // rxryrz rrrsrt [rarb rcrdre...]
280  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
281 
282  double* Scalars;
284 
290 
295 
300 
302 
305  vtkDoubleArray* TessellatePoints; // Allow to use GetPointer
309 
310  int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType& e1, vtkIdType& e2);
311 
312  int GetNumberOfCellsUsingFace(int faceId);
313  int GetNumberOfCellsUsingEdge(int edgeId);
314 
323  int IsEdgeOnFace(double p1[3], double p2[3]);
324 
333  int FindEdgeParent2D(double p1[3], double p2[3], int& localId);
334 
344  int FindEdgeParent(double p1[3], double p2[3], int& localId);
345 
351 
360  int FacesAreEqual(const vtkIdType* originalFace, const vtkIdType face[3]);
361 
366 
370 
381 
382  // The following variables are for complex cells.
383 
384  // Used to create tetra from more complex cells, because the tessellator
385  // is supposed to deal with simplices only.
387 
388  // Used to store the sub-tetra during the tessellation of complex
389  // cells.
391 
392  // Used to create triangles from a face of a complex cell.
394 
395  // Used to store the sub-triangles during the tessellation of complex cells.
397 
400 
401 private:
403  void operator=(const vtkSimpleCellTessellator&) = delete;
404 
405  friend class vtkTetraTile;
406  friend class vtkTriangleTile;
407 };
408 
409 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
dynamic, self-adjusting array of double
defines cell interface
iterator used to traverse cells
helper class to perform cell tessellation
defines dataset interface
keep track of edges (defined by pair of integer id's)
Objects that compute error during cell tessellation.
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
helper class to generate triangulations
represent and manipulate point attribute data
Definition: vtkPointData.h:151
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:152
helper class to perform cell tessellation
void TriangulateTriangle(vtkGenericAdaptorCell *cell, vtkIdType *localIds, vtkIdType *ids, const vtkIdType *edgeIds, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)
Triangulate a triangle of ‘cell’.
void InsertPointsIntoEdgeTable(vtkTriangleTile &tri)
int GetNumberOfCellsUsingFace(int faceId)
void SetSubdivisionLevels(int fixed, int maxLevel)
Set both the number of fixed subdivisions and the maximum level of subdivisions.
static vtkSimpleCellTessellator * New()
void RemoveEdgesFromEdgeTable(vtkTriangleTile &tri)
vtkGenericCellIterator * CellIterator
Used to iterate over edges boundaries in GetNumberOfCellsUsingEdges()
~vtkSimpleCellTessellator() override
double * Scalars
Scalar buffer used to save the interpolate values of the attributes The capacity is at least the numb...
int PointOffset
Number of double value to skip to go to the next point into Scalars array It is 6+attributeCollection...
void SetFixedSubdivisions(int level)
Set the number of fixed subdivisions.
vtkCellArray * TessellateCellArray
To avoid New/Delete.
int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType &e1, vtkIdType &e2)
vtkGenericAttributeCollection * AttributeCollection
To access the higher order field from third party library.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AllocatePointIds(int size)
Allocate some memory if PointIds does not exist or is smaller than size.
void AllocateScalars(int size)
Allocate some memory if Scalars does not exists or is smaller than size.
void Initialize(vtkGenericDataSet *ds) override
Initialize the tessellator with a data set ‘ds’.
const vtkIdType * 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 ...
void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Triangulate a 2D ‘cell’.
int GetMaxAdaptiveSubdivisions()
Return the maximum number of adaptive subdivisions.
const vtkIdType * 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 ...
vtkDoubleArray * TessellatePoints
To avoid New/Delete.
void InsertEdgesIntoEdgeTable(vtkTetraTile &tetra)
int FacesAreEqual(const vtkIdType *originalFace, const vtkIdType face[3])
Are the faces ‘originalFace’ and ‘face’ equal? The result is independent from any order or orientatio...
void Reset()
Reset the output for repeated use of this class.
void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a face of a 3D ‘cell’.
void InitTetraTile(vtkTetraTile &root, const vtkIdType *localIds, vtkIdType *ids, int *edgeIds, int *faceIds)
Initialize ‘root’ with the sub-tetra defined by the ‘localIds’ points on the complex cell,...
void CopyPoint(vtkIdType pointId)
Extract point ‘pointId’ from the edge table to the output point and output point data.
vtkGenericEdgeTable * EdgeTable
HashTable instead of vtkPointLocator.
int FindEdgeParent2D(double p1[3], double p2[3], int &localId)
Return 1 if the parent of edge defined by vertices (‘p1’,‘p2’) in parametric coordinates,...
vtkOrderedTriangulator * Triangulator
void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a 3D ‘cell’.
int GetNumberOfCellsUsingEdge(int edgeId)
int GetMaxSubdivisionLevel()
Return the maximum level of subdivision.
vtkPointData * TessellatePointData
To avoid New/Delete.
void RemoveEdgesFromEdgeTable(vtkTetraTile &tetra)
int GetFixedSubdivisions()
Return the number of fixed subdivisions.
vtkGenericAdaptorCell * GenericCell
To access the higher order cell from third party library.
void InsertEdgesIntoEdgeTable(vtkTriangleTile &tri)
int IsEdgeOnFace(double p1[3], double p2[3])
Is the edge defined by vertices (‘p1’,‘p2’) in parametric coordinates on some edge of the original te...
int FindEdgeParent(double p1[3], double p2[3], int &localId)
Return 1 if the parent of edge defined by vertices (‘p1’,‘p2’) in parametric coordinates,...
vtkIdType NumberOfPoints
Number of points in the dataset to be tessellated.
void SetMaxSubdivisionLevel(int level)
Set the maximum level of subdivision.
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401
@ size
Definition: vtkX3D.h:259
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:332