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:
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 
162 
172 
178 
186 
194 
204  void SetSubdivisionLevels(int fixed,
205  int maxLevel);
206 
207 
208 protected:
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 
268  vtkIdType *localIds,
269  vtkIdType *ids,
270  int *edgeIds,
273  vtkCellArray *cellArray,
274  vtkPointData *internalPd);
275 
280 
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 
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
vtkSimpleCellTessellator::RemoveEdgesFromEdgeTable
void RemoveEdgesFromEdgeTable(vtkTetraTile &tetra)
vtkSimpleCellTessellator::InsertPointsIntoEdgeTable
void InsertPointsIntoEdgeTable(vtkTriangleTile &tri)
vtkSimpleCellTessellator::TessellateCellArray
vtkCellArray * TessellateCellArray
Definition: vtkSimpleCellTessellator.h:323
vtkSimpleCellTessellator::GetMaxSubdivisionLevel
int GetMaxSubdivisionLevel()
Return the maximum level of subdivision.
vtkSimpleCellTessellator::Tessellate
void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a 3D ‘cell’.
vtkSimpleCellTessellator::New
static vtkSimpleCellTessellator * New()
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:38
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkGenericCellTessellator.h
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:46
vtkSimpleCellTessellator::SetSubdivisionLevels
void SetSubdivisionLevels(int fixed, int maxLevel)
Set both the number of fixed subdivisions and the maximum level of subdivisions.
vtkSimpleCellTessellator::InsertEdgesIntoEdgeTable
void InsertEdgesIntoEdgeTable(vtkTetraTile &tetra)
vtkSimpleCellTessellator::AllocateScalars
void AllocateScalars(int size)
Allocate some memory if Scalars does not exists or is smaller than size.
vtkSimpleCellTessellator::TessellatePoints
vtkDoubleArray * TessellatePoints
To avoid New/Delete.
Definition: vtkSimpleCellTessellator.h:322
vtkSimpleCellTessellator::CurrentSubdivisionLevel
int CurrentSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:385
vtkSimpleCellTessellator::RemoveEdgesFromEdgeTable
void RemoveEdgesFromEdgeTable(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...
vtkGenericAdaptorCell
defines cell interface
Definition: vtkGenericAdaptorCell.h:96
vtkSimpleCellTessellator::GetMaxAdaptiveSubdivisions
int GetMaxAdaptiveSubdivisions()
Return the maximum number of adaptive subdivisions.
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:299
vtkGenericCellIterator
iterator used to traverse cells
Definition: vtkGenericCellIterator.h:45
vtkSimpleCellTessellator::TriangleIds
vtkIdList * TriangleIds
Definition: vtkSimpleCellTessellator.h:412
vtkSimpleCellTessellator::GetNumberOfCellsUsingEdge
int GetNumberOfCellsUsingEdge(int edgeId)
vtkGenericSubdivisionErrorMetric
Objects that compute error during cell tessellation.
Definition: vtkGenericSubdivisionErrorMetric.h:49
vtkSimpleCellTessellator::CellIterator
vtkGenericCellIterator * CellIterator
Used to iterate over edges boundaries in GetNumberOfCellsUsingEdges()
Definition: vtkSimpleCellTessellator.h:311
vtkSimpleCellTessellator
helper class to perform cell tessellation
Definition: vtkSimpleCellTessellator.h:72
vtkGenericDataSet
defines dataset interface
Definition: vtkGenericDataSet.h:70
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:118
vtkSimpleCellTessellator::GenericCell
vtkGenericAdaptorCell * GenericCell
To access the higher order cell from third party library.
Definition: vtkSimpleCellTessellator.h:279
vtkSimpleCellTessellator::AllocatePointIds
void AllocatePointIds(int size)
Allocate some memory if PointIds does not exist or is smaller than size.
vtkSimpleCellTessellator::Triangulate
void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Triangulate a 2D ‘cell’.
vtkSimpleCellTessellator::FixedSubdivisions
int FixedSubdivisions
Definition: vtkSimpleCellTessellator.h:383
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkSimpleCellTessellator::Reset
void Reset()
Reset the output for repeated use of this class.
vtkSimpleCellTessellator::~vtkSimpleCellTessellator
~vtkSimpleCellTessellator() override
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkGenericCellTessellator
helper class to perform cell tessellation
Definition: vtkGenericCellTessellator.h:59
vtkSimpleCellTessellator::SetFixedSubdivisions
void SetFixedSubdivisions(int level)
Set the number of fixed subdivisions.
vtkSimpleCellTessellator::Initialize
void Initialize(vtkGenericDataSet *ds) override
Initialize the tessellator with a data set ‘ds’.
vtkSimpleCellTessellator::FacesAreEqual
int FacesAreEqual(int *originalFace, int face[3])
Are the faces ‘originalFace’ and ‘face’ equal? The result is independent from any order or orientatio...
vtkSimpleCellTessellator::AttributeCollection
vtkGenericAttributeCollection * AttributeCollection
To access the higher order field from third party library.
Definition: vtkSimpleCellTessellator.h:316
vtkSimpleCellTessellator::InitTetraTile
void InitTetraTile(vtkTetraTile &root, vtkIdType *localIds, vtkIdType *ids, int *edgeIds, int *faceIds)
Initialize ‘root’ with the sub-tetra defined by the ‘localIds’ points on the complex cell,...
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:306
vtkSimpleCellTessellator::Triangulator
vtkOrderedTriangulator * Triangulator
Definition: vtkSimpleCellTessellator.h:402
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSimpleCellTessellator::NumberOfPoints
vtkIdType NumberOfPoints
Number of points in the dataset to be tessellated.
Definition: vtkSimpleCellTessellator.h:381
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:51
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkSimpleCellTessellator::GetNumberOfCellsUsingFace
int GetNumberOfCellsUsingFace(int faceId)
vtkSimpleCellTessellator::EdgeTable
vtkGenericEdgeTable * EdgeTable
HashTable instead of vtkPointLocator.
Definition: vtkSimpleCellTessellator.h:221
vtkGenericEdgeTable
keep track of edges (defined by pair of integer id's)
Definition: vtkGenericEdgeTable.h:40
vtkSimpleCellTessellator::CopyPoint
void CopyPoint(vtkIdType pointId)
Extract point ‘pointId’ from the edge table to the output point and output point data.
vtkSimpleCellTessellator::PointIdsCapacity
int PointIdsCapacity
Definition: vtkSimpleCellTessellator.h:415
vtkSimpleCellTessellator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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::TriangulateTriangle
void TriangulateTriangle(vtkGenericAdaptorCell *cell, vtkIdType *localIds, vtkIdType *ids, int *edgeIds, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)
Triangulate a triangle of ‘cell’.
vtkSimpleCellTessellator::GetFixedSubdivisions
int GetFixedSubdivisions()
Return the number of fixed subdivisions.
vtkSimpleCellTessellator::vtkSimpleCellTessellator
vtkSimpleCellTessellator()
vtkSimpleCellTessellator::Polygon
vtkPolygon * Polygon
Definition: vtkSimpleCellTessellator.h:409
vtkSimpleCellTessellator::MaxSubdivisionLevel
int MaxSubdivisionLevel
Definition: vtkSimpleCellTessellator.h:384
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::SetMaxSubdivisionLevel
void SetMaxSubdivisionLevel(int level)
Set the maximum level of subdivision.
vtkSimpleCellTessellator::FindEdgeReferenceCount
int FindEdgeReferenceCount(double p1[3], double p2[3], vtkIdType &e1, vtkIdType &e2)
vtkGenericAttributeCollection
a collection of attributes
Definition: vtkGenericAttributeCollection.h:37
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
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::InsertEdgesIntoEdgeTable
void InsertEdgesIntoEdgeTable(vtkTriangleTile &tri)
vtkSimpleCellTessellator::EdgeIds
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 ...
Definition: vtkSimpleCellTessellator.h:391
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkSimpleCellTessellator::PointIds
vtkIdType * PointIds
Definition: vtkSimpleCellTessellator.h:414
vtkSimpleCellTessellator::TessellatePointData
vtkPointData * TessellatePointData
Definition: vtkSimpleCellTessellator.h:324
vtkSimpleCellTessellator::Connectivity
vtkCellArray * Connectivity
Definition: vtkSimpleCellTessellator.h:406
vtkSimpleCellTessellator::ScalarsCapacity
int ScalarsCapacity
Definition: vtkSimpleCellTessellator.h:300
vtkSimpleCellTessellator::FaceIds
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 ...
Definition: vtkSimpleCellTessellator.h:396