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
49#ifndef vtkTubeFilter_h
50#define vtkTubeFilter_h
51
52#include "vtkFiltersCoreModule.h" // For export macro
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
66VTK_ABI_NAMESPACE_BEGIN
67class vtkCellArray;
68class vtkCellData;
69class vtkDataArray;
70class vtkFloatArray;
71class vtkPointData;
72class vtkPoints;
73
74class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
75{
76public:
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 }
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); }
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
229protected:
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);
260
261 // Helper data members
262 double Theta;
263
264private:
265 vtkTubeFilter(const vtkTubeFilter&) = delete;
266 void operator=(const vtkTubeFilter&) = delete;
267};
268
269VTK_ABI_NAMESPACE_END
270#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:31
abstract superclass for arrays of numeric data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:29
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:29
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