VTK  9.0.3
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) 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, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
102  vtkGetMacro(VaryRadius, int);
103  void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
107  {
108  this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
109  }
110  const char* GetVaryRadiusAsString();
112 
114 
117  vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
118  vtkGetMacro(NumberOfSides, int);
120 
122 
125  vtkSetMacro(RadiusFactor, double);
126  vtkGetMacro(RadiusFactor, double);
128 
130 
134  vtkSetVector3Macro(DefaultNormal, double);
135  vtkGetVectorMacro(DefaultNormal, double, 3);
137 
139 
143  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
144  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
145  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
147 
149 
154  vtkSetMacro(SidesShareVertices, vtkTypeBool);
155  vtkGetMacro(SidesShareVertices, vtkTypeBool);
156  vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
158 
160 
163  vtkSetMacro(Capping, vtkTypeBool);
164  vtkGetMacro(Capping, vtkTypeBool);
165  vtkBooleanMacro(Capping, vtkTypeBool);
167 
169 
174  vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
175  vtkGetMacro(OnRatio, int);
177 
179 
184  vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
185  vtkGetMacro(Offset, int);
187 
189 
195  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
196  vtkGetMacro(GenerateTCoords, int);
197  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
199  {
200  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
201  }
202  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
203  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
206 
208 
214  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
215  vtkGetMacro(TextureLength, double);
217 
219 
224  vtkSetMacro(OutputPointsPrecision, int);
225  vtkGetMacro(OutputPointsPrecision, int);
227 
228 protected:
230  ~vtkTubeFilter() override {}
231 
232  // Usual data generation method
234 
235  double Radius; // minimum radius of tube
236  int VaryRadius; // controls radius variation
237  int NumberOfSides; // number of sides to create tube
238  double RadiusFactor; // maximum allowable radius
239  double DefaultNormal[3];
242  vtkTypeBool Capping; // control whether tubes are capped
243  int OnRatio; // control the generation of the sides of the tube
244  int Offset; // control the generation of the sides
245  int GenerateTCoords; // control texture coordinate generation
247  double TextureLength; // this length is mapped to [0,1) texture space
248 
249  // Helper methods
251  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
252  vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxNorm,
253  vtkDataArray* inNormals);
254  void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
255  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
257  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
259 
260  // Helper data members
261  double Theta;
262 
263 private:
264  vtkTubeFilter(const vtkTubeFilter&) = delete;
265  void operator=(const vtkTubeFilter&) = delete;
266 };
267 
268 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:180
represent and manipulate cell attribute data
Definition: vtkCellData.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:32
represent and manipulate 3D points
Definition: vtkPoints.h:34
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:78
void SetGenerateTCoordsToNormalizedLength()
const char * GetGenerateTCoordsAsString()
static vtkTubeFilter * New()
Construct object with radius 0.5, radius variation turned off, the number of sides set to 3,...
double TextureLength
void SetGenerateTCoordsToOff()
void SetGenerateTCoordsToUseScalars()
vtkTypeBool UseDefaultNormal
double RadiusFactor
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int OutputPointsPrecision
void SetVaryRadiusToVaryRadiusByVector()
~vtkTubeFilter() override
const char * GetVaryRadiusAsString()
vtkTypeBool SidesShareVertices
vtkTypeBool Capping
vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts)
void SetGenerateTCoordsToUseLength()
void SetVaryRadiusToVaryRadiusByScalar()
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
void SetVaryRadiusToVaryRadiusOff()
void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newStrips)
int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkPoints *newPts, vtkPointData *pd, vtkPointData *outPD, vtkFloatArray *newNormals, vtkDataArray *inScalars, double range[2], vtkDataArray *inVectors, double maxNorm, vtkDataArray *inNormals)
void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkDataArray *inScalars, vtkFloatArray *newTCoords)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
@ range
Definition: vtkX3D.h:244
@ offset
Definition: vtkX3D.h:444
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:68
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:61
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:67
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:66
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:60
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:62
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:65
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:63
int vtkIdType
Definition: vtkType.h:338
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
#define VTK_INT_MAX
Definition: vtkType.h:155