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 =========================================================================*/
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) VTK_OVERRIDE;
74 
76 
79  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
81 
99  vtkCellArray *cellArray,
100  vtkPointData *internalPd) VTK_OVERRIDE;
101 
115  vtkCellArray *cellArray,
116  vtkPointData *internalPd ) VTK_OVERRIDE;
117 
131  vtkCellArray *cellArray,
132  vtkPointData *internalPd) VTK_OVERRIDE;
133 
137  void Reset();
138 
139 
143  void Initialize(vtkGenericDataSet *ds) VTK_OVERRIDE;
144 
158  int GetFixedSubdivisions();
159 
168  int GetMaxSubdivisionLevel();
169 
174  int GetMaxAdaptiveSubdivisions();
175 
182  void SetFixedSubdivisions(int level);
183 
190  void SetMaxSubdivisionLevel(int level);
191 
201  void SetSubdivisionLevels(int fixed,
202  int maxLevel);
203 
204 
205 protected:
207  ~vtkSimpleCellTessellator() VTK_OVERRIDE;
208 
213  void CopyPoint(vtkIdType pointId);
214 
219 
220  void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
221  void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
222  void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
223 
224  void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
225  void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
226 
243  void InitTetraTile(vtkTetraTile &root,
244  vtkIdType *localIds,
245  vtkIdType *ids,
246  int *edgeIds,
247  int *faceIds);
248 
264  void TriangulateTriangle(vtkGenericAdaptorCell *cell,
265  vtkIdType *localIds,
266  vtkIdType *ids,
267  int *edgeIds,
270  vtkCellArray *cellArray,
271  vtkPointData *internalPd);
272 
276  vtkGenericAdaptorCell *GenericCell;
277 
282  void AllocateScalars(int size);
283 
290  // Scalar buffer that stores the global coordinates, parametric coordinates,
291  // attributes at left, mid and right point. The format is:
292  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
293  // rxryrz rrrsrt [rarb rcrdre...]
294  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
295 
296  double *Scalars;
297  int ScalarsCapacity;
298 
303  int PointOffset;
304 
308  vtkGenericCellIterator *CellIterator;
309 
313  vtkGenericAttributeCollection *AttributeCollection;
314 
316 
319  vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
320  vtkCellArray *TessellateCellArray;
321  vtkPointData *TessellatePointData;
323 
324  int FindEdgeReferenceCount(double p1[3], double p2[3],
325  vtkIdType &e1, vtkIdType &e2);
326 
327  int GetNumberOfCellsUsingFace( int faceId );
328  int GetNumberOfCellsUsingEdge( int edgeId );
329 
338  int IsEdgeOnFace(double p1[3], double p2[3]);
339 
348  int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
349 
359  int FindEdgeParent(double p1[3], double p2[3], int &localId);
360 
365  void AllocatePointIds(int size);
366 
372  int FacesAreEqual(int *originalFace,
373  int face[3]);
374 
379 
383  vtkIdType NumberOfPoints;
384 
385  int FixedSubdivisions;
386  int MaxSubdivisionLevel;
387  int CurrentSubdivisionLevel;
388 
393  int *EdgeIds;
398  int *FaceIds;
399 
400  // The following variables are for complex cells.
401 
402  // Used to create tetra from more complex cells, because the tessellator
403  // is supposed to deal with simplices only.
404  vtkOrderedTriangulator *Triangulator;
405 
406  // Used to store the sub-tetra during the tessellation of complex
407  // cells.
408  vtkCellArray *Connectivity;
409 
410  // Used to create triangles from a face of a complex cell.
411  vtkPolygon *Polygon;
412 
413  // Used to store the sub-triangles during the tessellation of complex cells.
414  vtkIdList *TriangleIds;
415 
416  vtkIdType *PointIds;
417  int PointIdsCapacity;
418 
419 private:
420  vtkSimpleCellTessellator(const vtkSimpleCellTessellator&) VTK_DELETE_FUNCTION;
421  void operator=(const vtkSimpleCellTessellator&) VTK_DELETE_FUNCTION;
422 
423  friend class vtkTetraTile;
424  friend class vtkTriangleTile;
425 
426 };
427 
428 #endif
represent and manipulate point attribute data
Definition: vtkPointData.h:31
helper class to perform cell tessellation
virtual void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a face of a 3D `cell'.
helper class to perform cell tessellation
keep track of edges (defined by pair of integer id's)
helper class to generate triangulations
int vtkIdType
Definition: vtkType.h:345
virtual void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Triangulate a 2D `cell'.
dynamic, self-adjusting array of double
iterator used to traverse cells
defines cell interface
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
Tessellate a 3D `cell'.
list of point or cell ids
Definition: vtkIdList.h:30
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
virtual void Initialize(vtkGenericDataSet *ds)=0
Initialize the tessellator with a data set `ds'.
Objects that compute error during cell tessellation.
object to represent cell connectivity
Definition: vtkCellArray.h:44
defines dataset interface
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.