VTK: Common/DataModel/vtkSimpleCellTessellator.h Source File

| VTK 9.3.1

vtkSimpleCellTessellator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
36 #ifndef vtkSimpleCellTessellator_h
37 #define vtkSimpleCellTessellator_h
38
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkGenericCellTessellator.h"
41
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkTriangleTile;
44 class vtkTetraTile;
45 class vtkCellArray;
46 class vtkDoubleArray;
47 class vtkGenericEdgeTable;
48 class vtkGenericSubdivisionErrorMetric;
49 class vtkGenericAttributeCollection;
50 class vtkGenericAdaptorCell;
51 class vtkGenericCellIterator;
52 class vtkPointData;
53 class vtkOrderedTriangulator;
54 class vtkPolygon;
55 class vtkIdList;
56
57 //-----------------------------------------------------------------------------
58 //
59 // The tessellation object
60 class VTKCOMMONDATAMODEL_EXPORT vtkSimpleCellTessellator : public vtkGenericCellTessellator
61 {
62 public:
63 static vtkSimpleCellTessellator* New();
64 vtkTypeMacro(vtkSimpleCellTessellator, vtkGenericCellTessellator);
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
71 vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
73
87 void TessellateFace(vtkGenericAdaptorCell* cell, vtkGenericAttributeCollection* att,
88 vtkIdType index, vtkDoubleArray* points, vtkCellArray* cellArray,
89 vtkPointData* internalPd) override;
90
101 void Tessellate(vtkGenericAdaptorCell* cell, vtkGenericAttributeCollection* att,
102 vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
103
114 void Triangulate(vtkGenericAdaptorCell* cell, vtkGenericAttributeCollection* att,
115 vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd) override;
116
120 void Reset();
121
125 void Initialize(vtkGenericDataSet* ds) override;
126
140 int GetFixedSubdivisions();
141
150 int GetMaxSubdivisionLevel();
151
156 int GetMaxAdaptiveSubdivisions();
157
164 void SetFixedSubdivisions(int level);
165
172 void SetMaxSubdivisionLevel(int level);
173
183 void SetSubdivisionLevels(int fixed, int maxLevel);
184
185 protected:
186 vtkSimpleCellTessellator();
187 ~vtkSimpleCellTessellator() override;
188
193 void CopyPoint(vtkIdType pointId);
194
198 vtkGenericEdgeTable* EdgeTable;
199
200 void InsertEdgesIntoEdgeTable(vtkTriangleTile& tri);
201 void RemoveEdgesFromEdgeTable(vtkTriangleTile& tri);
202 void InsertPointsIntoEdgeTable(vtkTriangleTile& tri);
203
204 void InsertEdgesIntoEdgeTable(vtkTetraTile& tetra);
205 void RemoveEdgesFromEdgeTable(vtkTetraTile& tetra);
206
223 void InitTetraTile(
224 vtkTetraTile& root, const vtkIdType* localIds, vtkIdType* ids, int* edgeIds, int* faceIds);
225
244 void TriangulateTriangle(vtkGenericAdaptorCell* cell, vtkIdType* localIds, vtkIdType* ids,
245 const vtkIdType* edgeIds, vtkGenericAttributeCollection* att, vtkDoubleArray* points,
246 vtkCellArray* cellArray, vtkPointData* internalPd);
247
251 vtkGenericAdaptorCell* GenericCell;
252
257 void AllocateScalars(int size);
258
265 // Scalar buffer that stores the global coordinates, parametric coordinates,
266 // attributes at left, mid and right point. The format is:
267 // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
268 // rxryrz rrrsrt [rarb rcrdre...]
269 // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
270
271 double* Scalars;
272 int ScalarsCapacity;
273
278 int PointOffset;
279
283 vtkGenericCellIterator* CellIterator;
284
288 vtkGenericAttributeCollection* AttributeCollection;
289
291
294 vtkDoubleArray* TessellatePoints; // Allow to use GetPointer
295 vtkCellArray* TessellateCellArray;
296 vtkPointData* TessellatePointData;
298
299 int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType& e1, vtkIdType& e2);
300
301 int GetNumberOfCellsUsingFace(int faceId);
302 int GetNumberOfCellsUsingEdge(int edgeId);
303
312 int IsEdgeOnFace(double p1[3], double p2[3]);
313
322 int FindEdgeParent2D(double p1[3], double p2[3], int& localId);
323
333 int FindEdgeParent(double p1[3], double p2[3], int& localId);
334
339 void AllocatePointIds(int size);
340
349 int FacesAreEqual(const vtkIdType* originalFace, const vtkIdType face[3]);
350
354 vtkIdType NumberOfPoints;
355
356 int FixedSubdivisions;
357 int MaxSubdivisionLevel;
358 int CurrentSubdivisionLevel;
359
364 const vtkIdType* EdgeIds;
369 const vtkIdType* FaceIds;
370
371 // The following variables are for complex cells.
372
373 // Used to create tetra from more complex cells, because the tessellator
374 // is supposed to deal with simplices only.
375 vtkOrderedTriangulator* Triangulator;
376
377 // Used to store the sub-tetra during the tessellation of complex
378 // cells.
379 vtkCellArray* Connectivity;
380
381 // Used to create triangles from a face of a complex cell.
382 vtkPolygon* Polygon;
383
384 // Used to store the sub-triangles during the tessellation of complex cells.
385 vtkIdList* TriangleIds;
386
387 vtkIdType* PointIds;
388 int PointIdsCapacity;
389
390 private:
391 vtkSimpleCellTessellator(const vtkSimpleCellTessellator&) = delete;
392 void operator=(const vtkSimpleCellTessellator&) = delete;
393
394 friend class vtkTetraTile;
395 friend class vtkTriangleTile;
396 };
397
398 VTK_ABI_NAMESPACE_END
399 #endif
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:40
vtkGenericAdaptorCell
defines cell interface
Definition: vtkGenericAdaptorCell.h:84
vtkGenericAttributeCollection
a collection of attributes
Definition: vtkGenericAttributeCollection.h:26
vtkGenericCellIterator
iterator used to traverse cells
Definition: vtkGenericCellIterator.h:34
vtkGenericCellTessellator
helper class to perform cell tessellation
Definition: vtkGenericCellTessellator.h:48
vtkGenericDataSet
defines dataset interface
Definition: vtkGenericDataSet.h:59
vtkGenericEdgeTable
keep track of edges (defined by pair of integer id's)
Definition: vtkGenericEdgeTable.h:29
vtkGenericSubdivisionErrorMetric
Objects that compute error during cell tessellation.
Definition: vtkGenericSubdivisionErrorMetric.h:38
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:107
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:39
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:41
vtkSimpleCellTessellator
helper class to perform cell tessellation
Definition: vtkSimpleCellTessellator.h:61
vtkSimpleCellTessellator::TriangulateTriangle
void TriangulateTriangle(vtkGenericAdaptorCell *cell, vtkIdType *localIds, vtkIdType *ids, const vtkIdType *edgeIds, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)
Triangulate a triangle of ‘cell’.
vtkSimpleCellTessellator::InsertPointsIntoEdgeTable
void InsertPointsIntoEdgeTable(vtkTriangleTile &tri)
vtkSimpleCellTessellator::Polygon
vtkPolygon * Polygon
Definition: vtkSimpleCellTessellator.h:382
vtkSimpleCellTessellator::GetNumberOfCellsUsingFace
int GetNumberOfCellsUsingFace(int faceId)
vtkSimpleCellTessellator::SetSubdivisionLevels
void SetSubdivisionLevels(int fixed, int maxLevel)
Set both the number of fixed subdivisions and the maximum level of subdivisions.
vtkSimpleCellTessellator::New
static vtkSimpleCellTessellator * New()
vtkSimpleCellTessellator::RemoveEdgesFromEdgeTable
void RemoveEdgesFromEdgeTable(vtkTriangleTile &tri)
vtkSimpleCellTessellator::CellIterator
vtkGenericCellIterator * CellIterator
Used to iterate over edges boundaries in GetNumberOfCellsUsingEdges()
Definition: vtkSimpleCellTessellator.h:283
vtkSimpleCellTessellator::~vtkSimpleCellTessellator
~vtkSimpleCellTessellator() override
vtkSimpleCellTessellator::Connectivity
vtkCellArray * Connectivity
Definition: vtkSimpleCellTessellator.h:379
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:271
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:278
vtkSimpleCellTessellator::SetFixedSubdivisions
void SetFixedSubdivisions(int level)
Set the number of fixed subdivisions.
vtkSimpleCellTessellator::TessellateCellArray
vtkCellArray * TessellateCellArray
To avoid New/Delete.
Definition: vtkSimpleCellTessellator.h:295
vtkSimpleCellTessellator::FindEdgeReferenceCount
int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType &e1, vtkIdType &e2)
vtkSimpleCellTessellator::AttributeCollection
vtkGenericAttributeCollection * AttributeCollection
To access the higher order field from third party library.
Definition: vtkSimpleCellTessellator.h:288
vtkSimpleCellTessellator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSimpleCellTessellator::AllocatePointIds
void AllocatePointIds(int size)
Allocate some memory if PointIds does not exist or is smaller than size.
vtkSimpleCellTessellator::AllocateScalars
void AllocateScalars(int size)
Allocate some memory if Scalars does not exists or is smaller than size.
vtkSimpleCellTessellator::PointIdsCapacity
int PointIdsCapacity
Definition: vtkSimpleCellTessellator.h:388
vtkSimpleCellTessellator::Initialize
void Initialize(vtkGenericDataSet *ds) override
Initialize the tessellator with a data set ‘ds’.
vtkSimpleCellTessellator::FixedSubdivisions
int FixedSubdivisions
Definition: vtkSimpleCellTessellator.h:356
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:369
vtkSimpleCellTessellator::Triangulate
void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Triangulate a 2D ‘cell’.
vtkSimpleCellTessellator::GetMaxAdaptiveSubdivisions
int GetMaxAdaptiveSubdivisions()
Return the maximum number of adaptive subdivisions.
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:364
vtkSimpleCellTessellator::CurrentSubdivisionLevel
int CurrentSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:358
vtkSimpleCellTessellator::TessellatePoints
vtkDoubleArray * TessellatePoints
To avoid New/Delete.
Definition: vtkSimpleCellTessellator.h:294
vtkSimpleCellTessellator::InsertEdgesIntoEdgeTable
void InsertEdgesIntoEdgeTable(vtkTetraTile &tetra)
vtkSimpleCellTessellator::vtkSimpleCellTessellator
vtkSimpleCellTessellator()
vtkSimpleCellTessellator::FacesAreEqual
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...
vtkSimpleCellTessellator::Reset
void Reset()
Reset the output for repeated use of this class.
vtkSimpleCellTessellator::MaxSubdivisionLevel
int MaxSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:357
vtkSimpleCellTessellator::TessellateFace
void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a face of a 3D ‘cell’.
vtkSimpleCellTessellator::InitTetraTile
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,...
vtkSimpleCellTessellator::CopyPoint
void CopyPoint(vtkIdType pointId)
Extract point ‘pointId’ from the edge table to the output point and output point data.
vtkSimpleCellTessellator::EdgeTable
vtkGenericEdgeTable * EdgeTable
HashTable instead of vtkPointLocator.
Definition: vtkSimpleCellTessellator.h:198
vtkSimpleCellTessellator::FindEdgeParent2D
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,...
vtkSimpleCellTessellator::Triangulator
vtkOrderedTriangulator * Triangulator
Definition: vtkSimpleCellTessellator.h:375
vtkSimpleCellTessellator::Tessellate
void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a 3D ‘cell’.
vtkSimpleCellTessellator::GetNumberOfCellsUsingEdge
int GetNumberOfCellsUsingEdge(int edgeId)
vtkSimpleCellTessellator::GetMaxSubdivisionLevel
int GetMaxSubdivisionLevel()
Return the maximum level of subdivision.
vtkSimpleCellTessellator::ScalarsCapacity
int ScalarsCapacity
Definition: vtkSimpleCellTessellator.h:272
vtkSimpleCellTessellator::TriangleIds
vtkIdList * TriangleIds
Definition: vtkSimpleCellTessellator.h:385
vtkSimpleCellTessellator::TessellatePointData
vtkPointData * TessellatePointData
To avoid New/Delete.
Definition: vtkSimpleCellTessellator.h:296
vtkSimpleCellTessellator::PointIds
vtkIdType * PointIds
Definition: vtkSimpleCellTessellator.h:387
vtkSimpleCellTessellator::RemoveEdgesFromEdgeTable
void RemoveEdgesFromEdgeTable(vtkTetraTile &tetra)
vtkSimpleCellTessellator::GetFixedSubdivisions
int GetFixedSubdivisions()
Return the number of fixed subdivisions.
vtkSimpleCellTessellator::GenericCell
vtkGenericAdaptorCell * GenericCell
To access the higher order cell from third party library.
Definition: vtkSimpleCellTessellator.h:251
vtkSimpleCellTessellator::InsertEdgesIntoEdgeTable
void InsertEdgesIntoEdgeTable(vtkTriangleTile &tri)
vtkSimpleCellTessellator::IsEdgeOnFace
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...
vtkSimpleCellTessellator::FindEdgeParent
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,...
vtkSimpleCellTessellator::NumberOfPoints
vtkIdType NumberOfPoints
Number of points in the dataset to be tessellated.
Definition: vtkSimpleCellTessellator.h:354
vtkSimpleCellTessellator::SetMaxSubdivisionLevel
void SetMaxSubdivisionLevel(int level)
Set the maximum level of subdivision.
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkGenericCellTessellator.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315