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 
51 
52 class vtkTriangleTile;
53 class vtkTetraTile;
54 class vtkCellArray;
55 class vtkDoubleArray;
61 class vtkPointData;
63 class vtkPolygon;
64 class vtkIdList;
65 
66 //-----------------------------------------------------------------------------
67 //
68 // The tessellation object
70 {
71 public:
72  static vtkSimpleCellTessellator *New();
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
77 
78  vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
80 
82 
93  vtkCellArray *cellArray,
94  vtkPointData *internalPd);
96 
98 
107  vtkCellArray *cellArray,
108  vtkPointData *internalPd );
110 
112 
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,
231  vtkCellArray *cellArray,
232  vtkPointData *internalPd);
234 
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 
261 
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 
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