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 =========================================================================*/
60 #ifndef vtkTubeFilter_h
61 #define vtkTubeFilter_h
62 
63 #include "vtkFiltersCoreModule.h" // For export macro
64 #include "vtkPolyDataAlgorithm.h"
65 
66 #define VTK_VARY_RADIUS_OFF 0
67 #define VTK_VARY_RADIUS_BY_SCALAR 1
68 #define VTK_VARY_RADIUS_BY_VECTOR 2
69 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
70 
71 #define VTK_TCOORDS_OFF 0
72 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
73 #define VTK_TCOORDS_FROM_LENGTH 2
74 #define VTK_TCOORDS_FROM_SCALARS 3
75 
76 class vtkCellArray;
77 class vtkCellData;
78 class vtkDataArray;
79 class vtkFloatArray;
80 class vtkPointData;
81 class vtkPoints;
82 
83 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
84 {
85 public:
87  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
88 
93  static vtkTubeFilter *New();
94 
96 
99  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
100  vtkGetMacro(Radius,double);
102 
104 
107  vtkSetClampMacro(VaryRadius,int,
109  vtkGetMacro(VaryRadius,int);
111  {this->SetVaryRadius(VTK_VARY_RADIUS_OFF);};
113  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_SCALAR);};
115  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR);};
117  {this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);};
118  const char *GetVaryRadiusAsString();
120 
122 
125  vtkSetClampMacro(NumberOfSides,int,3,VTK_INT_MAX);
126  vtkGetMacro(NumberOfSides,int);
128 
130 
133  vtkSetMacro(RadiusFactor,double);
134  vtkGetMacro(RadiusFactor,double);
136 
138 
142  vtkSetVector3Macro(DefaultNormal,double);
143  vtkGetVectorMacro(DefaultNormal,double,3);
145 
147 
151  vtkSetMacro(UseDefaultNormal,int);
152  vtkGetMacro(UseDefaultNormal,int);
153  vtkBooleanMacro(UseDefaultNormal,int);
155 
157 
162  vtkSetMacro(SidesShareVertices, int);
163  vtkGetMacro(SidesShareVertices, int);
164  vtkBooleanMacro(SidesShareVertices, int);
166 
168 
171  vtkSetMacro(Capping,int);
172  vtkGetMacro(Capping,int);
173  vtkBooleanMacro(Capping,int);
175 
177 
182  vtkSetClampMacro(OnRatio,int,1,VTK_INT_MAX);
183  vtkGetMacro(OnRatio,int);
185 
187 
192  vtkSetClampMacro(Offset,int,0,VTK_INT_MAX);
193  vtkGetMacro(Offset,int);
195 
197 
203  vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
205  vtkGetMacro(GenerateTCoords,int);
207  {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
209  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
211  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
213  {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
214  const char *GetGenerateTCoordsAsString();
216 
218 
224  vtkSetClampMacro(TextureLength,double,0.000001,VTK_INT_MAX);
225  vtkGetMacro(TextureLength,double);
227 
229 
234  vtkSetMacro(OutputPointsPrecision,int);
235  vtkGetMacro(OutputPointsPrecision,int);
237 
238 protected:
239  vtkTubeFilter();
240  ~vtkTubeFilter() VTK_OVERRIDE {}
241 
242  // Usual data generation method
244 
245  double Radius; //minimum radius of tube
246  int VaryRadius; //controls radius variation
247  int NumberOfSides; //number of sides to create tube
248  double RadiusFactor; //maxium allowablew radius
249  double DefaultNormal[3];
250  int UseDefaultNormal;
251  int SidesShareVertices;
252  int Capping; //control whether tubes are capped
253  int OnRatio; //control the generation of the sides of the tube
254  int Offset; //control the generation of the sides
255  int GenerateTCoords; //control texture coordinate generation
256  int OutputPointsPrecision;
257  double TextureLength; //this length is mapped to [0,1) texture space
258 
259  // Helper methods
260  int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
261  vtkPoints *inPts, vtkPoints *newPts,
262  vtkPointData *pd, vtkPointData *outPD,
263  vtkFloatArray *newNormals, vtkDataArray *inScalars,
264  double range[2], vtkDataArray *inVectors, double maxNorm,
265  vtkDataArray *inNormals);
266  void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
267  vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
268  vtkCellArray *newStrips);
269  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
270  vtkPoints *inPts, vtkDataArray *inScalars,
271  vtkFloatArray *newTCoords);
272  vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);
273 
274  // Helper data members
275  double Theta;
276 
277 private:
278  vtkTubeFilter(const vtkTubeFilter&) VTK_DELETE_FUNCTION;
279  void operator=(const vtkTubeFilter&) VTK_DELETE_FUNCTION;
280 };
281 
282 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:72
~vtkTubeFilter() override
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:67
represent and manipulate point attribute data
Definition: vtkPointData.h:37
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163
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:153
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:69
int vtkIdType
Definition: vtkType.h:287
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:73
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:83
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:74
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:50
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:71
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:68
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:66
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
represent and manipulate 3D points
Definition: vtkPoints.h:39
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.