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=========================================================================*/
55#ifndef vtkTubeFilter_h
56#define vtkTubeFilter_h
57
58#include "vtkFiltersCoreModule.h" // For export macro
60
61#define VTK_VARY_RADIUS_OFF 0
62#define VTK_VARY_RADIUS_BY_SCALAR 1
63#define VTK_VARY_RADIUS_BY_VECTOR 2
64#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
65#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
66
67#define VTK_TCOORDS_OFF 0
68#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
69#define VTK_TCOORDS_FROM_LENGTH 2
70#define VTK_TCOORDS_FROM_SCALARS 3
71
72class vtkCellArray;
73class vtkCellData;
74class vtkDataArray;
75class vtkFloatArray;
76class vtkPointData;
77class vtkPoints;
78
79class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
80{
81public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89 static vtkTubeFilter* New();
90
92
95 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
96 vtkGetMacro(Radius, double);
98
100
103 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
104 vtkGetMacro(VaryRadius, int);
105 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
109 {
110 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
111 }
113 {
114 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
115 }
118
120
123 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
124 vtkGetMacro(NumberOfSides, int);
126
128
131 vtkSetMacro(RadiusFactor, double);
132 vtkGetMacro(RadiusFactor, double);
134
136
140 vtkSetVector3Macro(DefaultNormal, double);
141 vtkGetVectorMacro(DefaultNormal, double, 3);
143
145
149 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
150 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
151 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
153
155
160 vtkSetMacro(SidesShareVertices, vtkTypeBool);
161 vtkGetMacro(SidesShareVertices, vtkTypeBool);
162 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
164
166
169 vtkSetMacro(Capping, vtkTypeBool);
170 vtkGetMacro(Capping, vtkTypeBool);
171 vtkBooleanMacro(Capping, vtkTypeBool);
173
175
180 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
181 vtkGetMacro(OnRatio, int);
183
185
190 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
191 vtkGetMacro(Offset, int);
193
195
201 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
202 vtkGetMacro(GenerateTCoords, int);
203 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
205 {
206 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
207 }
208 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
209 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
212
214
220 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
221 vtkGetMacro(TextureLength, double);
223
225
230 vtkSetMacro(OutputPointsPrecision, int);
231 vtkGetMacro(OutputPointsPrecision, int);
233
234protected:
236 ~vtkTubeFilter() override = default;
237
238 // Usual data generation method
240
241 double Radius; // minimum radius of tube
242 int VaryRadius; // controls radius variation
243 int NumberOfSides; // number of sides to create tube
244 double RadiusFactor; // maximum allowable radius
245 double DefaultNormal[3];
248 vtkTypeBool Capping; // control whether tubes are capped
249 int OnRatio; // control the generation of the sides of the tube
250 int Offset; // control the generation of the sides
251 int GenerateTCoords; // control texture coordinate generation
253 double TextureLength; // this length is mapped to [0,1) texture space
254
255 // Helper methods
256 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
257 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
258 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
259 vtkDataArray* inNormals);
260 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
261 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
262 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
263 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
265
266 // Helper data members
267 double Theta;
268
269private:
270 vtkTubeFilter(const vtkTubeFilter&) = delete;
271 void operator=(const vtkTubeFilter&) = delete;
272};
273
274#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:36
abstract superclass for arrays of numeric data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:34
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:34
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