VTK  9.3.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 
55 #define VTK_VARY_RADIUS_OFF 0
56 #define VTK_VARY_RADIUS_BY_SCALAR 1
57 #define VTK_VARY_RADIUS_BY_VECTOR 2
58 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
59 #define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
60 
61 #define VTK_TCOORDS_OFF 0
62 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
63 #define VTK_TCOORDS_FROM_LENGTH 2
64 #define VTK_TCOORDS_FROM_SCALARS 3
65 
66 VTK_ABI_NAMESPACE_BEGIN
67 class vtkCellArray;
68 class vtkCellData;
69 class vtkDataArray;
70 class vtkFloatArray;
71 class vtkPointData;
72 class vtkPoints;
73 
74 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
75 {
76 public:
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
84  static vtkTubeFilter* New();
85 
87 
90  vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
91  vtkGetMacro(Radius, double);
93 
95 
98  vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
99  vtkGetMacro(VaryRadius, int);
100  void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
104  {
105  this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
106  }
108  {
109  this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
110  }
111  const char* GetVaryRadiusAsString();
113 
115 
118  vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
119  vtkGetMacro(NumberOfSides, int);
121 
123 
126  vtkSetMacro(RadiusFactor, double);
127  vtkGetMacro(RadiusFactor, double);
129 
131 
135  vtkSetVector3Macro(DefaultNormal, double);
136  vtkGetVectorMacro(DefaultNormal, double, 3);
138 
140 
144  vtkSetMacro(UseDefaultNormal, vtkTypeBool);
145  vtkGetMacro(UseDefaultNormal, vtkTypeBool);
146  vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
148 
150 
155  vtkSetMacro(SidesShareVertices, vtkTypeBool);
156  vtkGetMacro(SidesShareVertices, vtkTypeBool);
157  vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
159 
161 
164  vtkSetMacro(Capping, vtkTypeBool);
165  vtkGetMacro(Capping, vtkTypeBool);
166  vtkBooleanMacro(Capping, vtkTypeBool);
168 
170 
175  vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
176  vtkGetMacro(OnRatio, int);
178 
180 
185  vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
186  vtkGetMacro(Offset, int);
188 
190 
196  vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
197  vtkGetMacro(GenerateTCoords, int);
198  void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
200  {
201  this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
202  }
203  void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
204  void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
205  const char* GetGenerateTCoordsAsString();
207 
209 
215  vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
216  vtkGetMacro(TextureLength, double);
218 
220 
225  vtkSetMacro(OutputPointsPrecision, int);
226  vtkGetMacro(OutputPointsPrecision, int);
228 
229 protected:
230  vtkTubeFilter();
231  ~vtkTubeFilter() override = default;
232 
233  // Usual data generation method
235 
236  double Radius; // minimum radius of tube
237  int VaryRadius; // controls radius variation
238  int NumberOfSides; // number of sides to create tube
239  double RadiusFactor; // maximum allowable radius
240  double DefaultNormal[3];
243  vtkTypeBool Capping; // control whether tubes are capped
244  int OnRatio; // control the generation of the sides of the tube
245  int Offset; // control the generation of the sides
246  int GenerateTCoords; // control texture coordinate generation
248  double TextureLength; // this length is mapped to [0,1) texture space
249 
250  // Helper methods
251  int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
252  vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
253  vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
254  vtkDataArray* inNormals);
255  void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
256  vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
257  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
258  vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
259  vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
260 
261  // Helper data members
262  double Theta;
263 
264 private:
265  vtkTubeFilter(const vtkTubeFilter&) = delete;
266  void operator=(const vtkTubeFilter&) = delete;
267 };
268 
269 VTK_ABI_NAMESPACE_END
270 #endif
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:62
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:56
represent and manipulate point attribute data
Definition: vtkPointData.h:29
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
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:144
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:58
int vtkIdType
Definition: vtkType.h:315
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:63
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:74
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:64
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:59
object to represent cell connectivity
Definition: vtkCellArray.h:175
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:61
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:57
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:55
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
represent and manipulate 3D points
Definition: vtkPoints.h:28
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.