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=========================================================================*/
61#ifndef vtkTubeFilter_h
62#define vtkTubeFilter_h
63
64#include "vtkFiltersCoreModule.h" // For export macro
66
67#define VTK_VARY_RADIUS_OFF 0
68#define VTK_VARY_RADIUS_BY_SCALAR 1
69#define VTK_VARY_RADIUS_BY_VECTOR 2
70#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
71#define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
72
73#define VTK_TCOORDS_OFF 0
74#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
75#define VTK_TCOORDS_FROM_LENGTH 2
76#define VTK_TCOORDS_FROM_SCALARS 3
77
78class vtkCellArray;
79class vtkCellData;
80class vtkDataArray;
81class vtkFloatArray;
82class vtkPointData;
83class vtkPoints;
84
85class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
86{
87public:
89 void PrintSelf(ostream& os, vtkIndent indent) override;
90
95 static vtkTubeFilter* New();
96
98
101 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
102 vtkGetMacro(Radius, double);
104
106
109 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
110 vtkGetMacro(VaryRadius, int);
111 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
115 {
116 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
117 }
119 {
120 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
121 }
124
126
129 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
130 vtkGetMacro(NumberOfSides, int);
132
134
137 vtkSetMacro(RadiusFactor, double);
138 vtkGetMacro(RadiusFactor, double);
140
142
146 vtkSetVector3Macro(DefaultNormal, double);
147 vtkGetVectorMacro(DefaultNormal, double, 3);
149
151
155 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
156 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
157 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
159
161
166 vtkSetMacro(SidesShareVertices, vtkTypeBool);
167 vtkGetMacro(SidesShareVertices, vtkTypeBool);
168 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
170
172
175 vtkSetMacro(Capping, vtkTypeBool);
176 vtkGetMacro(Capping, vtkTypeBool);
177 vtkBooleanMacro(Capping, vtkTypeBool);
179
181
186 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
187 vtkGetMacro(OnRatio, int);
189
191
196 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
197 vtkGetMacro(Offset, int);
199
201
207 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
208 vtkGetMacro(GenerateTCoords, int);
209 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
211 {
212 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
213 }
214 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
215 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
218
220
226 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
227 vtkGetMacro(TextureLength, double);
229
231
236 vtkSetMacro(OutputPointsPrecision, int);
237 vtkGetMacro(OutputPointsPrecision, int);
239
240protected:
242 ~vtkTubeFilter() override = default;
243
244 // Usual data generation method
246
247 double Radius; // minimum radius of tube
248 int VaryRadius; // controls radius variation
249 int NumberOfSides; // number of sides to create tube
250 double RadiusFactor; // maximum allowable radius
251 double DefaultNormal[3];
254 vtkTypeBool Capping; // control whether tubes are capped
255 int OnRatio; // control the generation of the sides of the tube
256 int Offset; // control the generation of the sides
257 int GenerateTCoords; // control texture coordinate generation
259 double TextureLength; // this length is mapped to [0,1) texture space
260
261 // Helper methods
262 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
263 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
264 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
265 vtkDataArray* inNormals);
266 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
267 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
268 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
269 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
271
272 // Helper data members
273 double Theta;
274
275private:
276 vtkTubeFilter(const vtkTubeFilter&) = delete;
277 void operator=(const vtkTubeFilter&) = delete;
278};
279
280#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:42
abstract superclass for arrays of numeric data
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:40
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:40
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