VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOrderedTriangulator.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00087 #ifndef __vtkOrderedTriangulator_h 00088 #define __vtkOrderedTriangulator_h 00089 00090 #include "vtkObject.h" 00091 00092 class vtkUnstructuredGrid; 00093 class vtkCellArray; 00094 class vtkHeap; 00095 class vtkIdList; 00096 class vtkPoints; 00097 class vtkTetra; 00098 class vtkDataArray; 00099 class vtkDoubleArray; 00100 struct vtkOTMesh; 00101 struct vtkOTTemplates; 00102 class vtkIncrementalPointLocator; 00103 class vtkPointData; 00104 class vtkCellData; 00105 00106 // Template ID's must be 32-bits. See .cxx file for more information. 00107 #if VTK_SIZEOF_SHORT == 4 00108 typedef unsigned short TemplateIDType; 00109 #elif VTK_SIZEOF_INT == 4 00110 typedef unsigned int TemplateIDType; 00111 #elif VTK_SIZEOF_LONG == 4 00112 typedef unsigned long TemplateIDType; 00113 #endif 00114 00115 class VTK_FILTERING_EXPORT vtkOrderedTriangulator : public vtkObject 00116 { 00117 public: 00118 vtkTypeMacro(vtkOrderedTriangulator,vtkObject); 00119 void PrintSelf(ostream& os, vtkIndent indent); 00120 00122 static vtkOrderedTriangulator *New(); 00123 00125 00131 void InitTriangulation(double xmin, double xmax, double ymin, double ymax, 00132 double zmin, double zmax, int numPts); 00133 void InitTriangulation(double bounds[6], int numPts); 00135 00137 00150 vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type); 00151 vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3], 00152 double p[3], int type); 00153 vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, vtkIdType sortid2, 00154 double x[3], double p[3], int type); 00156 00158 00161 void Triangulate(); 00162 void TemplateTriangulate(int cellType, int numPts, int numEdges); 00164 00171 void UpdatePointType(vtkIdType internalId, int type); 00172 00177 double *GetPointPosition(vtkIdType internalId); 00178 00183 double *GetPointLocation(vtkIdType internalId); 00184 00190 vtkIdType GetPointId(vtkIdType internalId); 00191 00193 00194 vtkGetMacro(NumberOfPoints,int); 00196 00198 00203 vtkSetMacro(UseTemplates,int); 00204 vtkGetMacro(UseTemplates,int); 00205 vtkBooleanMacro(UseTemplates,int); 00207 00209 00213 vtkSetMacro(PreSorted,int); 00214 vtkGetMacro(PreSorted,int); 00215 vtkBooleanMacro(PreSorted,int); 00217 00219 00221 vtkSetMacro(UseTwoSortIds,int); 00222 vtkGetMacro(UseTwoSortIds,int); 00223 vtkBooleanMacro(UseTwoSortIds,int); 00225 00235 vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid); 00236 00244 vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid); 00245 00251 vtkIdType AddTetras(int classification, vtkCellArray *connectivity); 00252 00254 00260 vtkIdType AddTetras(int classification, 00261 vtkIncrementalPointLocator *locator, 00262 vtkCellArray *outConnectivity, 00263 vtkPointData *inPD, 00264 vtkPointData *outPD, 00265 vtkCellData *inCD, 00266 vtkIdType cellId, 00267 vtkCellData *outCD); 00269 00273 vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts); 00274 00277 vtkIdType AddTriangles(vtkCellArray *connectivity); 00278 00282 vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity); 00283 00286 void InitTetraTraversal(); 00287 00289 00297 int GetNextTetra(int classification, vtkTetra *tet, 00298 vtkDataArray *cellScalars, vtkDoubleArray *tetScalars); 00300 00301 protected: 00302 vtkOrderedTriangulator(); 00303 ~vtkOrderedTriangulator(); 00304 00305 private: 00306 void Initialize(); 00307 00308 vtkOTMesh *Mesh; 00309 int NumberOfPoints; //number of points inserted 00310 int MaximumNumberOfPoints; //maximum possible number of points to be inserted 00311 double Bounds[6]; 00312 int PreSorted; 00313 int UseTwoSortIds; 00314 vtkHeap *Heap; 00315 double Quanta; 00316 00317 int UseTemplates; 00318 int CellType; 00319 int NumberOfCellPoints; 00320 int NumberOfCellEdges; 00321 vtkHeap *TemplateHeap; 00322 vtkOTTemplates *Templates; 00323 int TemplateTriangulation(); 00324 void AddTemplate(); 00325 TemplateIDType ComputeTemplateIndex(); 00326 00327 private: 00328 vtkOrderedTriangulator(const vtkOrderedTriangulator&); // Not implemented. 00329 void operator=(const vtkOrderedTriangulator&); // Not implemented. 00330 }; 00331 00332 #endif 00333 00334