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 
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);
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 
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 
317 
324 
330 
342  int GetNextTetra(int classification, vtkTetra *tet,
343  vtkDataArray *cellScalars, vtkDoubleArray *tetScalars);
344 
345 protected:
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 
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkOrderedTriangulator::InitTriangulation
void InitTriangulation(double bounds[6], int numPts)
vtkOrderedTriangulator::AddTetras
vtkIdType AddTetras(int classification, vtkCellArray *connectivity)
Add the tetrahedra classified (0=inside,1=outside) to the connectivity list provided.
vtkOrderedTriangulator::vtkOrderedTriangulator
vtkOrderedTriangulator()
vtkOrderedTriangulator::GetNextTetra
int GetNextTetra(int classification, vtkTetra *tet, vtkDataArray *cellScalars, vtkDoubleArray *tetScalars)
Methods to get one tetra at a time.
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:38
vtkOrderedTriangulator::GetPointPosition
double * GetPointPosition(vtkIdType internalId)
Return the parametric coordinates of point ‘internalId’.
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkOrderedTriangulator::Triangulate
void Triangulate()
Perform the triangulation.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkOrderedTriangulator::AddTriangles
vtkIdType AddTriangles(vtkCellArray *connectivity)
Add the triangle faces classified (2=boundary) to the connectivity list provided.
vtkOrderedTriangulator::GetTetras
vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid)
Initialize and add the tetras and points from the triangulation to the unstructured grid provided.
vtkOrderedTriangulator::~vtkOrderedTriangulator
~vtkOrderedTriangulator() override
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkOrderedTriangulator::GetPointId
vtkIdType GetPointId(vtkIdType internalId)
Return the Id of point ‘internalId’.
vtkOrderedTriangulator::AddTetras
vtkIdType AddTetras(int classification, vtkIncrementalPointLocator *locator, vtkCellArray *outConnectivity, vtkPointData *inPD, vtkPointData *outPD, vtkCellData *inCD, vtkIdType cellId, vtkCellData *outCD)
Assuming that all the inserted points come from a cell ‘cellId’ to triangulate, get the tetrahedra in...
vtkOrderedTriangulator::InitTetraTraversal
void InitTetraTraversal()
Methods to get one tetra at a time.
vtkOrderedTriangulator::InsertPoint
vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, vtkIdType sortid2, double x[3], double p[3], int type)
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:118
vtkOrderedTriangulator::TemplateTriangulate
void TemplateTriangulate(int cellType, int numPts, int numEdges)
vtkOrderedTriangulator::InsertPoint
vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type)
For each point to be inserted, provide an id, a position x, parametric coordinate p,...
vtkOrderedTriangulator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:51
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:52
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkOrderedTriangulator::AddTetras
vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts)
Add the tetrahedra classified (0=inside,1=outside) to the list of ids and coordinates provided.
vtkHeap
replacement for malloc/free and new/delete
Definition: vtkHeap.h:54
vtkObject.h
vtkOrderedTriangulator::AddTetras
vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid)
Add the tetras to the unstructured grid provided.
vtkOrderedTriangulator::InitTriangulation
void InitTriangulation(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int numPts)
Initialize the triangulation process.
vtkOrderedTriangulator::AddTriangles
vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity)
Add the triangle faces classified (2=boundary) and attached to the specified point id to the connecti...
vtkOrderedTriangulator::UpdatePointType
void UpdatePointType(vtkIdType internalId, int type)
Update the point type.
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:89
vtkOrderedTriangulator::New
static vtkOrderedTriangulator * New()
Construct object.
vtkOrderedTriangulator::InsertPoint
vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3], double p[3], int type)
vtkTetra
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:48
vtkOrderedTriangulator::GetPointLocation
double * GetPointLocation(vtkIdType internalId)
Return the global coordinates of point ‘internalId’.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69