VTK  9.1.0
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=========================================================================*/
64#ifndef vtkTubeFilter_h
65#define vtkTubeFilter_h
66
67#include "vtkFiltersCoreModule.h" // For export macro
69
70#define VTK_VARY_RADIUS_OFF 0
71#define VTK_VARY_RADIUS_BY_SCALAR 1
72#define VTK_VARY_RADIUS_BY_VECTOR 2
73#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
74#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
75
76#define VTK_TCOORDS_OFF 0
77#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
78#define VTK_TCOORDS_FROM_LENGTH 2
79#define VTK_TCOORDS_FROM_SCALARS 3
80
81class vtkCellArray;
82class vtkCellData;
83class vtkDataArray;
84class vtkFloatArray;
85class vtkPointData;
86class vtkPoints;
87
88class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
89{
90public:
92 void PrintSelf(ostream& os, vtkIndent indent) override;
93
98 static vtkTubeFilter* New();
99
101
104 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
105 vtkGetMacro(Radius, double);
107
109
112 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
113 vtkGetMacro(VaryRadius, int);
114 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
118 {
119 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
120 }
122 {
123 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
124 }
127
129
132 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
133 vtkGetMacro(NumberOfSides, int);
135
137
140 vtkSetMacro(RadiusFactor, double);
141 vtkGetMacro(RadiusFactor, double);
143
145
149 vtkSetVector3Macro(DefaultNormal, double);
150 vtkGetVectorMacro(DefaultNormal, double, 3);
152
154
158 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
159 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
160 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
162
164
169 vtkSetMacro(SidesShareVertices, vtkTypeBool);
170 vtkGetMacro(SidesShareVertices, vtkTypeBool);
171 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
173
175
178 vtkSetMacro(Capping, vtkTypeBool);
179 vtkGetMacro(Capping, vtkTypeBool);
180 vtkBooleanMacro(Capping, vtkTypeBool);
182
184
189 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
190 vtkGetMacro(OnRatio, int);
192
194
199 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
200 vtkGetMacro(Offset, int);
202
204
210 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
211 vtkGetMacro(GenerateTCoords, int);
212 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
214 {
215 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
216 }
217 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
218 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
221
223
229 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
230 vtkGetMacro(TextureLength, double);
232
234
239 vtkSetMacro(OutputPointsPrecision, int);
240 vtkGetMacro(OutputPointsPrecision, int);
242
243protected:
245 ~vtkTubeFilter() override = default;
246
247 // Usual data generation method
249
250 double Radius; // minimum radius of tube
251 int VaryRadius; // controls radius variation
252 int NumberOfSides; // number of sides to create tube
253 double RadiusFactor; // maximum allowable radius
254 double DefaultNormal[3];
257 vtkTypeBool Capping; // control whether tubes are capped
258 int OnRatio; // control the generation of the sides of the tube
259 int Offset; // control the generation of the sides
260 int GenerateTCoords; // control texture coordinate generation
262 double TextureLength; // this length is mapped to [0,1) texture space
263
264 // Helper methods
266 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
267 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
268 vtkDataArray* inNormals);
269 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
270 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
272 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
274
275 // Helper data members
276 double Theta;
277
278private:
279 vtkTubeFilter(const vtkTubeFilter&) = delete;
280 void operator=(const vtkTubeFilter&) = delete;
281};
282
283#endif
object to represent cell connectivity
Definition: vtkCellArray.h:190
represent and manipulate cell attribute data
Definition: vtkCellData.h:42
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:42
represent and manipulate 3D points
Definition: vtkPoints.h:43
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:89
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
double TextureLength
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
double RadiusFactor
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int OutputPointsPrecision
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.
@ range
Definition: vtkX3D.h:244
@ offset
Definition: vtkX3D.h:444
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:79
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:71
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:78
#define VTK_VARY_RADIUS_BY_VECTOR_NORM
Definition: vtkTubeFilter.h:74
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:77
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:70
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:72
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:76
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:73
int vtkIdType
Definition: vtkType.h:332
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
#define VTK_INT_MAX
Definition: vtkType.h:155