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

vtkGenericCellTessellator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkGenericCellTessellator.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 =========================================================================*/
00052 #ifndef __vtkGenericCellTessellator_h
00053 #define __vtkGenericCellTessellator_h
00054 
00055 #include "vtkObject.h"
00056 
00057 class vtkTriangleTile;
00058 class vtkTetraTile;
00059 class vtkCellArray;
00060 class vtkDoubleArray;
00061 class vtkGenericEdgeTable;
00062 class vtkGenericSubdivisionErrorMetric;
00063 class vtkGenericAttributeCollection;
00064 class vtkGenericAdaptorCell;
00065 class vtkGenericCellIterator;
00066 
00067 //-----------------------------------------------------------------------------
00068 //
00069 // The tessellation object
00070 class VTK_FILTERING_EXPORT vtkGenericCellTessellator : public vtkObject
00071 {
00072 public:
00073   static vtkGenericCellTessellator *New();
00074   vtkTypeRevisionMacro(vtkGenericCellTessellator,vtkObject);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00078 
00079   vtkGetObjectMacro(GenericCell, vtkGenericAdaptorCell);
00081 
00083 
00088   virtual void TessellateTriangleFace(vtkGenericAdaptorCell *cell,
00089                                       vtkGenericAttributeCollection *att,
00090                                       vtkIdType index,
00091                                       vtkDoubleArray *points,
00092                                       vtkCellArray *cellArray,
00093                                       vtkDoubleArray *scalars);
00095 
00097 
00102   void Tessellate(vtkGenericAdaptorCell *cell,
00103                   vtkGenericAttributeCollection *att,
00104                   vtkDoubleArray *points,
00105                   vtkCellArray *cellArray,
00106                   vtkDoubleArray *scalars);
00108 
00110 
00114   void Triangulate(vtkGenericAdaptorCell *cell,
00115                    vtkGenericAttributeCollection *att,
00116                    vtkDoubleArray *points,
00117                    vtkCellArray *cellArray,
00118                    vtkDoubleArray *scalars);
00120 
00122 
00123   virtual void SetErrorMetric(vtkGenericSubdivisionErrorMetric *subAlgorithm);
00124   vtkGetObjectMacro(ErrorMetric,vtkGenericSubdivisionErrorMetric);
00126 
00128   void Reset();
00129 
00131   void Initialize(vtkIdType numPts);
00132 
00134   vtkGenericEdgeTable *GetEdgeTable();
00135   
00136 protected:
00137   vtkGenericCellTessellator();
00138   ~vtkGenericCellTessellator();
00139 
00141 
00142   vtkGenericEdgeTable *EdgeTable;
00143   void InsertEdgesIntoEdgeTable( vtkTriangleTile &tri );
00144   void RemoveEdgesFromEdgeTable( vtkTriangleTile &tri );
00145   void InsertPointsIntoEdgeTable( vtkTriangleTile &tri );
00147 
00148   void InsertEdgesIntoEdgeTable( vtkTetraTile &tetra );
00149   void RemoveEdgesFromEdgeTable( vtkTetraTile &tetra );
00150   void InsertPointsIntoEdgeTable( vtkTetraTile &tetra );
00151 
00153   vtkGenericAdaptorCell *GenericCell;
00154 
00156 
00159   double *Scalars;
00160   int ScalarsCapacity;
00162   
00164   vtkGenericCellIterator    *CellIterator;
00165 
00167   vtkGenericAttributeCollection *AttributeCollection;
00168 
00170 
00171   vtkDoubleArray     *TessellatePoints;  //Allow to use GetPointer
00172   vtkCellArray       *TessellateCellArray;
00173   vtkDoubleArray     *TessellateScalars;
00175 
00177   vtkGenericSubdivisionErrorMetric *ErrorMetric;
00178 
00180   void InternalTessellateTriangle( vtkTriangleTile& root );
00181 
00182   int FindEdgeReferenceCount(double p1[3], double p2[3], 
00183                              vtkIdType &e1, vtkIdType &e2);
00184 
00185   int GetNumberOfCellsUsingFace( int faceId );
00186   int GetNumberOfCellsUsingEdge( int edgeId );
00187   
00193   int IsEdgeOnFace(double p1[3], double p2[3]);
00194   
00200   int FindEdgeParent2D(double p1[3], double p2[3], int &localId);
00201   
00208   int FindEdgeParent(double p1[3], double p2[3], int &localId);
00209   
00210 private:
00211   vtkGenericCellTessellator(const vtkGenericCellTessellator&);  // Not implemented.
00212   void operator=(const vtkGenericCellTessellator&);  // Not implemented.
00213   
00214   //BTX
00215   friend class vtkTetraTile;
00216   friend class vtkTriangleTile;
00217   //ETX
00218 };
00219 
00220 #endif