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

dox/Graphics/vtkSplineFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSplineFilter.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00043 #ifndef __vtkSplineFilter_h
00044 #define __vtkSplineFilter_h
00045 
00046 #include "vtkPolyDataToPolyDataFilter.h"
00047 
00048 #define VTK_SUBDIVIDE_SPECIFIED 0
00049 #define VTK_SUBDIVIDE_LENGTH    1
00050 
00051 #define VTK_TCOORDS_OFF                    0
00052 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
00053 #define VTK_TCOORDS_FROM_LENGTH            2
00054 #define VTK_TCOORDS_FROM_SCALARS           3
00055 
00056 class vtkCellArray;
00057 class vtkCellData;
00058 class vtkFloatArray;
00059 class vtkPointData;
00060 class vtkPoints;
00061 class vtkSpline;
00062 
00063 class VTK_GRAPHICS_EXPORT vtkSplineFilter : public vtkPolyDataToPolyDataFilter
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkSplineFilter,vtkPolyDataToPolyDataFilter);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00071   static vtkSplineFilter *New();
00072 
00074 
00076   vtkSetClampMacro(MaximumNumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00077   vtkGetMacro(MaximumNumberOfSubdivisions,int);
00079 
00081 
00082   vtkSetClampMacro(Subdivide,int,VTK_SUBDIVIDE_SPECIFIED,VTK_SUBDIVIDE_LENGTH);
00083   vtkGetMacro(Subdivide,int);
00084   void SetSubdivideToSpecified()
00085     {this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED);}
00086   void SetSubdivideToLength()
00087     {this->SetSubdivide(VTK_SUBDIVIDE_LENGTH);}
00088   const char *GetSubdivideAsString();
00090 
00092 
00095   vtkSetClampMacro(NumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00096   vtkGetMacro(NumberOfSubdivisions,int);
00098 
00100 
00103   vtkSetClampMacro(Length,float,0.0000001,VTK_LARGE_FLOAT);
00104   vtkGetMacro(Length,float);
00106 
00108 
00109   virtual void SetSpline(vtkSpline*);
00110   vtkGetObjectMacro(Spline,vtkSpline);
00112 
00114 
00119   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
00120                    VTK_TCOORDS_FROM_SCALARS);
00121   vtkGetMacro(GenerateTCoords,int);
00122   void SetGenerateTCoordsToOff()
00123     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
00124   void SetGenerateTCoordsToNormalizedLength()
00125     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
00126   void SetGenerateTCoordsToUseLength()
00127     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
00128   void SetGenerateTCoordsToUseScalars()
00129     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
00130   const char *GetGenerateTCoordsAsString();
00132 
00134 
00138   vtkSetClampMacro(TextureLength,float,0.000001,VTK_LARGE_INTEGER);
00139   vtkGetMacro(TextureLength,float);
00141 
00142 protected:
00143   vtkSplineFilter();
00144   ~vtkSplineFilter();
00145   
00146   // Usual data generation method
00147   void Execute();
00148 
00149   int       MaximumNumberOfSubdivisions;
00150   int       Subdivide;
00151   int       NumberOfSubdivisions;
00152   float     Length;
00153   vtkSpline *Spline;
00154   vtkSpline *XSpline;
00155   vtkSpline *YSpline;
00156   vtkSpline *ZSpline;
00157   int       GenerateTCoords;
00158   float     TextureLength; //this length is mapped to [0,1) texture space
00159 
00160   //helper methods
00161   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00162                      vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, 
00163                      vtkPointData *outPD, int genTCoords,
00164                      vtkFloatArray *newTCoords);
00165 
00166   void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId,
00167                     vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines);
00168 
00169   //helper members
00170   vtkFloatArray *TCoordMap;
00171 
00172 private:
00173   vtkSplineFilter(const vtkSplineFilter&);  // Not implemented.
00174   void operator=(const vtkSplineFilter&);  // Not implemented.
00175 };
00176 
00177 #endif