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

vtkTubeFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTubeFilter.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 =========================================================================*/
00071 #ifndef __vtkTubeFilter_h
00072 #define __vtkTubeFilter_h
00073 
00074 #include "vtkPolyDataToPolyDataFilter.h"
00075 
00076 #define VTK_VARY_RADIUS_OFF 0
00077 #define VTK_VARY_RADIUS_BY_SCALAR 1
00078 #define VTK_VARY_RADIUS_BY_VECTOR 2
00079 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
00080 
00081 #define VTK_TCOORDS_OFF                    0
00082 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
00083 #define VTK_TCOORDS_FROM_LENGTH            2
00084 #define VTK_TCOORDS_FROM_SCALARS           3
00085 
00086 class vtkCellArray;
00087 class vtkCellData;
00088 class vtkDataArray;
00089 class vtkFloatArray;
00090 class vtkPointData;
00091 class vtkPoints;
00092 
00093 class VTK_GRAPHICS_EXPORT vtkTubeFilter : public vtkPolyDataToPolyDataFilter
00094 {
00095 public:
00096   vtkTypeRevisionMacro(vtkTubeFilter,vtkPolyDataToPolyDataFilter);
00097   void PrintSelf(ostream& os, vtkIndent indent);
00098 
00101   static vtkTubeFilter *New();
00102 
00104 
00106   vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
00107   vtkGetMacro(Radius,double);
00109 
00111 
00112   vtkSetClampMacro(VaryRadius,int,
00113                    VTK_VARY_RADIUS_OFF,VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
00114   vtkGetMacro(VaryRadius,int);
00115   void SetVaryRadiusToVaryRadiusOff()
00116     {this->SetVaryRadius(VTK_VARY_RADIUS_OFF);};
00117   void SetVaryRadiusToVaryRadiusByScalar()
00118     {this->SetVaryRadius(VTK_VARY_RADIUS_BY_SCALAR);};
00119   void SetVaryRadiusToVaryRadiusByVector()
00120     {this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR);};
00121   void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
00122     {this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);};
00123   const char *GetVaryRadiusAsString();
00125 
00127 
00129   vtkSetClampMacro(NumberOfSides,int,3,VTK_LARGE_INTEGER);
00130   vtkGetMacro(NumberOfSides,int);
00132 
00134 
00136   vtkSetMacro(RadiusFactor,double);
00137   vtkGetMacro(RadiusFactor,double);
00139 
00141 
00143   vtkSetVector3Macro(DefaultNormal,double);
00144   vtkGetVectorMacro(DefaultNormal,double,3);
00146 
00148 
00150   vtkSetMacro(UseDefaultNormal,int);
00151   vtkGetMacro(UseDefaultNormal,int);
00152   vtkBooleanMacro(UseDefaultNormal,int);
00154 
00156 
00159   vtkSetMacro(SidesShareVertices, int);
00160   vtkGetMacro(SidesShareVertices, int);
00161   vtkBooleanMacro(SidesShareVertices, int);
00163 
00165 
00166   vtkSetMacro(Capping,int);
00167   vtkGetMacro(Capping,int);
00168   vtkBooleanMacro(Capping,int);
00170 
00172 
00174   vtkSetClampMacro(OnRatio,int,1,VTK_LARGE_INTEGER);
00175   vtkGetMacro(OnRatio,int);
00177 
00179 
00182   vtkSetClampMacro(Offset,int,0,VTK_LARGE_INTEGER);
00183   vtkGetMacro(Offset,int);
00185 
00187 
00191   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
00192                    VTK_TCOORDS_FROM_SCALARS);
00193   vtkGetMacro(GenerateTCoords,int);
00194   void SetGenerateTCoordsToOff()
00195     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
00196   void SetGenerateTCoordsToNormalizedLength()
00197     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
00198   void SetGenerateTCoordsToUseLength()
00199     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
00200   void SetGenerateTCoordsToUseScalars()
00201     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
00202   const char *GetGenerateTCoordsAsString();
00204 
00206 
00210   vtkSetClampMacro(TextureLength,double,0.000001,VTK_LARGE_INTEGER);
00211   vtkGetMacro(TextureLength,double);
00213 
00214 protected:
00215   vtkTubeFilter();
00216   ~vtkTubeFilter() {}
00217 
00218   // Usual data generation method
00219   void Execute();
00220 
00221   double Radius; //minimum radius of tube
00222   int VaryRadius; //controls radius variation
00223   int NumberOfSides; //number of sides to create tube
00224   double RadiusFactor; //maxium allowablew radius
00225   double DefaultNormal[3];
00226   int UseDefaultNormal;
00227   int SidesShareVertices;
00228   int Capping; //control whether tubes are capped
00229   int OnRatio; //control the generation of the sides of the tube
00230   int Offset;  //control the generation of the sides
00231   int GenerateTCoords; //control texture coordinate generation
00232   double TextureLength; //this length is mapped to [0,1) texture space
00233   
00234   // Helper methods
00235   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
00236                      vtkPoints *inPts, vtkPoints *newPts, 
00237                      vtkPointData *pd, vtkPointData *outPD,
00238                      vtkFloatArray *newNormals, vtkDataArray *inScalars,
00239                      double range[2], vtkDataArray *inVectors, double maxNorm, 
00240                      vtkDataArray *inNormals);
00241   void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00242                       vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
00243                       vtkCellArray *newStrips);
00244   void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts, 
00245                              vtkPoints *inPts, vtkDataArray *inScalars,
00246                             vtkFloatArray *newTCoords);
00247   vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
00248   
00249   // Helper data members
00250   double Theta;
00251 
00252 private:
00253   vtkTubeFilter(const vtkTubeFilter&);  // Not implemented.
00254   void operator=(const vtkTubeFilter&);  // Not implemented.
00255 };
00256 
00257 #endif