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 =========================================================================*/
47 #ifndef __vtkSimpleCellTessellator_h
48 #define __vtkSimpleCellTessellator_h
49 
50 #include "vtkGenericCellTessellator.h"
51 
52 class vtkTriangleTile;
53 class vtkTetraTile;
54 class vtkCellArray;
55 class vtkDoubleArray;
57 class vtkGenericSubdivisionErrorMetric;
58 class vtkGenericAttributeCollection;
59 class vtkGenericAdaptorCell;
60 class vtkGenericCellIterator;
61 class vtkPointData;
63 class vtkPolygon;
64 class vtkIdList;
65 
66 //-----------------------------------------------------------------------------
67 //
68 // The tessellation object
69 class VTK_FILTERING_EXPORT vtkSimpleCellTessellator : public vtkGenericCellTessellator
70 {
71 public:
72  static vtkSimpleCellTessellator *New();
73  vtkTypeMacro(vtkSimpleCellTessellator,vtkGenericCellTessellator);
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
77 
78  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
80 
82 
89  void TessellateFace(vtkGenericAdaptorCell *cell,
90  vtkGenericAttributeCollection *att,
91  vtkIdType index,
92  vtkDoubleArray *points,
93  vtkCellArray *cellArray,
94  vtkPointData *internalPd);
96 
98 
104  void Tessellate(vtkGenericAdaptorCell *cell,
105  vtkGenericAttributeCollection *att,
106  vtkDoubleArray *points,
107  vtkCellArray *cellArray,
108  vtkPointData *internalPd );
110 
112 
118  void Triangulate(vtkGenericAdaptorCell *cell,
119  vtkGenericAttributeCollection *att,
120  vtkDoubleArray *points,
121  vtkCellArray *cellArray,
122  vtkPointData *internalPd);
124 
126  void Reset();
127 
128 
130  void Initialize(vtkGenericDataSet *ds);
131 
141  int GetFixedSubdivisions();
142 
149  int GetMaxSubdivisionLevel();
150 
153  int GetMaxAdaptiveSubdivisions();
154 
159  void SetFixedSubdivisions(int level);
160 
165  void SetMaxSubdivisionLevel(int level);
166 
168 
174  void SetSubdivisionLevels(int fixed,
175  int maxLevel);
177 
178 
179 protected:
182 
185  void CopyPoint(vtkIdType pointId);
186 
189 
190  void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
191  void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
192  void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
193 
194  void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
195  void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
196 
198 
208  void InitTetraTile(vtkTetraTile &root,
209  vtkIdType *localIds,
210  vtkIdType *ids,
211  int *edgeIds,
212  int *faceIds);
214 
216 
225  void TriangulateTriangle(vtkGenericAdaptorCell *cell,
226  vtkIdType *localIds,
227  vtkIdType *ids,
228  int *edgeIds,
229  vtkGenericAttributeCollection *att,
230  vtkDoubleArray *points,
231  vtkCellArray *cellArray,
232  vtkPointData *internalPd);
234 
236  vtkGenericAdaptorCell *GenericCell;
237 
240  void AllocateScalars(int size);
241 
246  // Scalar buffer that stores the global coordinates, parametric coordinates,
247  // attributes at left, mid and right point. The format is:
248  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
249  // rxryrz rrrsrt [rarb rcrdre...]
250  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
251 
252  double *Scalars;
254 
258 
260  vtkGenericCellIterator *CellIterator;
261 
263  vtkGenericAttributeCollection *AttributeCollection;
264 
266 
267  vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
271 
272  int FindEdgeReferenceCount(double p1[3], double p2[3],
273  vtkIdType &e1, vtkIdType &e2);
274 
275  int GetNumberOfCellsUsingFace( int faceId );
276  int GetNumberOfCellsUsingEdge( int edgeId );
277 
283  int IsEdgeOnFace(double p1[3], double p2[3]);
284 
290  int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
291 
298  int FindEdgeParent(double p1[3], double p2[3], int &localId);
299 
302  void AllocatePointIds(int size);
303 
305 
308  int FacesAreEqual(int *originalFace,
309  int face[3]);
311 
313  vtkGenericDataSet *DataSet;
314 
317 
321 
323 
325  int *EdgeIds;
326  // Description:
327  // For each face (4) of the sub-tetra, there is the id of the original face
328  // or -1 if the face is not an original face
329  int *FaceIds;
331 
332  // The following variables are for complex cells.
333 
334  // Used to create tetra from more complex cells, because the tessellator
335  // is supposed to deal with simplices only.
337 
338  // Used to store the sub-tetra during the tessellation of complex
339  // cells.
341 
342  // Used to create triangles from a face of a complex cell.
344 
345  // Used to store the sub-triangles during the tessellation of complex cells.
347 
350 
351 private:
352  vtkSimpleCellTessellator(const vtkSimpleCellTessellator&); // Not implemented.
353  void operator=(const vtkSimpleCellTessellator&); // Not implemented.
354 
355  //BTX
356  friend class vtkTetraTile;
357  friend class vtkTriangleTile;
358  //ETX
359 };
360 
361 #endif
vtkOrderedTriangulator * Triangulator
represent and manipulate point attribute data
Definition: vtkPointData.h:35
vtkGenericCellIterator * CellIterator
#define VTK_FILTERING_EXPORT
vtkGenericAdaptorCell * GenericCell
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:255
vtkGenericAttributeCollection * AttributeCollection
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:43
object to represent cell connectivity
Definition: vtkCellArray.h:48