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

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 =========================================================================*/
00054 #ifndef __vtkSplineFilter_h
00055 #define __vtkSplineFilter_h
00056 
00057 #include "vtkPolyDataToPolyDataFilter.h"
00058 
00059 #define VTK_SUBDIVIDE_SPECIFIED 0
00060 #define VTK_SUBDIVIDE_LENGTH    1
00061 
00062 #define VTK_TCOORDS_OFF                    0
00063 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
00064 #define VTK_TCOORDS_FROM_LENGTH            2
00065 #define VTK_TCOORDS_FROM_SCALARS           3
00066 
00067 class vtkCellArray;
00068 class vtkCellData;
00069 class vtkFloatArray;
00070 class vtkPointData;
00071 class vtkPoints;
00072 class vtkSpline;
00073 
00074 class VTK_GRAPHICS_EXPORT vtkSplineFilter : public vtkPolyDataToPolyDataFilter
00075 {
00076 public:
00077   vtkTypeRevisionMacro(vtkSplineFilter,vtkPolyDataToPolyDataFilter);
00078   void PrintSelf(ostream& os, vtkIndent indent);
00079 
00082   static vtkSplineFilter *New();
00083 
00085 
00087   vtkSetClampMacro(MaximumNumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00088   vtkGetMacro(MaximumNumberOfSubdivisions,int);
00090 
00092 
00093   vtkSetClampMacro(Subdivide,int,VTK_SUBDIVIDE_SPECIFIED,VTK_SUBDIVIDE_LENGTH);
00094   vtkGetMacro(Subdivide,int);
00095   void SetSubdivideToSpecified()
00096     {this->SetSubdivide(VTK_SUBDIVIDE_SPECIFIED);}
00097   void SetSubdivideToLength()
00098     {this->SetSubdivide(VTK_SUBDIVIDE_LENGTH);}
00099   const char *GetSubdivideAsString();
00101 
00103 
00106   vtkSetClampMacro(NumberOfSubdivisions,int,1,VTK_LARGE_INTEGER);
00107   vtkGetMacro(NumberOfSubdivisions,int);
00109 
00111 
00114   vtkSetClampMacro(Length,float,0.0000001,VTK_LARGE_FLOAT);
00115   vtkGetMacro(Length,float);
00117 
00119 
00120   virtual void SetSpline(vtkSpline*);
00121   vtkGetObjectMacro(Spline,vtkSpline);
00123 
00125 
00130   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
00131                    VTK_TCOORDS_FROM_SCALARS);
00132   vtkGetMacro(GenerateTCoords,int);
00133   void SetGenerateTCoordsToOff()
00134     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
00135   void SetGenerateTCoordsToNormalizedLength()
00136     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
00137   void SetGenerateTCoordsToUseLength()
00138     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
00139   void SetGenerateTCoordsToUseScalars()
00140     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
00141   const char *GetGenerateTCoordsAsString();
00143 
00145 
00149   vtkSetClampMacro(TextureLength,float,0.000001,VTK_LARGE_INTEGER);
00150   vtkGetMacro(TextureLength,float);
00152 
00153 protected:
00154   vtkSplineFilter();
00155   ~vtkSplineFilter();
00156   
00157   // Usual data generation method
00158   void Execute();
00159 
00160   int       MaximumNumberOfSubdivisions;
00161   int       Subdivide;
00162   int       NumberOfSubdivisions;
00163   float     Length;
00164   vtkSpline *Spline;
00165   vtkSpline *XSpline;
00166   vtkSpline *YSpline;
00167   vtkSpline *ZSpline;
00168   int       GenerateTCoords;
00169   float     TextureLength; //this length is mapped to [0,1) texture space
00170 
00171   //helper methods
00172   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00173                      vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, 
00174                      vtkPointData *outPD, int genTCoords,
00175                      vtkFloatArray *newTCoords);
00176 
00177   void GenerateLine(vtkIdType offset, vtkIdType numGenPts, vtkIdType inCellId,
00178                     vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newLines);
00179 
00180   //helper members
00181   vtkFloatArray *TCoordMap;
00182 
00183 private:
00184   vtkSplineFilter(const vtkSplineFilter&);  // Not implemented.
00185   void operator=(const vtkSplineFilter&);  // Not implemented.
00186 };
00187 
00188 #endif