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

vtkRibbonFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRibbonFilter.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 =========================================================================*/
00054 #ifndef __vtkRibbonFilter_h
00055 #define __vtkRibbonFilter_h
00056 
00057 #include "vtkPolyDataToPolyDataFilter.h"
00058 
00059 #define VTK_TCOORDS_OFF                    0
00060 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
00061 #define VTK_TCOORDS_FROM_LENGTH            2
00062 #define VTK_TCOORDS_FROM_SCALARS           3
00063 
00064 class vtkCellArray;
00065 class vtkCellData;
00066 class vtkDataArray;
00067 class vtkFloatArray;
00068 class vtkPointData;
00069 class vtkPoints;
00070 
00071 class VTK_GRAPHICS_EXPORT vtkRibbonFilter : public vtkPolyDataToPolyDataFilter 
00072 {
00073 public:
00074   vtkTypeRevisionMacro(vtkRibbonFilter,vtkPolyDataToPolyDataFilter);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00079   static vtkRibbonFilter *New();
00080 
00082 
00084   vtkSetClampMacro(Width,double,0,VTK_DOUBLE_MAX);
00085   vtkGetMacro(Width,double);
00087 
00089 
00091   vtkSetClampMacro(Angle,double,0,360);
00092   vtkGetMacro(Angle,double);
00094 
00096 
00097   vtkSetMacro(VaryWidth,int);
00098   vtkGetMacro(VaryWidth,int);
00099   vtkBooleanMacro(VaryWidth,int);
00101 
00103 
00105   vtkSetMacro(WidthFactor,double);
00106   vtkGetMacro(WidthFactor,double);
00108 
00110 
00112   vtkSetVector3Macro(DefaultNormal,double);
00113   vtkGetVectorMacro(DefaultNormal,double,3);
00115 
00117 
00119   vtkSetMacro(UseDefaultNormal,int);
00120   vtkGetMacro(UseDefaultNormal,int);
00121   vtkBooleanMacro(UseDefaultNormal,int);
00123 
00125 
00127   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
00128                    VTK_TCOORDS_FROM_SCALARS);
00129   vtkGetMacro(GenerateTCoords,int);
00130   void SetGenerateTCoordsToOff()
00131     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
00132   void SetGenerateTCoordsToNormalizedLength()
00133     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
00134   void SetGenerateTCoordsToUseLength()
00135     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
00136   void SetGenerateTCoordsToUseScalars()
00137     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
00138   const char *GetGenerateTCoordsAsString();
00140 
00142 
00146   vtkSetClampMacro(TextureLength,double,0.000001,VTK_LARGE_INTEGER);
00147   vtkGetMacro(TextureLength,double);
00149 
00151 
00154   vtkGetStringMacro(InputVectorsSelection);
00155   void SelectInputVectors(const char *fieldName) 
00156     {this->SetInputVectorsSelection(fieldName);}
00158 
00160 
00163   vtkGetStringMacro(InputScalarsSelection);
00164   void SelectInputScalars(const char *fieldName) 
00165     {this->SetInputScalarsSelection(fieldName);}
00167 
00168 protected:
00169   vtkRibbonFilter();
00170   ~vtkRibbonFilter();
00171 
00172   void Execute();
00173   double Width;
00174   double Angle;
00175   int VaryWidth; //controls whether width varies with scalar data
00176   double WidthFactor;
00177   double DefaultNormal[3];
00178   int UseDefaultNormal;
00179   int GenerateTCoords; //control texture coordinate generation
00180   double TextureLength; //this length is mapped to [0,1) texture space
00181 
00182   // Helper methods
00183   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
00184                      vtkPoints *inPts, vtkPoints *newPts, 
00185                      vtkPointData *pd, vtkPointData *outPD,
00186                      vtkFloatArray *newNormals, vtkDataArray *inScalars,
00187                      double range[2], vtkDataArray *inNormals);
00188   void GenerateStrip(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00189                      vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
00190                      vtkCellArray *newStrips);
00191   void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
00192                              vtkPoints *inPts, vtkDataArray *inScalars,
00193                              vtkFloatArray *newTCoords);
00194   vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
00195   
00196   // Helper data members
00197   double Theta;
00198 
00199   // We preferred input vectors over normals because we do
00200   // not want to shade the input line with these values.
00201   char *InputVectorsSelection;
00202   vtkSetStringMacro(InputVectorsSelection);
00203   
00204   char *InputScalarsSelection;
00205   vtkSetStringMacro(InputScalarsSelection);
00206   
00207 private:
00208   vtkRibbonFilter(const vtkRibbonFilter&);  // Not implemented.
00209   void operator=(const vtkRibbonFilter&);  // Not implemented.
00210 };
00211 
00212 #endif
00213 
00214