VTK  9.2.6
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 =========================================================================*/
61 #ifndef vtkTubeFilter_h
62 #define vtkTubeFilter_h
63 
64 #include "vtkFiltersCoreModule.h" // For export macro
65 #include "vtkPolyDataAlgorithm.h"
66 
67 #define VTK_VARY_RADIUS_OFF 0
68 #define VTK_VARY_RADIUS_BY_SCALAR 1
69 #define VTK_VARY_RADIUS_BY_VECTOR 2
70 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
71 #define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
72 
73 #define VTK_TCOORDS_OFF 0
74 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
75 #define VTK_TCOORDS_FROM_LENGTH 2
76 #define VTK_TCOORDS_FROM_SCALARS 3
77 
78 class vtkCellArray;
79 class vtkCellData;
80 class vtkDataArray;
81 class vtkFloatArray;
82 class vtkPointData;
83 class vtkPoints;
84 
85 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
86 {
87 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
95  static vtkTubeFilter* New();
96 
98 
101  vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
102  vtkGetMacro(Radius, double);
104 
106 
109  vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
110  vtkGetMacro(VaryRadius, int);
111  void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
115  {
116  this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
117  }
119  {
120  this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
121  }
122  const char* GetVaryRadiusAsString();
124 
126 
129  vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
130  vtkGetMacro(NumberOfSides, int);
132 
134 
137  vtkSetMacro(RadiusFactor, double);
138  vtkGetMacro(RadiusFactor, double);
140 
142 
146  vtkSetVector3Macro(DefaultNormal, double);
147  vtkGetVectorMacro(DefaultNormal, double, 3);
149 
151 
155  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
156  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
157  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
159 
161 
166  vtkSetMacro(SidesShareVertices, vtkTypeBool);
167  vtkGetMacro(SidesShareVertices, vtkTypeBool);
168  vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
170 
172 
175  vtkSetMacro(Capping, vtkTypeBool);
176  vtkGetMacro(Capping, vtkTypeBool);
177  vtkBooleanMacro(Capping, vtkTypeBool);
179 
181 
186  vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
187  vtkGetMacro(OnRatio, int);
189 
191 
196  vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
197  vtkGetMacro(Offset, int);
199 
201 
207  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
208  vtkGetMacro(GenerateTCoords, int);
209  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
211  {
212  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
213  }
214  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
215  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
216  const char* GetGenerateTCoordsAsString();
218 
220 
226  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
227  vtkGetMacro(TextureLength, double);
229 
231 
236  vtkSetMacro(OutputPointsPrecision, int);
237  vtkGetMacro(OutputPointsPrecision, int);
239 
240 protected:
241  vtkTubeFilter();
242  ~vtkTubeFilter() override = default;
243 
244  // Usual data generation method
246 
247  double Radius; // minimum radius of tube
248  int VaryRadius; // controls radius variation
249  int NumberOfSides; // number of sides to create tube
250  double RadiusFactor; // maximum allowable radius
251  double DefaultNormal[3];
254  vtkTypeBool Capping; // control whether tubes are capped
255  int OnRatio; // control the generation of the sides of the tube
256  int Offset; // control the generation of the sides
257  int GenerateTCoords; // control texture coordinate generation
259  double TextureLength; // this length is mapped to [0,1) texture space
260 
261  // Helper methods
262  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
263  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
264  vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
265  vtkDataArray* inNormals);
266  void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
267  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
268  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
269  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
270  vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
271 
272  // Helper data members
273  double Theta;
274 
275 private:
276  vtkTubeFilter(const vtkTubeFilter&) = delete;
277  void operator=(const vtkTubeFilter&) = delete;
278 };
279 
280 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:74
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:68
represent and manipulate point attribute data
Definition: vtkPointData.h:41
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
double TextureLength
#define VTK_INT_MAX
Definition: vtkType.h:155
represent and manipulate cell attribute data
Definition: vtkCellData.h:41
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:70
int vtkIdType
Definition: vtkType.h:332
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:75
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:85
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:76
void SetVaryRadiusToVaryRadiusByScalar()
Turn on/off the variation of tube radius with scalar value.
vtkTypeBool SidesShareVertices
double RadiusFactor
int OutputPointsPrecision
void SetVaryRadiusToVaryRadiusByVector()
Turn on/off the variation of tube radius with scalar value.
#define VTK_VARY_RADIUS_BY_VECTOR_NORM
Definition: vtkTubeFilter.h:71
object to represent cell connectivity
Definition: vtkCellArray.h:186
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:73
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:69
Store zero or more vtkInformation instances.
vtkTypeBool UseDefaultNormal
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
vtkTypeBool Capping
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:67
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 SetVaryRadiusToVaryRadiusByVectorNorm()
Turn on/off the variation of tube radius with scalar value.
void SetVaryRadiusToVaryRadiusOff()
Turn on/off the variation of tube radius with scalar value.