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 =========================================================================*/
85 #ifndef vtkOrderedTriangulator_h
86 #define vtkOrderedTriangulator_h
87 
88 #include "vtkCommonDataModelModule.h" // For export macro
89 #include "vtkObject.h"
90 
92 class vtkCellArray;
93 class vtkHeap;
94 class vtkIdList;
95 class vtkPoints;
96 class vtkTetra;
97 class vtkDataArray;
98 class vtkDoubleArray;
99 struct vtkOTMesh;
100 struct vtkOTTemplates;
102 class vtkPointData;
103 class vtkCellData;
104 
105 // Template ID's must be 32-bits. See .cxx file for more information.
106 #if VTK_SIZEOF_SHORT == 4
107 typedef unsigned short TemplateIDType;
108 #elif VTK_SIZEOF_INT == 4
109 typedef unsigned int TemplateIDType;
110 #elif VTK_SIZEOF_LONG == 4
111 typedef unsigned long TemplateIDType;
112 #endif
113 
114 class VTKCOMMONDATAMODEL_EXPORT vtkOrderedTriangulator : public vtkObject
115 {
116 public:
118  void PrintSelf(ostream& os, vtkIndent indent) override;
119 
123  static vtkOrderedTriangulator *New();
124 
126 
134  void InitTriangulation(double xmin, double xmax, double ymin, double ymax,
135  double zmin, double zmax, int numPts);
136  void InitTriangulation(double bounds[6], int numPts);
138 
140 
154  vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type);
155  vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3],
156  double p[3], int type);
157  vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, vtkIdType sortid2,
158  double x[3], double p[3], int type);
160 
162 
167  void Triangulate();
168  void TemplateTriangulate(int cellType, int numPts, int numEdges);
170 
179  void UpdatePointType(vtkIdType internalId, int type);
180 
187  double *GetPointPosition(vtkIdType internalId);
188 
195  double *GetPointLocation(vtkIdType internalId);
196 
204  vtkIdType GetPointId(vtkIdType internalId);
205 
207 
210  vtkGetMacro(NumberOfPoints,int);
212 
214 
221  vtkSetMacro(UseTemplates,vtkTypeBool);
222  vtkGetMacro(UseTemplates,vtkTypeBool);
223  vtkBooleanMacro(UseTemplates,vtkTypeBool);
225 
227 
233  vtkSetMacro(PreSorted,vtkTypeBool);
234  vtkGetMacro(PreSorted,vtkTypeBool);
235  vtkBooleanMacro(PreSorted,vtkTypeBool);
237 
239 
243  vtkSetMacro(UseTwoSortIds,vtkTypeBool);
244  vtkGetMacro(UseTwoSortIds,vtkTypeBool);
245  vtkBooleanMacro(UseTwoSortIds,vtkTypeBool);
247 
259  vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid);
260 
271  vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid);
272 
280  vtkIdType AddTetras(int classification, vtkCellArray *connectivity);
281 
293  vtkIdType AddTetras(int classification,
295  vtkCellArray *outConnectivity,
296  vtkPointData *inPD,
297  vtkPointData *outPD,
298  vtkCellData *inCD,
299  vtkIdType cellId,
300  vtkCellData *outCD);
301 
307  vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts);
308 
313  vtkIdType AddTriangles(vtkCellArray *connectivity);
314 
320  vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity);
321 
326  void InitTetraTraversal();
327 
339  int GetNextTetra(int classification, vtkTetra *tet,
340  vtkDataArray *cellScalars, vtkDoubleArray *tetScalars);
341 
342 protected:
344  ~vtkOrderedTriangulator() override;
345 
346 private:
347  void Initialize();
348 
349  vtkOTMesh *Mesh;
350  int NumberOfPoints; //number of points inserted
351  int MaximumNumberOfPoints; //maximum possible number of points to be inserted
352  double Bounds[6];
353  vtkTypeBool PreSorted;
354  vtkTypeBool UseTwoSortIds;
355  vtkHeap *Heap;
356 
357  vtkTypeBool UseTemplates;
358  int CellType;
359  int NumberOfCellPoints;
360  int NumberOfCellEdges;
361  vtkHeap *TemplateHeap;
362  vtkOTTemplates *Templates;
363  int TemplateTriangulation();
364  void AddTemplate();
365  TemplateIDType ComputeTemplateIndex();
366 
367 private:
369  void operator=(const vtkOrderedTriangulator&) = delete;
370 };
371 
372 #endif
373 
374 
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkX3D::type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:114
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:51
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHeap
replacement for malloc/free and new/delete
Definition: vtkHeap.h:53
vtkObject.h
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkTetra
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:41
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69