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
54class vtkTriangleTile;
55class vtkTetraTile;
56class vtkCellArray;
57class vtkDoubleArray;
63class vtkPointData;
65class vtkPolygon;
66class vtkIdList;
67
68//-----------------------------------------------------------------------------
69//
70// The tessellation object
71class VTKCOMMONDATAMODEL_EXPORT vtkSimpleCellTessellator : public vtkGenericCellTessellator
72{
73public:
76 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
77
79
82 vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
84
102 vtkCellArray *cellArray,
103 vtkPointData *internalPd) VTK_OVERRIDE;
104
118 vtkCellArray *cellArray,
119 vtkPointData *internalPd ) VTK_OVERRIDE;
120
134 vtkCellArray *cellArray,
135 vtkPointData *internalPd) VTK_OVERRIDE;
136
140 void Reset();
141
142
146 void Initialize(vtkGenericDataSet *ds) VTK_OVERRIDE;
147
162
172
178
186
194
204 void SetSubdivisionLevels(int fixed,
205 int maxLevel);
206
207
208protected:
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;
300 int ScalarsCapacity;
301
306 int PointOffset;
307
312
316 vtkGenericAttributeCollection *AttributeCollection;
317
319
322 vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
323 vtkCellArray *TessellateCellArray;
324 vtkPointData *TessellatePointData;
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 vtkIdType NumberOfPoints;
387
388 int FixedSubdivisions;
389 int MaxSubdivisionLevel;
390 int CurrentSubdivisionLevel;
391
396 int *EdgeIds;
401 int *FaceIds;
402
403 // The following variables are for complex cells.
404
405 // Used to create tetra from more complex cells, because the tessellator
406 // is supposed to deal with simplices only.
408
409 // Used to store the sub-tetra during the tessellation of complex
410 // cells.
411 vtkCellArray *Connectivity;
412
413 // Used to create triangles from a face of a complex cell.
414 vtkPolygon *Polygon;
415
416 // Used to store the sub-triangles during the tessellation of complex cells.
417 vtkIdList *TriangleIds;
418
419 vtkIdType *PointIds;
420 int PointIdsCapacity;
421
422private:
423 vtkSimpleCellTessellator(const vtkSimpleCellTessellator&) VTK_DELETE_FUNCTION;
424 void operator=(const vtkSimpleCellTessellator&) VTK_DELETE_FUNCTION;
425
426 friend class vtkTetraTile;
427 friend class vtkTriangleTile;
428
429};
430
431#endif
object to represent cell connectivity
Definition: vtkCellArray.h:51
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:37
a simple class to control print indentation
Definition: vtkIndent.h:40
helper class to generate triangulations
represent and manipulate point attribute data
Definition: vtkPointData.h:38
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:46
helper class to perform cell tessellation
void SetSubdivisionLevels(int fixed, int maxLevel)
Set both the number of fixed subdivisions and the maximum level of subdivisions.
~vtkSimpleCellTessellator() override
void SetFixedSubdivisions(int level)
Set the number of fixed subdivisions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize(vtkGenericDataSet *ds) override
Initialize the tessellator with a data set ‘ds’.
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.
static vtkSimpleCellTessellator * New()
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 Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd) override
Tessellate a 3D ‘cell’.
int GetMaxSubdivisionLevel()
Return the maximum level of subdivision.
int GetFixedSubdivisions()
Return the number of fixed subdivisions.
void SetMaxSubdivisionLevel(int level)
Set the maximum level of subdivision.
@ points
Definition: vtkX3D.h:446
@ level
Definition: vtkX3D.h:395
@ size
Definition: vtkX3D.h:253
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:287