Graphics/vtkTubeFilter.h Source File

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

# Graphics/vtkTubeFilter.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkTubeFilter.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 =========================================================================*/
    00072 #ifndef __vtkTubeFilter_h
    00073 #define __vtkTubeFilter_h
    00074
    00075 #include "vtkPolyDataToPolyDataFilter.h"
    00076
    00077 #define VTK_VARY_RADIUS_OFF 0
    00078 #define VTK_VARY_RADIUS_BY_SCALAR 1
    00079 #define VTK_VARY_RADIUS_BY_VECTOR 2
    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,float,0.0,VTK_LARGE_FLOAT);
    00107   vtkGetMacro(Radius,float);
    00109
    00111
    00112   vtkSetClampMacro(VaryRadius,int,
    00113                    VTK_VARY_RADIUS_OFF,VTK_VARY_RADIUS_BY_VECTOR);
    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   const char *GetVaryRadiusAsString();
    00123
    00125
    00127   vtkSetClampMacro(NumberOfSides,int,3,VTK_LARGE_INTEGER);
    00128   vtkGetMacro(NumberOfSides,int);
    00130
    00132
    00134   vtkSetMacro(RadiusFactor,float);
    00135   vtkGetMacro(RadiusFactor,float);
    00137
    00139
    00141   vtkSetVector3Macro(DefaultNormal,float);
    00142   vtkGetVectorMacro(DefaultNormal,float,3);
    00144
    00146
    00148   vtkSetMacro(UseDefaultNormal,int);
    00149   vtkGetMacro(UseDefaultNormal,int);
    00150   vtkBooleanMacro(UseDefaultNormal,int);
    00152
    00154
    00157   vtkSetMacro(SidesShareVertices, int);
    00158   vtkGetMacro(SidesShareVertices, int);
    00159   vtkBooleanMacro(SidesShareVertices, int);
    00161
    00163
    00164   vtkSetMacro(Capping,int);
    00165   vtkGetMacro(Capping,int);
    00166   vtkBooleanMacro(Capping,int);
    00168
    00170
    00172   vtkSetClampMacro(OnRatio,int,1,VTK_LARGE_INTEGER);
    00173   vtkGetMacro(OnRatio,int);
    00175
    00177
    00180   vtkSetClampMacro(Offset,int,0,VTK_LARGE_INTEGER);
    00181   vtkGetMacro(Offset,int);
    00183
    00185
    00189   vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
    00190                    VTK_TCOORDS_FROM_SCALARS);
    00191   vtkGetMacro(GenerateTCoords,int);
    00192   void SetGenerateTCoordsToOff()
    00193     {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
    00194   void SetGenerateTCoordsToNormalizedLength()
    00195     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
    00196   void SetGenerateTCoordsToUseLength()
    00197     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
    00198   void SetGenerateTCoordsToUseScalars()
    00199     {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
    00200   const char *GetGenerateTCoordsAsString();
    00202
    00204
    00208   vtkSetClampMacro(TextureLength,float,0.000001,VTK_LARGE_INTEGER);
    00209   vtkGetMacro(TextureLength,float);
    00211
    00212 protected:
    00213   vtkTubeFilter();
    00214   ~vtkTubeFilter() {}
    00215
    00216   // Usual data generation method
    00217   void Execute();
    00218
    00219   float Radius; //minimum radius of tube
    00220   int VaryRadius; //controls radius variation
    00221   int NumberOfSides; //number of sides to create tube
    00222   float RadiusFactor; //maxium allowablew radius
    00223   float DefaultNormal[3];
    00224   int UseDefaultNormal;
    00225   int SidesShareVertices;
    00226   int Capping; //control whether tubes are capped
    00227   int OnRatio; //control the generation of the sides of the tube
    00228   int Offset;  //control the generation of the sides
    00229   int GenerateTCoords; //control texture coordinate generation
    00230   float TextureLength; //this length is mapped to [0,1) texture space
    00231
    00232   // Helper methods
    00233   int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00234                      vtkPoints *inPts, vtkPoints *newPts,
    00235                      vtkPointData *pd, vtkPointData *outPD,
    00236                      vtkFloatArray *newNormals, vtkDataArray *inScalars,
    00237                      float range[2], vtkDataArray *inVectors, float maxNorm,
    00238                      vtkDataArray *inNormals);
    00239   void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00240                       vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
    00241                       vtkCellArray *newStrips);
    00242   void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
    00243                              vtkPoints *inPts, vtkDataArray *inScalars,
    00244                             vtkFloatArray *newTCoords);
    00245   vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
    00246
    00247   // Helper data members
    00248   float Theta;
    00249
    00250 private:
    00251   vtkTubeFilter(const vtkTubeFilter&);  // Not implemented.
    00252   void operator=(const vtkTubeFilter&);  // Not implemented.
    00253 };
    00254
    00255 #endif