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

# Graphics/vtkRibbonFilter.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkRibbonFilter.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 =========================================================================*/
    00058 #ifndef __vtkRibbonFilter_h
    00059 #define __vtkRibbonFilter_h
    00060
    00061 #include "vtkPolyDataToPolyDataFilter.h"
    00062
    00063 #define VTK_TCOORDS_OFF                    0
    00064 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
    00065 #define VTK_TCOORDS_FROM_LENGTH            2
    00066 #define VTK_TCOORDS_FROM_SCALARS           3
    00067
    00068 class vtkCellArray;
    00069 class vtkCellData;
    00070 class vtkDataArray;
    00071 class vtkFloatArray;
    00072 class vtkPointData;
    00073 class vtkPoints;
    00074
    00075 class VTK_GRAPHICS_EXPORT vtkRibbonFilter : public vtkPolyDataToPolyDataFilter
    00076 {
    00077 public:
    00078   vtkTypeRevisionMacro(vtkRibbonFilter,vtkPolyDataToPolyDataFilter);
    00079   void PrintSelf(ostream& os, vtkIndent indent);
    00080
    00083   static vtkRibbonFilter *New();
    00084
    00086
    00088   vtkSetClampMacro(Width,float,0,VTK_LARGE_FLOAT);
    00089   vtkGetMacro(Width,float);
    00091
    00093
    00095   vtkSetClampMacro(Angle,float,0,360);
    00096   vtkGetMacro(Angle,float);
    00098
    00100
    00101   vtkSetMacro(VaryWidth,int);
    00102   vtkGetMacro(VaryWidth,int);
    00103   vtkBooleanMacro(VaryWidth,int);
    00105
    00107
    00109   vtkSetMacro(WidthFactor,float);
    00110   vtkGetMacro(WidthFactor,float);
    00112
    00114
    00116   vtkSetVector3Macro(DefaultNormal,float);
    00117   vtkGetVectorMacro(DefaultNormal,float,3);
    00119
    00121
    00123   vtkSetMacro(UseDefaultNormal,int);
    00124   vtkGetMacro(UseDefaultNormal,int);
    00125   vtkBooleanMacro(UseDefaultNormal,int);
    00127
    00129
    00131   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
    00132                    VTK_TCOORDS_FROM_SCALARS);
    00133   vtkGetMacro(GenerateTCoords,int);
    00134   void SetGenerateTCoordsToOff()
    00135     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
    00136   void SetGenerateTCoordsToNormalizedLength()
    00137     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
    00138   void SetGenerateTCoordsToUseLength()
    00139     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
    00140   void SetGenerateTCoordsToUseScalars()
    00141     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
    00142   const char *GetGenerateTCoordsAsString();
    00144
    00146
    00150   vtkSetClampMacro(TextureLength,float,0.000001,VTK_LARGE_INTEGER);
    00151   vtkGetMacro(TextureLength,float);
    00153
    00154 protected:
    00155   vtkRibbonFilter();
    00156   ~vtkRibbonFilter();
    00157
    00158   void Execute();
    00159   float Width;
    00160   float Angle;
    00161   int VaryWidth; //controls whether width varies with scalar data
    00162   float WidthFactor;
    00163   float DefaultNormal[3];
    00164   int UseDefaultNormal;
    00165   int GenerateTCoords; //control texture coordinate generation
    00166   float TextureLength; //this length is mapped to [0,1) texture space
    00167
    00168   // Helper methods
    00169   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00170                      vtkPoints *inPts, vtkPoints *newPts,
    00171                      vtkPointData *pd, vtkPointData *outPD,
    00172                      vtkFloatArray *newNormals, vtkDataArray *inScalars,
    00173                      float range[2], vtkDataArray *inNormals);
    00174   void GenerateStrip(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00175                      vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
    00176                      vtkCellArray *newStrips);
    00177   void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00178                              vtkPoints *inPts, vtkDataArray *inScalars,
    00179                              vtkFloatArray *newTCoords);
    00180   vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
    00181
    00182   // Helper data members
    00183   float Theta;
    00184
    00185   // We preferred input vectors over normals because we do
    00186   // not want to shade the input line with these values.
    00187   char *InputVectorsSelection;
    00188   vtkSetStringMacro(InputVectorsSelection);
    00189
    00190 private:
    00191   vtkRibbonFilter(const vtkRibbonFilter&);  // Not implemented.
    00192   void operator=(const vtkRibbonFilter&);  // Not implemented.
    00193 };
    00194
    00195 #endif
    00196
    00197