VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSplineFilter.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 =========================================================================*/ 00039 #ifndef __vtkSplineFilter_h 00040 #define __vtkSplineFilter_h 00041 00042 #include "vtkFiltersGeneralModule.h" // For export macro 00043 #include "vtkPolyDataAlgorithm.h" 00044 00045 #define VTK_SUBDIVIDE_SPECIFIED 0 00046 #define VTK_SUBDIVIDE_LENGTH 1 00047 00048 #define VTK_TCOORDS_OFF 0 00049 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1 00050 #define VTK_TCOORDS_FROM_LENGTH 2 00051 #define VTK_TCOORDS_FROM_SCALARS 3 00052 00053 class vtkCellArray; 00054 class vtkCellData; 00055 class vtkFloatArray; 00056 class vtkPointData; 00057 class vtkPoints; 00058 class vtkSpline; 00059 00060 class VTKFILTERSGENERAL_EXPORT vtkSplineFilter : public vtkPolyDataAlgorithm 00061 { 00062 public: 00063 vtkTypeMacro(vtkSplineFilter,vtkPolyDataAlgorithm); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00068 static vtkSplineFilter *New(); 00069 00071 00073 vtkSetClampMacro(MaximumNumberOfSubdivisions,int,1,VTK_INT_MAX); 00074 vtkGetMacro(MaximumNumberOfSubdivisions,int); 00076 00078 00079 vtkSetClampMacro(Subdivide,int,VTK_SUBDIVIDE_SPECIFIED,VTK_SUBDIVIDE_LENGTH); 00080 vtkGetMacro(Subdivide,int); 00081 void SetSubdivideToSpecified() 00082 {this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED);} 00083 void SetSubdivideToLength() 00084 {this->SetSubdivide(VTK_SUBDIVIDE_LENGTH);} 00085 const char *GetSubdivideAsString(); 00087 00089 00092 vtkSetClampMacro(NumberOfSubdivisions,int,1,VTK_INT_MAX); 00093 vtkGetMacro(NumberOfSubdivisions,int); 00095 00097 00100 vtkSetClampMacro(Length,double,0.0000001,VTK_DOUBLE_MAX); 00101 vtkGetMacro(Length,double); 00103 00105 00106 virtual void SetSpline(vtkSpline*); 00107 vtkGetObjectMacro(Spline,vtkSpline); 00109 00111 00116 vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF, 00117 VTK_TCOORDS_FROM_SCALARS); 00118 vtkGetMacro(GenerateTCoords,int); 00119 void SetGenerateTCoordsToOff() 00120 {this->SetGenerateTCoords(VTK_TCOORDS_OFF);} 00121 void SetGenerateTCoordsToNormalizedLength() 00122 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);} 00123 void SetGenerateTCoordsToUseLength() 00124 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);} 00125 void SetGenerateTCoordsToUseScalars() 00126 {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);} 00127 const char *GetGenerateTCoordsAsString(); 00129 00131 00135 vtkSetClampMacro(TextureLength,double,0.000001,VTK_INT_MAX); 00136 vtkGetMacro(TextureLength,double); 00138 00139 protected: 00140 vtkSplineFilter(); 00141 ~vtkSplineFilter(); 00142 00143 // Usual data generation method 00144 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00145 00146 int MaximumNumberOfSubdivisions; 00147 int Subdivide; 00148 int NumberOfSubdivisions; 00149 double Length; 00150 vtkSpline *Spline; 00151 vtkSpline *XSpline; 00152 vtkSpline *YSpline; 00153 vtkSpline *ZSpline; 00154 int GenerateTCoords; 00155 double TextureLength; //this length is mapped to [0,1) texture space 00156 00157 //helper methods 00158 int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 00159 vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, 00160 vtkPointData *outPD, int genTCoords, 00161 vtkFloatArray *newTCoords); 00162 00163 void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId, 00164 vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines); 00165 00166 //helper members 00167 vtkFloatArray *TCoordMap; 00168 00169 private: 00170 vtkSplineFilter(const vtkSplineFilter&); // Not implemented. 00171 void operator=(const vtkSplineFilter&); // Not implemented. 00172 }; 00173 00174 #endif