VTK
dox/Common/DataModel/vtkOrderedTriangulator.h
Go to the documentation of this file.
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 "vtkCommonDataModelModule.h" // For export macro
00091 #include "vtkObject.h"
00092 
00093 class  vtkUnstructuredGrid;
00094 class  vtkCellArray;
00095 class  vtkHeap;
00096 class  vtkIdList;
00097 class  vtkPoints;
00098 class  vtkTetra;
00099 class  vtkDataArray;
00100 class  vtkDoubleArray;
00101 struct vtkOTMesh;
00102 struct vtkOTTemplates;
00103 class vtkIncrementalPointLocator;
00104 class vtkPointData;
00105 class vtkCellData;
00106 
00107 // Template ID's must be 32-bits. See .cxx file for more information.
00108 #if VTK_SIZEOF_SHORT == 4
00109 typedef unsigned short  TemplateIDType;
00110 #elif VTK_SIZEOF_INT == 4
00111 typedef unsigned int    TemplateIDType;
00112 #elif VTK_SIZEOF_LONG == 4
00113 typedef unsigned long   TemplateIDType;
00114 #endif
00115 
00116 class VTKCOMMONDATAMODEL_EXPORT vtkOrderedTriangulator : public vtkObject
00117 {
00118 public:
00119   vtkTypeMacro(vtkOrderedTriangulator,vtkObject);
00120   void PrintSelf(ostream& os, vtkIndent indent);
00121 
00123   static vtkOrderedTriangulator *New();
00124 
00126 
00132   void InitTriangulation(double xmin, double xmax, double ymin, double ymax,
00133                          double zmin, double zmax, int numPts);
00134   void InitTriangulation(double bounds[6], int numPts);
00136 
00138 
00151   vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type);
00152   vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3],
00153                         double p[3], int type);
00154   vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid,  vtkIdType sortid2,
00155                         double x[3], double p[3], int type);
00157 
00159 
00162   void Triangulate();
00163   void TemplateTriangulate(int cellType, int numPts, int numEdges);
00165 
00172   void UpdatePointType(vtkIdType internalId, int type);
00173 
00178   double *GetPointPosition(vtkIdType internalId);
00179 
00184   double *GetPointLocation(vtkIdType internalId);
00185 
00191   vtkIdType GetPointId(vtkIdType internalId);
00192 
00194 
00195   vtkGetMacro(NumberOfPoints,int);
00197 
00199 
00204   vtkSetMacro(UseTemplates,int);
00205   vtkGetMacro(UseTemplates,int);
00206   vtkBooleanMacro(UseTemplates,int);
00208 
00210 
00214   vtkSetMacro(PreSorted,int);
00215   vtkGetMacro(PreSorted,int);
00216   vtkBooleanMacro(PreSorted,int);
00218 
00220 
00222   vtkSetMacro(UseTwoSortIds,int);
00223   vtkGetMacro(UseTwoSortIds,int);
00224   vtkBooleanMacro(UseTwoSortIds,int);
00226 
00236   vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid);
00237 
00245   vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid);
00246 
00252   vtkIdType AddTetras(int classification, vtkCellArray *connectivity);
00253 
00255 
00261   vtkIdType AddTetras(int classification,
00262                       vtkIncrementalPointLocator *locator,
00263                       vtkCellArray *outConnectivity,
00264                       vtkPointData *inPD,
00265                       vtkPointData *outPD,
00266                       vtkCellData *inCD,
00267                       vtkIdType cellId,
00268                       vtkCellData *outCD);
00270 
00274   vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts);
00275 
00278   vtkIdType AddTriangles(vtkCellArray *connectivity);
00279 
00283   vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity);
00284 
00287   void InitTetraTraversal();
00288 
00290 
00298   int  GetNextTetra(int classification, vtkTetra *tet,
00299                     vtkDataArray *cellScalars, vtkDoubleArray *tetScalars);
00301 
00302 protected:
00303   vtkOrderedTriangulator();
00304   ~vtkOrderedTriangulator();
00305 
00306 private:
00307   void       Initialize();
00308 
00309   vtkOTMesh *Mesh;
00310   int        NumberOfPoints; //number of points inserted
00311   int        MaximumNumberOfPoints; //maximum possible number of points to be inserted
00312   double     Bounds[6];
00313   int        PreSorted;
00314   int        UseTwoSortIds;
00315   vtkHeap   *Heap;
00316   double     Quanta;
00317 
00318   int             UseTemplates;
00319   int             CellType;
00320   int             NumberOfCellPoints;
00321   int             NumberOfCellEdges;
00322   vtkHeap        *TemplateHeap;
00323   vtkOTTemplates *Templates;
00324   int             TemplateTriangulation();
00325   void            AddTemplate();
00326   TemplateIDType  ComputeTemplateIndex();
00327 
00328 private:
00329   vtkOrderedTriangulator(const vtkOrderedTriangulator&);  // Not implemented.
00330   void operator=(const vtkOrderedTriangulator&);  // Not implemented.
00331 };
00332 
00333 #endif
00334 
00335