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 =========================================================================*/
54 #ifndef vtkTubeFilter_h
55 #define vtkTubeFilter_h
56 
57 #include "vtkFiltersCoreModule.h" // For export macro
58 #include "vtkPolyDataAlgorithm.h"
59 
60 #define VTK_VARY_RADIUS_OFF 0
61 #define VTK_VARY_RADIUS_BY_SCALAR 1
62 #define VTK_VARY_RADIUS_BY_VECTOR 2
63 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
64 
65 #define VTK_TCOORDS_OFF 0
66 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
67 #define VTK_TCOORDS_FROM_LENGTH 2
68 #define VTK_TCOORDS_FROM_SCALARS 3
69 
70 class vtkCellArray;
71 class vtkCellData;
72 class vtkDataArray;
73 class vtkFloatArray;
74 class vtkPointData;
75 class vtkPoints;
76 
77 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
78 {
79 public:
81  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
82 
87  static vtkTubeFilter *New();
88 
90 
93  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
94  vtkGetMacro(Radius,double);
96 
98 
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 
119  vtkSetClampMacro(NumberOfSides,int,3,VTK_INT_MAX);
120  vtkGetMacro(NumberOfSides,int);
122 
124 
127  vtkSetMacro(RadiusFactor,double);
128  vtkGetMacro(RadiusFactor,double);
130 
132 
136  vtkSetVector3Macro(DefaultNormal,double);
137  vtkGetVectorMacro(DefaultNormal,double,3);
139 
141 
145  vtkSetMacro(UseDefaultNormal,int);
146  vtkGetMacro(UseDefaultNormal,int);
147  vtkBooleanMacro(UseDefaultNormal,int);
149 
151 
156  vtkSetMacro(SidesShareVertices, int);
157  vtkGetMacro(SidesShareVertices, int);
158  vtkBooleanMacro(SidesShareVertices, int);
160 
162 
165  vtkSetMacro(Capping,int);
166  vtkGetMacro(Capping,int);
167  vtkBooleanMacro(Capping,int);
169 
171 
176  vtkSetClampMacro(OnRatio,int,1,VTK_INT_MAX);
177  vtkGetMacro(OnRatio,int);
179 
181 
186  vtkSetClampMacro(Offset,int,0,VTK_INT_MAX);
187  vtkGetMacro(Offset,int);
189 
191 
197  vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
199  vtkGetMacro(GenerateTCoords,int);
201  {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
203  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
205  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
207  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
208  const char *GetGenerateTCoordsAsString();
210 
212 
218  vtkSetClampMacro(TextureLength,double,0.000001,VTK_INT_MAX);
219  vtkGetMacro(TextureLength,double);
221 
223 
228  vtkSetMacro(OutputPointsPrecision,int);
229  vtkGetMacro(OutputPointsPrecision,int);
231 
232 protected:
233  vtkTubeFilter();
234  ~vtkTubeFilter() VTK_OVERRIDE {}
235 
236  // Usual data generation method
238 
239  double Radius; //minimum radius of tube
240  int VaryRadius; //controls radius variation
241  int NumberOfSides; //number of sides to create tube
242  double RadiusFactor; //maxium allowablew radius
243  double DefaultNormal[3];
244  int UseDefaultNormal;
245  int SidesShareVertices;
246  int Capping; //control whether tubes are capped
247  int OnRatio; //control the generation of the sides of the tube
248  int Offset; //control the generation of the sides
249  int GenerateTCoords; //control texture coordinate generation
250  int OutputPointsPrecision;
251  double TextureLength; //this length is mapped to [0,1) texture space
252 
253  // Helper methods
254  int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
255  vtkPoints *inPts, vtkPoints *newPts,
256  vtkPointData *pd, vtkPointData *outPD,
257  vtkFloatArray *newNormals, vtkDataArray *inScalars,
258  double range[2], vtkDataArray *inVectors, double maxNorm,
259  vtkDataArray *inNormals);
260  void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
261  vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
262  vtkCellArray *newStrips);
263  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
264  vtkPoints *inPts, vtkDataArray *inScalars,
265  vtkFloatArray *newTCoords);
266  vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
267 
268  // Helper data members
269  double Theta;
270 
271 private:
272  vtkTubeFilter(const vtkTubeFilter&) VTK_DELETE_FUNCTION;
273  void operator=(const vtkTubeFilter&) VTK_DELETE_FUNCTION;
274 };
275 
276 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:66
~vtkTubeFilter() override
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:61
represent and manipulate point attribute data
Definition: vtkPointData.h:31
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
#define VTK_INT_MAX
Definition: vtkType.h:157
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:63
int vtkIdType
Definition: vtkType.h:345
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:67
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:77
a simple class to control print indentation
Definition: vtkIndent.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:68
void SetVaryRadiusToVaryRadiusByScalar()
Turn on/off the variation of tube radius with scalar value.
void SetVaryRadiusToVaryRadiusByVector()
Turn on/off the variation of tube radius with scalar value.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
object to represent cell connectivity
Definition: vtkCellArray.h:44
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:65
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:62
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:60
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
represent and manipulate 3D points
Definition: vtkPoints.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetVaryRadiusToVaryRadiusOff()
Turn on/off the variation of tube radius with scalar value.