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 "vtkCommonDataModelModule.h" // For export macro
52 
53 class vtkTriangleTile;
54 class vtkTetraTile;
55 class vtkCellArray;
56 class vtkDoubleArray;
62 class vtkPointData;
64 class vtkPolygon;
65 class vtkIdList;
66 
67 //-----------------------------------------------------------------------------
68 //
69 // The tessellation object
71 {
72 public:
73  static vtkSimpleCellTessellator *New();
75  void PrintSelf(ostream& os, vtkIndent indent);
76 
78 
79  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
81 
83 
94  vtkCellArray *cellArray,
95  vtkPointData *internalPd);
97 
99 
108  vtkCellArray *cellArray,
109  vtkPointData *internalPd );
111 
113 
122  vtkCellArray *cellArray,
123  vtkPointData *internalPd);
125 
127  void Reset();
128 
129 
131  void Initialize(vtkGenericDataSet *ds);
132 
142  int GetFixedSubdivisions();
143 
150  int GetMaxSubdivisionLevel();
151 
154  int GetMaxAdaptiveSubdivisions();
155 
160  void SetFixedSubdivisions(int level);
161 
166  void SetMaxSubdivisionLevel(int level);
167 
169 
175  void SetSubdivisionLevels(int fixed,
176  int maxLevel);
178 
179 
180 protected:
183 
186  void CopyPoint(vtkIdType pointId);
187 
190 
191  void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
192  void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
193  void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
194 
195  void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
196  void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
197 
199 
209  void InitTetraTile(vtkTetraTile &root,
210  vtkIdType *localIds,
211  vtkIdType *ids,
212  int *edgeIds,
213  int *faceIds);
215 
217 
226  void TriangulateTriangle(vtkGenericAdaptorCell *cell,
227  vtkIdType *localIds,
228  vtkIdType *ids,
229  int *edgeIds,
232  vtkCellArray *cellArray,
233  vtkPointData *internalPd);
235 
238 
241  void AllocateScalars(int size);
242 
247  // Scalar buffer that stores the global coordinates, parametric coordinates,
248  // attributes at left, mid and right point. The format is:
249  // lxlylz lrlslt [lalb lcldle...] mxmymz mrmsmt [mamb mcmdme...]
250  // rxryrz rrrsrt [rarb rcrdre...]
251  // The ScalarsCapacity>=(6+attributeCollection->GetNumberOfComponents())*3
252 
253  double *Scalars;
255 
259 
262 
265 
267 
268  vtkDoubleArray *TessellatePoints; //Allow to use GetPointer
272 
273  int FindEdgeReferenceCount(double p1[3], double p2[3],
274  vtkIdType &e1, vtkIdType &e2);
275 
276  int GetNumberOfCellsUsingFace( int faceId );
277  int GetNumberOfCellsUsingEdge( int edgeId );
278 
284  int IsEdgeOnFace(double p1[3], double p2[3]);
285 
291  int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
292 
299  int FindEdgeParent(double p1[3], double p2[3], int &localId);
300 
303  void AllocatePointIds(int size);
304 
306 
309  int FacesAreEqual(int *originalFace,
310  int face[3]);
312 
315 
318 
322 
325  int *EdgeIds;
328  int *FaceIds;
329 
330  // The following variables are for complex cells.
331 
332  // Used to create tetra from more complex cells, because the tessellator
333  // is supposed to deal with simplices only.
335 
336  // Used to store the sub-tetra during the tessellation of complex
337  // cells.
339 
340  // Used to create triangles from a face of a complex cell.
342 
343  // Used to store the sub-triangles during the tessellation of complex cells.
345 
348 
349 private:
350  vtkSimpleCellTessellator(const vtkSimpleCellTessellator&); // Not implemented.
351  void operator=(const vtkSimpleCellTessellator&); // Not implemented.
352 
353  //BTX
354  friend class vtkTetraTile;
355  friend class vtkTriangleTile;
356  //ETX
357 };
358 
359 #endif
vtkOrderedTriangulator * Triangulator
represent and manipulate point attribute data
Definition: vtkPointData.h:36
helper class to perform cell tessellation
vtkGenericCellIterator * CellIterator
virtual void TessellateFace(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkIdType index, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
vtkGenericAdaptorCell * GenericCell
helper class to perform cell tessellation
keep track of edges (defined by pair of integer id's)
helper class to generate triangulations
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:247
vtkGenericAttributeCollection * AttributeCollection
virtual void Triangulate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
dynamic, self-adjusting array of double
iterator used to traverse cells
defines cell interface
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void Tessellate(vtkGenericAdaptorCell *cell, vtkGenericAttributeCollection *att, vtkDoubleArray *points, vtkCellArray *cellArray, vtkPointData *internalPd)=0
list of point or cell ids
Definition: vtkIdList.h:35
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:44
virtual void Initialize(vtkGenericDataSet *ds)=0
Objects that compute error during cell tessellation.
object to represent cell connectivity
Definition: vtkCellArray.h:49
defines dataset interface
static vtkObject * New()
#define VTKCOMMONDATAMODEL_EXPORT