VTK
vtkOrderedTriangulator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOrderedTriangulator.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 =========================================================================*/
88 #ifndef vtkOrderedTriangulator_h
89 #define vtkOrderedTriangulator_h
90 
91 #include "vtkCommonDataModelModule.h" // For export macro
92 #include "vtkObject.h"
93 
95 class vtkCellArray;
96 class vtkHeap;
97 class vtkIdList;
98 class vtkPoints;
99 class vtkTetra;
100 class vtkDataArray;
101 class vtkDoubleArray;
102 struct vtkOTMesh;
103 struct vtkOTTemplates;
105 class vtkPointData;
106 class vtkCellData;
107 
108 // Template ID's must be 32-bits. See .cxx file for more information.
109 #if VTK_SIZEOF_SHORT == 4
110 typedef unsigned short TemplateIDType;
111 #elif VTK_SIZEOF_INT == 4
112 typedef unsigned int TemplateIDType;
113 #elif VTK_SIZEOF_LONG == 4
114 typedef unsigned long TemplateIDType;
115 #endif
116 
117 class VTKCOMMONDATAMODEL_EXPORT vtkOrderedTriangulator : public vtkObject
118 {
119 public:
121  void PrintSelf(ostream& os, vtkIndent indent) override;
122 
126  static vtkOrderedTriangulator *New();
127 
129 
137  void InitTriangulation(double xmin, double xmax, double ymin, double ymax,
138  double zmin, double zmax, int numPts);
139  void InitTriangulation(double bounds[6], int numPts);
141 
143 
157  vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type);
158  vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3],
159  double p[3], int type);
160  vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, vtkIdType sortid2,
161  double x[3], double p[3], int type);
163 
165 
170  void Triangulate();
171  void TemplateTriangulate(int cellType, int numPts, int numEdges);
173 
182  void UpdatePointType(vtkIdType internalId, int type);
183 
190  double *GetPointPosition(vtkIdType internalId);
191 
198  double *GetPointLocation(vtkIdType internalId);
199 
207  vtkIdType GetPointId(vtkIdType internalId);
208 
210 
213  vtkGetMacro(NumberOfPoints,int);
215 
217 
224  vtkSetMacro(UseTemplates,vtkTypeBool);
225  vtkGetMacro(UseTemplates,vtkTypeBool);
226  vtkBooleanMacro(UseTemplates,vtkTypeBool);
228 
230 
236  vtkSetMacro(PreSorted,vtkTypeBool);
237  vtkGetMacro(PreSorted,vtkTypeBool);
238  vtkBooleanMacro(PreSorted,vtkTypeBool);
240 
242 
246  vtkSetMacro(UseTwoSortIds,vtkTypeBool);
247  vtkGetMacro(UseTwoSortIds,vtkTypeBool);
248  vtkBooleanMacro(UseTwoSortIds,vtkTypeBool);
250 
262  vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid);
263 
274  vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid);
275 
283  vtkIdType AddTetras(int classification, vtkCellArray *connectivity);
284 
296  vtkIdType AddTetras(int classification,
298  vtkCellArray *outConnectivity,
299  vtkPointData *inPD,
300  vtkPointData *outPD,
301  vtkCellData *inCD,
302  vtkIdType cellId,
303  vtkCellData *outCD);
304 
310  vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts);
311 
316  vtkIdType AddTriangles(vtkCellArray *connectivity);
317 
323  vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity);
324 
329  void InitTetraTraversal();
330 
342  int GetNextTetra(int classification, vtkTetra *tet,
343  vtkDataArray *cellScalars, vtkDoubleArray *tetScalars);
344 
345 protected:
347  ~vtkOrderedTriangulator() override;
348 
349 private:
350  void Initialize();
351 
352  vtkOTMesh *Mesh;
353  int NumberOfPoints; //number of points inserted
354  int MaximumNumberOfPoints; //maximum possible number of points to be inserted
355  double Bounds[6];
356  vtkTypeBool PreSorted;
357  vtkTypeBool UseTwoSortIds;
358  vtkHeap *Heap;
359 
360  vtkTypeBool UseTemplates;
361  int CellType;
362  int NumberOfCellPoints;
363  int NumberOfCellEdges;
364  vtkHeap *TemplateHeap;
365  vtkOTTemplates *Templates;
366  int TemplateTriangulation();
367  void AddTemplate();
368  TemplateIDType ComputeTemplateIndex();
369 
370 private:
372  void operator=(const vtkOrderedTriangulator&) = delete;
373 };
374 
375 #endif
376 
377 
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate point attribute data
Definition: vtkPointData.h:37
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
Abstract class in support of both point location and point insertion.
helper class to generate triangulations
int vtkIdType
Definition: vtkType.h:347
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:69
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:47
a simple class to control print indentation
Definition: vtkIndent.h:39
list of point or cell ids
Definition: vtkIdList.h:36
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
object to represent cell connectivity
Definition: vtkCellArray.h:50
replacement for malloc/free and new/delete
Definition: vtkHeap.h:53
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:39