VTK  9.0.1
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 
97  vtkPointData* internalPd) override;
98 
110  vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
111 
123  vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
124 
128  void Reset();
129 
133  void Initialize(vtkGenericDataSet* ds) override;
134 
148  int GetFixedSubdivisions();
149 
158  int GetMaxSubdivisionLevel();
159 
164  int GetMaxAdaptiveSubdivisions();
165 
172  void SetFixedSubdivisions(int level);
173 
180  void SetMaxSubdivisionLevel(int level);
181 
191  void SetSubdivisionLevels(int fixed, int maxLevel);
192 
193 protected:
195  ~vtkSimpleCellTessellator() override;
196 
201  void CopyPoint(vtkIdType pointId);
202 
207 
208  void InsertEdgesIntoEdgeTable(vtkTriangleTile& tri);
209  void RemoveEdgesFromEdgeTable(vtkTriangleTile& tri);
210  void InsertPointsIntoEdgeTable(vtkTriangleTile& tri);
211 
212  void InsertEdgesIntoEdgeTable(vtkTetraTile& tetra);
213  void RemoveEdgesFromEdgeTable(vtkTetraTile& tetra);
214 
231  void InitTetraTile(
232  vtkTetraTile& root, const vtkIdType* localIds, vtkIdType* ids, int* edgeIds, int* faceIds);
233 
252  void TriangulateTriangle(vtkGenericAdaptorCell* cell, vtkIdType* localIds, vtkIdType* ids,
254  vtkCellArray* cellArray, vtkPointData* internalPd);
255 
260 
265  void AllocateScalars(int size);
266 
273  // Scalar buffer that stores the global coordinates, parametric coordinates,
274  // attributes at left, mid and right point. The format is:
275  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
276  // rxryrz rrrsrt [rarb rcrdre...]
277  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
278 
279  double* Scalars;
281 
287 
292 
297 
299 
302  vtkDoubleArray* TessellatePoints; // Allow to use GetPointer
306 
307  int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType& e1, vtkIdType& e2);
308 
309  int GetNumberOfCellsUsingFace(int faceId);
310  int GetNumberOfCellsUsingEdge(int edgeId);
311 
320  int IsEdgeOnFace(double p1[3], double p2[3]);
321 
330  int FindEdgeParent2D(double p1[3], double p2[3], int& localId);
331 
341  int FindEdgeParent(double p1[3], double p2[3], int& localId);
342 
347  void AllocatePointIds(int size);
348 
357  int FacesAreEqual(const vtkIdType* originalFace, const vtkIdType face[3]);
358 
363 
367 
378 
379  // The following variables are for complex cells.
380 
381  // Used to create tetra from more complex cells, because the tessellator
382  // is supposed to deal with simplices only.
384 
385  // Used to store the sub-tetra during the tessellation of complex
386  // cells.
388 
389  // Used to create triangles from a face of a complex cell.
391 
392  // Used to store the sub-triangles during the tessellation of complex cells.
394 
397 
398 private:
400  void operator=(const vtkSimpleCellTessellator&) = delete;
401 
402  friend class vtkTetraTile;
403  friend class vtkTriangleTile;
404 };
405 
406 #endif
vtkGenericCellTessellator::Triangulate
virtual void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Triangulate a 2D ‘cell’.
vtkSimpleCellTessellator::TessellateCellArray
vtkCellArray * TessellateCellArray
Definition: vtkSimpleCellTessellator.h:303
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkGenericCellTessellator::Initialize
virtual void Initialize(vtkGenericDataSet *ds)=0
Initialize the tessellator with a data set ‘ds’.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkGenericCellTessellator.h
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkGenericCellTessellator::Tessellate
virtual void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a 3D ‘cell’.
vtkSimpleCellTessellator::TessellatePoints
vtkDoubleArray * TessellatePoints
To avoid New/Delete.
Definition: vtkSimpleCellTessellator.h:302
vtkSimpleCellTessellator::CurrentSubdivisionLevel
int CurrentSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:366
vtkGenericAdaptorCell
defines cell interface
Definition: vtkGenericAdaptorCell.h:91
vtkSimpleCellTessellator::Scalars
double * Scalars
Scalar buffer used to save the interpolate values of the attributes The capacity is at least the numb...
Definition: vtkSimpleCellTessellator.h:279
vtkGenericCellIterator
iterator used to traverse cells
Definition: vtkGenericCellIterator.h:41
vtkSimpleCellTessellator::TriangleIds
vtkIdList * TriangleIds
Definition: vtkSimpleCellTessellator.h:393
vtkGenericSubdivisionErrorMetric
Objects that compute error during cell tessellation.
Definition: vtkGenericSubdivisionErrorMetric.h:48
vtkSimpleCellTessellator::CellIterator
vtkGenericCellIterator * CellIterator
Used to iterate over edges boundaries in GetNumberOfCellsUsingEdges()
Definition: vtkSimpleCellTessellator.h:291
vtkSimpleCellTessellator
helper class to perform cell tessellation
Definition: vtkSimpleCellTessellator.h:68
vtkGenericDataSet
defines dataset interface
Definition: vtkGenericDataSet.h:69
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:114
vtkSimpleCellTessellator::GenericCell
vtkGenericAdaptorCell * GenericCell
To access the higher order cell from third party library.
Definition: vtkSimpleCellTessellator.h:259
vtkSimpleCellTessellator::FixedSubdivisions
int FixedSubdivisions
Definition: vtkSimpleCellTessellator.h:364
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkGenericCellTessellator
helper class to perform cell tessellation
Definition: vtkGenericCellTessellator.h:58
vtkGenericCellTessellator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSimpleCellTessellator::AttributeCollection
vtkGenericAttributeCollection * AttributeCollection
To access the higher order field from third party library.
Definition: vtkSimpleCellTessellator.h:296
vtkSimpleCellTessellator::PointOffset
int PointOffset
Number of double value to skip to go to the next point into Scalars array It is 6+attributeCollection...
Definition: vtkSimpleCellTessellator.h:286
vtkSimpleCellTessellator::Triangulator
vtkOrderedTriangulator * Triangulator
Definition: vtkSimpleCellTessellator.h:383
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSimpleCellTessellator::NumberOfPoints
vtkIdType NumberOfPoints
Number of points in the dataset to be tessellated.
Definition: vtkSimpleCellTessellator.h:362
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:179
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkGenericCellTessellator::TessellateFace
virtual void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a face of a 3D ‘cell’.
vtkSimpleCellTessellator::EdgeTable
vtkGenericEdgeTable * EdgeTable
HashTable instead of vtkPointLocator.
Definition: vtkSimpleCellTessellator.h:206
vtkGenericEdgeTable
keep track of edges (defined by pair of integer id's)
Definition: vtkGenericEdgeTable.h:39
vtkSimpleCellTessellator::PointIdsCapacity
int PointIdsCapacity
Definition: vtkSimpleCellTessellator.h:396
vtkSimpleCellTessellator::FaceIds
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 ...
Definition: vtkSimpleCellTessellator.h:377
vtkSimpleCellTessellator::Polygon
vtkPolygon * Polygon
Definition: vtkSimpleCellTessellator.h:390
vtkSimpleCellTessellator::MaxSubdivisionLevel
int MaxSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:365
vtkGenericAttributeCollection
a collection of attributes
Definition: vtkGenericAttributeCollection.h:33
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkSimpleCellTessellator::EdgeIds
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 ...
Definition: vtkSimpleCellTessellator.h:372
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkSimpleCellTessellator::PointIds
vtkIdType * PointIds
Definition: vtkSimpleCellTessellator.h:395
vtkSimpleCellTessellator::TessellatePointData
vtkPointData * TessellatePointData
Definition: vtkSimpleCellTessellator.h:304
vtkSimpleCellTessellator::Connectivity
vtkCellArray * Connectivity
Definition: vtkSimpleCellTessellator.h:387
vtkSimpleCellTessellator::ScalarsCapacity
int ScalarsCapacity
Definition: vtkSimpleCellTessellator.h:280