VTK  9.3.0
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
58#ifndef vtkTubeFilter_h
59#define vtkTubeFilter_h
60
61#include "vtkFiltersCoreModule.h" // For export macro
63
64#define VTK_VARY_RADIUS_OFF 0
65#define VTK_VARY_RADIUS_BY_SCALAR 1
66#define VTK_VARY_RADIUS_BY_VECTOR 2
67#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
68#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
69
70#define VTK_TCOORDS_OFF 0
71#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
72#define VTK_TCOORDS_FROM_LENGTH 2
73#define VTK_TCOORDS_FROM_SCALARS 3
74
75VTK_ABI_NAMESPACE_BEGIN
76class vtkCellArray;
77class vtkCellData;
78class vtkDataArray;
79class vtkFloatArray;
80class vtkPointData;
81class vtkPoints;
82
83class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
84{
85public:
87 void PrintSelf(ostream& os, vtkIndent indent) 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, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
108 vtkGetMacro(VaryRadius, int);
109 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
113 {
114 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
115 }
117 {
118 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
119 }
122
124
127 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
128 vtkGetMacro(NumberOfSides, int);
130
132
135 vtkSetMacro(RadiusFactor, double);
136 vtkGetMacro(RadiusFactor, double);
138
140
144 vtkSetVector3Macro(DefaultNormal, double);
145 vtkGetVectorMacro(DefaultNormal, double, 3);
147
149
153 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
154 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
155 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
157
159
164 vtkSetMacro(SidesShareVertices, vtkTypeBool);
165 vtkGetMacro(SidesShareVertices, vtkTypeBool);
166 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
168
170
173 vtkSetMacro(Capping, vtkTypeBool);
174 vtkGetMacro(Capping, vtkTypeBool);
175 vtkBooleanMacro(Capping, vtkTypeBool);
177
179
184 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
185 vtkGetMacro(OnRatio, int);
187
189
194 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
195 vtkGetMacro(Offset, int);
197
199
205 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
206 vtkGetMacro(GenerateTCoords, int);
207 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
209 {
210 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
211 }
212 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
213 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
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
238protected:
240 ~vtkTubeFilter() override = default;
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; // maximum allowable radius
249 double DefaultNormal[3];
252 vtkTypeBool 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
257 double TextureLength; // this length is mapped to [0,1) texture space
258
259 // Helper methods
260 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
261 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
262 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
263 vtkDataArray* inNormals);
264 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
265 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
266 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
267 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
269
270 // Helper data members
271 double Theta;
272
273private:
274 vtkTubeFilter(const vtkTubeFilter&) = delete;
275 void operator=(const vtkTubeFilter&) = delete;
276};
277
278VTK_ABI_NAMESPACE_END
279#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:40
abstract superclass for arrays of numeric data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:38
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
void SetVaryRadiusToVaryRadiusByVectorNorm()
Turn on/off the variation of tube radius with scalar value.
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
vtkTypeBool UseDefaultNormal
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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 maxSpeed, vtkDataArray *inNormals)
void SetVaryRadiusToVaryRadiusByVector()
Turn on/off the variation of tube radius with scalar value.
vtkTypeBool SidesShareVertices
vtkTypeBool Capping
vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts)
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
void SetVaryRadiusToVaryRadiusByScalar()
Turn on/off the variation of tube radius with scalar value.
static vtkTubeFilter * New()
Construct object with radius 0.5, radius variation turned off, the number of sides set to 3,...
~vtkTubeFilter() override=default
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
void SetVaryRadiusToVaryRadiusOff()
Turn on/off the variation of tube radius with scalar value.
void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newStrips)
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.
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
const char * GetVaryRadiusAsString()
Turn on/off the variation of tube radius with scalar value.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_TCOORDS_FROM_SCALARS
#define VTK_VARY_RADIUS_BY_SCALAR
#define VTK_TCOORDS_FROM_LENGTH
#define VTK_VARY_RADIUS_BY_VECTOR_NORM
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_VARY_RADIUS_OFF
#define VTK_VARY_RADIUS_BY_VECTOR
#define VTK_TCOORDS_OFF
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
int vtkIdType
Definition vtkType.h:315
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_INT_MAX
Definition vtkType.h:144