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

vtkSplineFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSplineFilter.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 =========================================================================*/
00050 #ifndef __vtkSplineFilter_h
00051 #define __vtkSplineFilter_h
00052 
00053 #include "vtkPolyDataToPolyDataFilter.h"
00054 
00055 #define VTK_SUBDIVIDE_SPECIFIED 0
00056 #define VTK_SUBDIVIDE_LENGTH    1
00057 
00058 #define VTK_TCOORDS_OFF                    0
00059 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
00060 #define VTK_TCOORDS_FROM_LENGTH            2
00061 #define VTK_TCOORDS_FROM_SCALARS           3
00062 
00063 class vtkCellArray;
00064 class vtkCellData;
00065 class vtkFloatArray;
00066 class vtkPointData;
00067 class vtkPoints;
00068 class vtkSpline;
00069 
00070 class VTK_GRAPHICS_EXPORT vtkSplineFilter : public vtkPolyDataToPolyDataFilter
00071 {
00072 public:
00073   vtkTypeRevisionMacro(vtkSplineFilter,vtkPolyDataToPolyDataFilter);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00078   static vtkSplineFilter *New();
00079 
00081 
00083   vtkSetClampMacro(MaximumNumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00084   vtkGetMacro(MaximumNumberOfSubdivisions,int);
00086 
00088 
00089   vtkSetClampMacro(Subdivide,int,VTK_SUBDIVIDE_SPECIFIED,VTK_SUBDIVIDE_LENGTH);
00090   vtkGetMacro(Subdivide,int);
00091   void SetSubdivideToSpecified()
00092     {this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED);}
00093   void SetSubdivideToLength()
00094     {this->SetSubdivide(VTK_SUBDIVIDE_LENGTH);}
00095   const char *GetSubdivideAsString();
00097 
00099 
00102   vtkSetClampMacro(NumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00103   vtkGetMacro(NumberOfSubdivisions,int);
00105 
00107 
00110   vtkSetClampMacro(Length,double,0.0000001,VTK_DOUBLE_MAX);
00111   vtkGetMacro(Length,double);
00113 
00115 
00116   virtual void SetSpline(vtkSpline*);
00117   vtkGetObjectMacro(Spline,vtkSpline);
00119 
00121 
00126   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
00127                    VTK_TCOORDS_FROM_SCALARS);
00128   vtkGetMacro(GenerateTCoords,int);
00129   void SetGenerateTCoordsToOff()
00130     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
00131   void SetGenerateTCoordsToNormalizedLength()
00132     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
00133   void SetGenerateTCoordsToUseLength()
00134     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
00135   void SetGenerateTCoordsToUseScalars()
00136     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
00137   const char *GetGenerateTCoordsAsString();
00139 
00141 
00145   vtkSetClampMacro(TextureLength,double,0.000001,VTK_LARGE_INTEGER);
00146   vtkGetMacro(TextureLength,double);
00148 
00149 protected:
00150   vtkSplineFilter();
00151   ~vtkSplineFilter();
00152   
00153   // Usual data generation method
00154   void Execute();
00155 
00156   int       MaximumNumberOfSubdivisions;
00157   int       Subdivide;
00158   int       NumberOfSubdivisions;
00159   double     Length;
00160   vtkSpline *Spline;
00161   vtkSpline *XSpline;
00162   vtkSpline *YSpline;
00163   vtkSpline *ZSpline;
00164   int       GenerateTCoords;
00165   double     TextureLength; //this length is mapped to [0,1) texture space
00166 
00167   //helper methods
00168   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00169                      vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, 
00170                      vtkPointData *outPD, int genTCoords,
00171                      vtkFloatArray *newTCoords);
00172 
00173   void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId,
00174                     vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines);
00175 
00176   //helper members
00177   vtkFloatArray *TCoordMap;
00178 
00179 private:
00180   vtkSplineFilter(const vtkSplineFilter&);  // Not implemented.
00181   void operator=(const vtkSplineFilter&);  // Not implemented.
00182 };
00183 
00184 #endif