00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCatmullClarkFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2001/10/11 13:37:08 $ 00007 Version: $Revision: 1.11 $ 00008 Thanks: This work was supported bt PHS Research Grant No. 1 P41 RR13218-01 00009 from the National Center for Research Resources 00010 00011 Copyright (c) 1993-2001 Leopold Kühschelm, Daniel Wagner, Sebastian Zambal 00012 All rights reserved. 00013 00014 Redistribution and use in source and binary forms, with or without 00015 modification, are permitted provided that the following conditions are met: 00016 00017 * Redistributions of source code must retain the above copyright notice, 00018 this list of conditions and the following disclaimer. 00019 00020 * Redistributions in binary form must reproduce the above copyright notice, 00021 this list of conditions and the following disclaimer in the documentation 00022 and/or other materials provided with the distribution. 00023 00024 * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names 00025 of any contributors may be used to endorse or promote products derived 00026 from this software without specific prior written permission. 00027 00028 * Modified source versions must be plainly marked as such, and must not be 00029 misrepresented as being the original software. 00030 00031 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00032 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00033 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00034 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR 00035 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00036 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00037 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00038 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00039 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00040 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00041 00042 =========================================================================*/ 00043 // .NAME vtkCatmullClarkFilter - generate a subdivision surface using the Catmull-Clark Scheme 00044 // .SECTION Description 00045 // TODO 00046 00047 #ifndef __vtkCatmullClarkFilter_h 00048 #define __vtkCatmullClarkFilter_h 00049 00050 #include <vtkApproximatingSubdivisionFilter.h> 00051 #include <vtkIntArray.h> 00052 #include <vtkIdList.h> 00053 #include <vtkCellArray.h> 00054 #include <vtkPointData.h> 00055 #include <vtkPolyData.h> 00056 00057 struct EdgePoint { 00058 vtkIdType e; 00059 vtkIdType p1; 00060 vtkIdType p2; 00061 EdgePoint *next; 00062 }; 00063 00064 struct VertexPoint { 00065 vtkIdType v; 00066 vtkIdType v_old; 00067 VertexPoint *next; 00068 }; 00069 00070 struct CellData { 00071 vtkIdType facePoint; 00072 EdgePoint *edgePoints; 00073 VertexPoint *vertexPoints; 00074 }; 00075 00076 class VTK_GRAPHICS_EXPORT vtkCatmullClarkFilter : public vtkApproximatingSubdivisionFilter 00077 { 00078 public: 00079 // Description: 00080 // Construct object with NumberOfSubdivisions set to 1. 00081 static vtkCatmullClarkFilter *New(); 00082 vtkTypeMacro(vtkCatmullClarkFilter,vtkApproximatingSubdivisionFilter); 00083 00084 protected: 00085 vtkCatmullClarkFilter () {}; 00086 ~vtkCatmullClarkFilter () {}; 00087 00088 virtual void Execute(void); 00089 00090 void insertEdgePoint(CellData &cell, EdgePoint *newElement); 00091 EdgePoint *findEdgePoint(CellData &cell, vtkIdType id1, vtkIdType id2); 00092 void insertVertexPoint(CellData &cell, VertexPoint *newElement); 00093 VertexPoint *findVertexPoint(CellData &cell, vtkIdType id); 00094 00095 void computeFacePoint(vtkCell *cell, float *facePoint); 00096 vtkIdList *getNeighborIds(vtkPolyData *input, vtkIdType i); 00097 00098 void Subdivision(vtkPolyData* input, vtkPolyData *output); 00099 00100 void GenerateSubdivisionPoints (vtkPolyData *inputDS, vtkIntArray *edgeData, 00101 vtkPoints *outputPts, 00102 vtkPointData *outputPD); 00103 00104 private: 00105 vtkCatmullClarkFilter(const vtkCatmullClarkFilter&); // Not implemented. 00106 void operator=(const vtkCatmullClarkFilter&); // Not implemented. 00107 }; 00108 00109 #endif 00110 00111