VTK  9.7.1
vtkTubeFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
49 #ifndef vtkTubeFilter_h
50 #define vtkTubeFilter_h
51 
52 #include "vtkFiltersCoreModule.h" // For export macro
53 #include "vtkPolyDataAlgorithm.h"
54 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
55 
56 #define VTK_VARY_RADIUS_OFF 0
57 #define VTK_VARY_RADIUS_BY_SCALAR 1
58 #define VTK_VARY_RADIUS_BY_VECTOR 2
59 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
60 #define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
61 
62 #define VTK_TCOORDS_OFF 0
63 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
64 #define VTK_TCOORDS_FROM_LENGTH 2
65 #define VTK_TCOORDS_FROM_SCALARS 3
66 
67 VTK_ABI_NAMESPACE_BEGIN
68 class vtkCellArray;
69 class vtkCellData;
70 class vtkDataArray;
71 class vtkFloatArray;
72 class vtkPointData;
73 class vtkPoints;
74 
75 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkTubeFilter : public vtkPolyDataAlgorithm
76 {
77 public:
79  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
85  static vtkTubeFilter* New();
86 
88 
91  vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
92  vtkGetMacro(Radius, double);
94 
96 
99  vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
100  vtkGetMacro(VaryRadius, int);
101  void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
105  {
106  this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
107  }
109  {
110  this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
111  }
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, vtkTypeBool);
146  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
147  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
149 
151 
156  vtkSetMacro(SidesShareVertices, vtkTypeBool);
157  vtkGetMacro(SidesShareVertices, vtkTypeBool);
158  vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
160 
162 
165  vtkSetMacro(Capping, vtkTypeBool);
166  vtkGetMacro(Capping, vtkTypeBool);
167  vtkBooleanMacro(Capping, vtkTypeBool);
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, VTK_TCOORDS_FROM_SCALARS);
198  vtkGetMacro(GenerateTCoords, int);
199  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
201  {
202  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
203  }
204  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
205  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
206  const char* GetGenerateTCoordsAsString();
208 
210 
216  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
217  vtkGetMacro(TextureLength, double);
219 
221 
226  vtkSetMacro(OutputPointsPrecision, int);
227  vtkGetMacro(OutputPointsPrecision, int);
229 
230 protected:
231  vtkTubeFilter();
232  ~vtkTubeFilter() override = default;
233 
234  // Usual data generation method
236 
237  double Radius; // minimum radius of tube
238  int VaryRadius; // controls radius variation
239  int NumberOfSides; // number of sides to create tube
240  double RadiusFactor; // maximum allowable radius
241  double DefaultNormal[3];
244  vtkTypeBool Capping; // control whether tubes are capped
245  int OnRatio; // control the generation of the sides of the tube
246  int Offset; // control the generation of the sides
247  int GenerateTCoords; // control texture coordinate generation
249  double TextureLength; // this length is mapped to [0,1) texture space
250 
251  // Helper methods
252  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
253  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
254  vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
255  vtkDataArray* inNormals);
256  void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
257  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
258  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
259  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
260  vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
261 
262  // Helper data members
263  double Theta;
264 
265 private:
266  vtkTubeFilter(const vtkTubeFilter&) = delete;
267  void operator=(const vtkTubeFilter&) = delete;
268 };
269 
270 VTK_ABI_NAMESPACE_END
271 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:63
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:57
represent and manipulate point attribute data
Definition: vtkPointData.h:30
#define VTK_DOUBLE_MAX
Definition: vtkType.h:202
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:192
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:59
int vtkIdType
Definition: vtkType.h:363
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:64
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:75
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:65
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:60
object to represent cell connectivity
Definition: vtkCellArray.h:177
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:62
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:58
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
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:56
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
represent and manipulate 3D points
Definition: vtkPoints.h:30
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.