VTK
vtkTubeFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTubeFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
59 #ifndef vtkTubeFilter_h
60 #define vtkTubeFilter_h
61 
62 #include "vtkFiltersCoreModule.h" // For export macro
63 #include "vtkPolyDataAlgorithm.h"
64 
65 #define VTK_VARY_RADIUS_OFF 0
66 #define VTK_VARY_RADIUS_BY_SCALAR 1
67 #define VTK_VARY_RADIUS_BY_VECTOR 2
68 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
69 
70 #define VTK_TCOORDS_OFF 0
71 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
72 #define VTK_TCOORDS_FROM_LENGTH 2
73 #define VTK_TCOORDS_FROM_SCALARS 3
74 
75 class vtkCellArray;
76 class vtkCellData;
77 class vtkDataArray;
78 class vtkFloatArray;
79 class vtkPointData;
80 class vtkPoints;
81 
83 {
84 public:
86  void PrintSelf(ostream& os, vtkIndent indent);
87 
90  static vtkTubeFilter *New();
91 
93 
95  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
96  vtkGetMacro(Radius,double);
98 
100 
101  vtkSetClampMacro(VaryRadius,int,
103  vtkGetMacro(VaryRadius,int);
105  {this->SetVaryRadius(VTK_VARY_RADIUS_OFF);};
107  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_SCALAR);};
109  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR);};
111  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);};
112  const char *GetVaryRadiusAsString();
114 
116 
118  vtkSetClampMacro(NumberOfSides,int,3,VTK_INT_MAX);
119  vtkGetMacro(NumberOfSides,int);
121 
123 
125  vtkSetMacro(RadiusFactor,double);
126  vtkGetMacro(RadiusFactor,double);
128 
130 
132  vtkSetVector3Macro(DefaultNormal,double);
133  vtkGetVectorMacro(DefaultNormal,double,3);
135 
137 
139  vtkSetMacro(UseDefaultNormal,int);
140  vtkGetMacro(UseDefaultNormal,int);
141  vtkBooleanMacro(UseDefaultNormal,int);
143 
145 
148  vtkSetMacro(SidesShareVertices, int);
149  vtkGetMacro(SidesShareVertices, int);
150  vtkBooleanMacro(SidesShareVertices, int);
152 
154 
156  vtkSetMacro(Capping,int);
157  vtkGetMacro(Capping,int);
158  vtkBooleanMacro(Capping,int);
160 
162 
164  vtkSetClampMacro(OnRatio,int,1,VTK_INT_MAX);
165  vtkGetMacro(OnRatio,int);
167 
169 
172  vtkSetClampMacro(Offset,int,0,VTK_INT_MAX);
173  vtkGetMacro(Offset,int);
175 
177 
181  vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
183  vtkGetMacro(GenerateTCoords,int);
185  {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
187  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
189  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
191  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
192  const char *GetGenerateTCoordsAsString();
194 
196 
200  vtkSetClampMacro(TextureLength,double,0.000001,VTK_INT_MAX);
201  vtkGetMacro(TextureLength,double);
203 
205 
208  vtkSetMacro(OutputPointsPrecision,int);
209  vtkGetMacro(OutputPointsPrecision,int);
211 
212 protected:
213  vtkTubeFilter();
215 
216  // Usual data generation method
218 
219  double Radius; //minimum radius of tube
220  int VaryRadius; //controls radius variation
221  int NumberOfSides; //number of sides to create tube
222  double RadiusFactor; //maxium allowablew radius
223  double DefaultNormal[3];
226  int Capping; //control whether tubes are capped
227  int OnRatio; //control the generation of the sides of the tube
228  int Offset; //control the generation of the sides
229  int GenerateTCoords; //control texture coordinate generation
231  double TextureLength; //this length is mapped to [0,1) texture space
232 
233  // Helper methods
234  int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
235  vtkPoints *inPts, vtkPoints *newPts,
236  vtkPointData *pd, vtkPointData *outPD,
237  vtkFloatArray *newNormals, vtkDataArray *inScalars,
238  double range[2], vtkDataArray *inVectors, double maxNorm,
239  vtkDataArray *inNormals);
240  void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
241  vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
242  vtkCellArray *newStrips);
243  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
244  vtkPoints *inPts, vtkDataArray *inScalars,
245  vtkFloatArray *newTCoords);
246  vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
247 
248  // Helper data members
249  double Theta;
250 
251 private:
252  vtkTubeFilter(const vtkTubeFilter&); // Not implemented.
253  void operator=(const vtkTubeFilter&); // Not implemented.
254 };
255 
256 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:71
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:66
represent and manipulate point attribute data
Definition: vtkPointData.h:36
#define VTK_DOUBLE_MAX
Definition: vtkType.h:142
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
double TextureLength
#define VTKFILTERSCORE_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:132
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
void SetGenerateTCoordsToNormalizedLength()
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:68
int vtkIdType
Definition: vtkType.h:275
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:72
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:82
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:73
void SetVaryRadiusToVaryRadiusByScalar()
double RadiusFactor
int OutputPointsPrecision
void SetVaryRadiusToVaryRadiusByVector()
object to represent cell connectivity
Definition: vtkCellArray.h:49
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:70
void SetGenerateTCoordsToUseLength()
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:67
Store zero or more vtkInformation instances.
void SetGenerateTCoordsToOff()
void SetGenerateTCoordsToUseScalars()
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:65
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
represent and manipulate 3D points
Definition: vtkPoints.h:38
void SetVaryRadiusToVaryRadiusOff()