Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

vtkSQ3SubdivisionFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSQ3SubdivisionFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/03 12:52:23 $
00007   Version:   $Revision: 1.16 $
00008 
00009   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00010   All rights reserved.
00011   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00012 
00013      This software is distributed WITHOUT ANY WARRANTY; without even 
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015      PURPOSE.  See the above copyright notice for more information.
00016 
00017 =========================================================================*/
00018 // .NAME vtkSQ3SubdivisionFilter - generate a subdivision surface using an Interpolating Scheme
00019 // .SECTION Description
00020 // vtkSQ3SubdivisionFilter is an abstract class that defines
00021 // the protocol for interpolating subdivision surface filters.
00022 
00023 // .SECTION Thanks
00024 // This work was supported by PHS Research Grant No. 1 P41 RR13218-01
00025 // from the National Center for Research Resources.
00026 
00027 // .SECTION See Also
00028 // vtkLinearSubdivisionFilter vtkButterflySubdivisionFilter
00029 
00030 #ifndef __vtkSQ3SubdivisionFilter_h
00031 #define __vtkSQ3SubdivisionFilter_h
00032 
00033 #include <vtkPolyDataToPolyDataFilter.h>
00034 
00035 class vtkCellArray;
00036 class vtkCellData;
00037 class vtkIdList;
00038 class vtkIntArray;
00039 class vtkPointData;
00040 class vtkPoints;
00041 class vtkPolyData;
00042 
00043 /**
00044  * \htmlonly
00045  * SQ3 subdivision implements the &radic;3-subdivision implemented by Leif Kobbelt at Max-Planck
00046  * Institut for Computer Graphics. The filter can handle only triangle meshes so if you have other
00047  * mashes use the vtkTriangleFilter to triangulate it.
00048  * \endhtmlonly
00049  */
00050 class vtkSQ3SubdivisionFilter : public vtkPolyDataToPolyDataFilter
00051 {
00052 public:
00053   static vtkSQ3SubdivisionFilter *New();
00054   vtkTypeRevisionMacro(vtkSQ3SubdivisionFilter,vtkPolyDataToPolyDataFilter);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056 
00057   // Description:
00058   // Set/get the number of subdivisions.
00059   vtkSetMacro(NumberOfSubdivisions,int);
00060   vtkGetMacro(NumberOfSubdivisions,int);
00061 
00062 protected:
00063         vtkSQ3SubdivisionFilter () {
00064                 this->NumberOfSubdivisions = 1;
00065 
00066                 //os = new ofstream("C:\\vtk.log", ios::app | ios::out);
00067                 /*
00068                 os = new ofstream("C:\\vtk.log");
00069                 (*os) << "\n\n\n============================ S T A R T ===============================\n";
00070                 */
00071         };
00072         ~vtkSQ3SubdivisionFilter () { 
00073                 /*
00074                 (*os) << "\n\n\n============================= E N D E ================================\n";
00075                 os->flush(); 
00076                 os->close(); 
00077                 delete os; 
00078                 */
00079         };
00080 
00081   void Execute();
00082         /**
00083          * Generates a new point in the output mash. It also ubdates the cellsVisited and cellsPoints list.
00084          * The new point is added to outputPD and outputPts.
00085          */
00086         bool generatePoint(vtkIdType cellId, vtkIdType &newId, 
00087                                                                                  vtkIdList *cellsVisited, vtkIdList *cellsPoints, 
00088                                                                                  vtkIdType *pts, vtkPolyData *inputDS, 
00089                                                                                  vtkPointData *outputPD, vtkPoints *outputPts);
00090         /**
00091          * Subdivides each cell and generates new cells. The methode does this by first filtering the input
00092          * and then generating new points. It uses the generatePoints method.
00093          *
00094          * @todo        While stepping through all neighbours we assume there is only one neighbour per edge.
00095          */
00096   void GenerateSubdivisionPoints (vtkPolyData *inputDS, vtkPoints *outputPts, vtkPointData *outputPD, 
00097                                                                                                                                         vtkCellArray *outputPolys, vtkCellData *outputCD);
00098   void GenerateSubdivisionCells (vtkPolyData *inputDS, vtkIntArray *edgeData, vtkCellArray *outputPolys, vtkCellData *outputCD);
00099         /**
00100          * Generates a filter stencil for input points.
00101          */
00102         void GenerateEvenStencil (vtkIdType p1, vtkPolyData *polys,
00103                             vtkIdList *stencilIds, float *weights);
00104 
00105         /**
00106          * Find a edge in mesh using p1 and p2.
00107          */
00108   int FindEdge (vtkPolyData *mesh, vtkIdType cellId, vtkIdType p1,
00109                 vtkIdType p2, vtkIntArray *edgeData, vtkIdList *cellIds);
00110         /**
00111          * Calculates the position of a new point using the stencil and weights.
00112          */
00113   vtkIdType InterpolatePosition (vtkPoints *inputPts, vtkPoints *outputPts,
00114                                  vtkIdList *stencil, float *weights);
00115   int NumberOfSubdivisions;
00116 
00117 private:
00118         //ofstream *os;
00119 
00120   vtkSQ3SubdivisionFilter(const vtkSQ3SubdivisionFilter&);  // Not implemented.
00121   void operator=(const vtkSQ3SubdivisionFilter&);  // Not implemented.
00122 };
00123 
00124 #endif
00125 
00126 

Generated on Thu Jul 3 16:54:23 2003 for Sq3Subdivision by doxygen1.2.18