VTK  9.2.6
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=========================================================================*/
70#ifndef vtkTubeFilter_h
71#define vtkTubeFilter_h
72
73#include "vtkFiltersCoreModule.h" // For export macro
75
76#define VTK_VARY_RADIUS_OFF 0
77#define VTK_VARY_RADIUS_BY_SCALAR 1
78#define VTK_VARY_RADIUS_BY_VECTOR 2
79#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
80#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
81
82#define VTK_TCOORDS_OFF 0
83#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
84#define VTK_TCOORDS_FROM_LENGTH 2
85#define VTK_TCOORDS_FROM_SCALARS 3
86
87class vtkCellArray;
88class vtkCellData;
89class vtkDataArray;
90class vtkFloatArray;
91class vtkPointData;
92class vtkPoints;
93
94class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
95{
96public:
98 void PrintSelf(ostream& os, vtkIndent indent) override;
99
105
107
110 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
111 vtkGetMacro(Radius, double);
113
115
118 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
119 vtkGetMacro(VaryRadius, int);
120 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
124 {
125 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
126 }
128 {
129 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
130 }
133
135
138 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
139 vtkGetMacro(NumberOfSides, int);
141
143
146 vtkSetMacro(RadiusFactor, double);
147 vtkGetMacro(RadiusFactor, double);
149
151
155 vtkSetVector3Macro(DefaultNormal, double);
156 vtkGetVectorMacro(DefaultNormal, double, 3);
158
160
164 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
165 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
166 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
168
170
175 vtkSetMacro(SidesShareVertices, vtkTypeBool);
176 vtkGetMacro(SidesShareVertices, vtkTypeBool);
177 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
179
181
184 vtkSetMacro(Capping, vtkTypeBool);
185 vtkGetMacro(Capping, vtkTypeBool);
186 vtkBooleanMacro(Capping, vtkTypeBool);
188
190
195 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
196 vtkGetMacro(OnRatio, int);
198
200
205 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
206 vtkGetMacro(Offset, int);
208
210
216 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
217 vtkGetMacro(GenerateTCoords, int);
218 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
220 {
221 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
222 }
223 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
224 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
227
229
235 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
236 vtkGetMacro(TextureLength, double);
238
240
245 vtkSetMacro(OutputPointsPrecision, int);
246 vtkGetMacro(OutputPointsPrecision, int);
248
249protected:
251 ~vtkTubeFilter() override = default;
252
253 // Usual data generation method
255
256 double Radius; // minimum radius of tube
257 int VaryRadius; // controls radius variation
258 int NumberOfSides; // number of sides to create tube
259 double RadiusFactor; // maximum allowable radius
260 double DefaultNormal[3];
263 vtkTypeBool Capping; // control whether tubes are capped
264 int OnRatio; // control the generation of the sides of the tube
265 int Offset; // control the generation of the sides
266 int GenerateTCoords; // control texture coordinate generation
268 double TextureLength; // this length is mapped to [0,1) texture space
269
270 // Helper methods
271 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
272 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
273 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
274 vtkDataArray* inNormals);
275 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
276 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
277 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
278 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
280
281 // Helper data members
282 double Theta;
283
284private:
285 vtkTubeFilter(const vtkTubeFilter&) = delete;
286 void operator=(const vtkTubeFilter&) = delete;
287};
288
289#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:51
abstract superclass for arrays of numeric data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:49
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:49
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:69
#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:332
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_INT_MAX
Definition vtkType.h:155