Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Common/vtkOrderedTriangulator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkOrderedTriangulator.h,v $
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 =========================================================================*/
00072 #ifndef __vtkOrderedTriangulator_h
00073 #define __vtkOrderedTriangulator_h
00074 
00075 #include "vtkObject.h"
00076 
00077 class  vtkUnstructuredGrid;
00078 class  vtkCellArray;
00079 class  vtkHeap;
00080 class  vtkIdList;
00081 class  vtkPoints;
00082 class  vtkTetra;
00083 class  vtkDataArray;
00084 class  vtkDoubleArray;
00085 struct vtkOTMesh;
00086 struct vtkOTTemplates;
00087 
00088 
00089 // Template ID's must be 32-bits. See .cxx file for more information.
00090 #if VTK_SIZEOF_SHORT == 4
00091 typedef unsigned short  TemplateIDType;
00092 #elif VTK_SIZEOF_INT == 4
00093 typedef unsigned int    TemplateIDType;
00094 #elif VTK_SIZEOF_LONG == 4
00095 typedef unsigned long   TemplateIDType;
00096 #endif    
00097 
00098 class VTK_COMMON_EXPORT vtkOrderedTriangulator : public vtkObject
00099 {
00100 public:
00101   vtkTypeRevisionMacro(vtkOrderedTriangulator,vtkObject);
00102   void PrintSelf(ostream& os, vtkIndent indent);
00103 
00105   static vtkOrderedTriangulator *New();
00106 
00108 
00110   void InitTriangulation(double xmin, double xmax, double ymin, double ymax,
00111                          double zmin, double zmax, int numPts);
00112   void InitTriangulation(double bounds[6], int numPts);
00114 
00116 
00129   vtkIdType InsertPoint(vtkIdType id, double x[3], double p[3], int type);
00130   vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid, double x[3], 
00131                         double p[3], int type);
00132   vtkIdType InsertPoint(vtkIdType id, vtkIdType sortid,  vtkIdType sortid2, 
00133                         double x[3], double p[3], int type);
00135 
00137 
00140   void Triangulate();
00141   void TemplateTriangulate(int cellType, int numPts, int numEdges);
00143 
00149   void UpdatePointType(vtkIdType internalId, int type);
00150 
00152 
00157   vtkSetMacro(UseTemplates,int);
00158   vtkGetMacro(UseTemplates,int);
00159   vtkBooleanMacro(UseTemplates,int);
00161 
00163 
00167   vtkSetMacro(PreSorted,int);
00168   vtkGetMacro(PreSorted,int);
00169   vtkBooleanMacro(PreSorted,int);
00171 
00173 
00175   vtkSetMacro(UseTwoSortIds,int);
00176   vtkGetMacro(UseTwoSortIds,int);
00177   vtkBooleanMacro(UseTwoSortIds,int);
00179 
00189   vtkIdType GetTetras(int classification, vtkUnstructuredGrid *ugrid);
00190   
00198   vtkIdType AddTetras(int classification, vtkUnstructuredGrid *ugrid);
00199   
00205   vtkIdType AddTetras(int classification, vtkCellArray *connectivity);
00206   
00210   vtkIdType AddTetras(int classification, vtkIdList *ptIds, vtkPoints *pts);
00211   
00214   vtkIdType AddTriangles(vtkCellArray *connectivity);
00215   
00219   vtkIdType AddTriangles(vtkIdType id, vtkCellArray *connectivity);
00220   
00222 
00224   void InitTetraTraversal();
00225   int  GetNextTetra(int classification, vtkTetra *tet,
00226                     vtkDataArray *cellScalars, vtkDoubleArray *tetScalars);
00228   
00229 protected:
00230   vtkOrderedTriangulator();
00231   ~vtkOrderedTriangulator();
00232 
00233 private:
00234   void       Initialize();
00235 
00236   vtkOTMesh *Mesh;
00237   int        NumberOfPoints; //number of points inserted
00238   int        MaximumNumberOfPoints; //maximum possible number of points to be inserted
00239   double     Bounds[6];
00240   int        PreSorted;
00241   int        UseTwoSortIds;
00242   vtkHeap   *Heap;
00243   double     Quanta;
00244 
00245   int             UseTemplates;
00246   int             CellType;
00247   int             NumberOfCellPoints;
00248   int             NumberOfCellEdges;
00249   vtkHeap        *TemplateHeap;
00250   vtkOTTemplates *Templates;
00251   int             TemplateTriangulation();
00252   void            AddTemplate();
00253   TemplateIDType  ComputeTemplateIndex();
00254     
00255 private:
00256   vtkOrderedTriangulator(const vtkOrderedTriangulator&);  // Not implemented.
00257   void operator=(const vtkOrderedTriangulator&);  // Not implemented.
00258 };
00259 
00260 #endif
00261 
00262