VTK: Filters/Core/vtkTubeFilter.h Source File

| VTK 9.3.1

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
58 #ifndef vtkTubeFilter_h
59 #define vtkTubeFilter_h
60
61 #include "vtkFiltersCoreModule.h" // For export macro
62 #include "vtkPolyDataAlgorithm.h"
63
64 #define VTK_VARY_RADIUS_OFF 0
65 #define VTK_VARY_RADIUS_BY_SCALAR 1
66 #define VTK_VARY_RADIUS_BY_VECTOR 2
67 #define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3
68 #define VTK_VARY_RADIUS_BY_VECTOR_NORM 4
69
70 #define VTK_TCOORDS_OFF 0
71 #define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
72 #define VTK_TCOORDS_FROM_LENGTH 2
73 #define VTK_TCOORDS_FROM_SCALARS 3
74
75 VTK_ABI_NAMESPACE_BEGIN
76 class vtkCellArray;
77 class vtkCellData;
78 class vtkDataArray;
79 class vtkFloatArray;
80 class vtkPointData;
81 class vtkPoints;
82
83 class VTKFILTERSCORE_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
84 {
85 public:
86 vtkTypeMacro(vtkTubeFilter, vtkPolyDataAlgorithm);
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
93 static vtkTubeFilter* New();
94
96
99 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
100 vtkGetMacro(Radius, double);
102
104
107 vtkSetClampMacro(VaryRadius, int, VTK_VARY_RADIUS_OFF, VTK_VARY_RADIUS_BY_VECTOR_NORM);
108 vtkGetMacro(VaryRadius, int);
109 void SetVaryRadiusToVaryRadiusOff() { this->SetVaryRadius(VTK_VARY_RADIUS_OFF); }
110 void SetVaryRadiusToVaryRadiusByScalar() { this->SetVaryRadius(VTK_VARY_RADIUS_BY_SCALAR); }
111 void SetVaryRadiusToVaryRadiusByVector() { this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR); }
112 void SetVaryRadiusToVaryRadiusByVectorNorm()
113 {
114 this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR_NORM);
115 }
116 void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
117 {
118 this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
119 }
120 const char* GetVaryRadiusAsString();
122
124
127 vtkSetClampMacro(NumberOfSides, int, 3, VTK_INT_MAX);
128 vtkGetMacro(NumberOfSides, int);
130
132
135 vtkSetMacro(RadiusFactor, double);
136 vtkGetMacro(RadiusFactor, double);
138
140
144 vtkSetVector3Macro(DefaultNormal, double);
145 vtkGetVectorMacro(DefaultNormal, double, 3);
147
149
153 vtkSetMacro(UseDefaultNormal, vtkTypeBool);
154 vtkGetMacro(UseDefaultNormal, vtkTypeBool);
155 vtkBooleanMacro(UseDefaultNormal, vtkTypeBool);
157
159
164 vtkSetMacro(SidesShareVertices, vtkTypeBool);
165 vtkGetMacro(SidesShareVertices, vtkTypeBool);
166 vtkBooleanMacro(SidesShareVertices, vtkTypeBool);
168
170
173 vtkSetMacro(Capping, vtkTypeBool);
174 vtkGetMacro(Capping, vtkTypeBool);
175 vtkBooleanMacro(Capping, vtkTypeBool);
177
179
184 vtkSetClampMacro(OnRatio, int, 1, VTK_INT_MAX);
185 vtkGetMacro(OnRatio, int);
187
189
194 vtkSetClampMacro(Offset, int, 0, VTK_INT_MAX);
195 vtkGetMacro(Offset, int);
197
199
205 vtkSetClampMacro(GenerateTCoords, int, VTK_TCOORDS_OFF, VTK_TCOORDS_FROM_SCALARS);
206 vtkGetMacro(GenerateTCoords, int);
207 void SetGenerateTCoordsToOff() { this->SetGenerateTCoords(VTK_TCOORDS_OFF); }
208 void SetGenerateTCoordsToNormalizedLength()
209 {
210 this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);
211 }
212 void SetGenerateTCoordsToUseLength() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH); }
213 void SetGenerateTCoordsToUseScalars() { this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS); }
214 const char* GetGenerateTCoordsAsString();
216
218
224 vtkSetClampMacro(TextureLength, double, 0.000001, VTK_INT_MAX);
225 vtkGetMacro(TextureLength, double);
227
229
234 vtkSetMacro(OutputPointsPrecision, int);
235 vtkGetMacro(OutputPointsPrecision, int);
237
238 protected:
239 vtkTubeFilter();
240 ~vtkTubeFilter() override = default;
241
242 // Usual data generation method
243 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
244
245 double Radius; // minimum radius of tube
246 int VaryRadius; // controls radius variation
247 int NumberOfSides; // number of sides to create tube
248 double RadiusFactor; // maximum allowable radius
249 double DefaultNormal[3];
250 vtkTypeBool UseDefaultNormal;
251 vtkTypeBool SidesShareVertices;
252 vtkTypeBool Capping; // control whether tubes are capped
253 int OnRatio; // control the generation of the sides of the tube
254 int Offset; // control the generation of the sides
255 int GenerateTCoords; // control texture coordinate generation
256 int OutputPointsPrecision;
257 double TextureLength; // this length is mapped to [0,1) texture space
258
259 // Helper methods
260 int GeneratePoints(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkPoints* inPts,
261 vtkPoints* newPts, vtkPointData* pd, vtkPointData* outPD, vtkFloatArray* newNormals,
262 vtkDataArray* inScalars, double range[2], vtkDataArray* inVectors, double maxSpeed,
263 vtkDataArray* inNormals);
264 void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType* pts, vtkIdType inCellId,
265 vtkCellData* cd, vtkCellData* outCD, vtkCellArray* newStrips);
266 void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType* pts,
267 vtkPoints* inPts, vtkDataArray* inScalars, vtkFloatArray* newTCoords);
268 vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts);
269
270 // Helper data members
271 double Theta;
272
273 private:
274 vtkTubeFilter(const vtkTubeFilter&) = delete;
275 void operator=(const vtkTubeFilter&) = delete;
276 };
277
278 VTK_ABI_NAMESPACE_END
279 #endif
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:40
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:39
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:43
vtkTubeFilter
filter that generates tubes around lines
Definition: vtkTubeFilter.h:84
vtkTubeFilter::SetGenerateTCoordsToNormalizedLength
void SetGenerateTCoordsToNormalizedLength()
Control whether and how texture coordinates are produced.
Definition: vtkTubeFilter.h:208
vtkTubeFilter::GetGenerateTCoordsAsString
const char * GetGenerateTCoordsAsString()
Control whether and how texture coordinates are produced.
vtkTubeFilter::New
static vtkTubeFilter * New()
Construct object with radius 0.5, radius variation turned off, the number of sides set to 3,...
vtkTubeFilter::TextureLength
double TextureLength
Definition: vtkTubeFilter.h:257
vtkTubeFilter::SetGenerateTCoordsToOff
void SetGenerateTCoordsToOff()
Control whether and how texture coordinates are produced.
Definition: vtkTubeFilter.h:207
vtkTubeFilter::GenerateTCoords
int GenerateTCoords
Definition: vtkTubeFilter.h:255
vtkTubeFilter::SetVaryRadiusToVaryRadiusByVectorNorm
void SetVaryRadiusToVaryRadiusByVectorNorm()
Turn on/off the variation of tube radius with scalar value.
Definition: vtkTubeFilter.h:112
vtkTubeFilter::SetGenerateTCoordsToUseScalars
void SetGenerateTCoordsToUseScalars()
Control whether and how texture coordinates are produced.
Definition: vtkTubeFilter.h:213
vtkTubeFilter::UseDefaultNormal
vtkTypeBool UseDefaultNormal
Definition: vtkTubeFilter.h:250
vtkTubeFilter::RadiusFactor
double RadiusFactor
Definition: vtkTubeFilter.h:248
vtkTubeFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTubeFilter::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkTubeFilter.h:256
vtkTubeFilter::GeneratePoints
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)
vtkTubeFilter::SetVaryRadiusToVaryRadiusByVector
void SetVaryRadiusToVaryRadiusByVector()
Turn on/off the variation of tube radius with scalar value.
Definition: vtkTubeFilter.h:111
vtkTubeFilter::VaryRadius
int VaryRadius
Definition: vtkTubeFilter.h:246
vtkTubeFilter::vtkTubeFilter
vtkTubeFilter()
vtkTubeFilter::GetVaryRadiusAsString
const char * GetVaryRadiusAsString()
Turn on/off the variation of tube radius with scalar value.
vtkTubeFilter::SidesShareVertices
vtkTypeBool SidesShareVertices
Definition: vtkTubeFilter.h:251
vtkTubeFilter::Capping
vtkTypeBool Capping
Definition: vtkTubeFilter.h:252
vtkTubeFilter::ComputeOffset
vtkIdType ComputeOffset(vtkIdType offset, vtkIdType npts)
vtkTubeFilter::SetGenerateTCoordsToUseLength
void SetGenerateTCoordsToUseLength()
Control whether and how texture coordinates are produced.
Definition: vtkTubeFilter.h:212
vtkTubeFilter::SetVaryRadiusToVaryRadiusByScalar
void SetVaryRadiusToVaryRadiusByScalar()
Turn on/off the variation of tube radius with scalar value.
Definition: vtkTubeFilter.h:110
vtkTubeFilter::Theta
double Theta
Definition: vtkTubeFilter.h:271
vtkTubeFilter::NumberOfSides
int NumberOfSides
Definition: vtkTubeFilter.h:247
vtkTubeFilter::~vtkTubeFilter
~vtkTubeFilter() override=default
vtkTubeFilter::SetVaryRadiusToVaryRadiusByAbsoluteScalar
void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
Turn on/off the variation of tube radius with scalar value.
Definition: vtkTubeFilter.h:116
vtkTubeFilter::SetVaryRadiusToVaryRadiusOff
void SetVaryRadiusToVaryRadiusOff()
Turn on/off the variation of tube radius with scalar value.
Definition: vtkTubeFilter.h:109
vtkTubeFilter::Offset
int Offset
Definition: vtkTubeFilter.h:254
vtkTubeFilter::GenerateStrips
void GenerateStrips(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD, vtkCellArray *newStrips)
vtkTubeFilter::GenerateTextureCoords
void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, const vtkIdType *pts, vtkPoints *inPts, vtkDataArray *inScalars, vtkFloatArray *newTCoords)
vtkTubeFilter::Radius
double Radius
Definition: vtkTubeFilter.h:245
vtkTubeFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkTubeFilter::OnRatio
int OnRatio
Definition: vtkTubeFilter.h:253
vtkX3D::range
@ range
Definition: vtkX3D.h:238
vtkX3D::offset
@ offset
Definition: vtkX3D.h:438
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkPolyDataAlgorithm.h
VTK_TCOORDS_FROM_SCALARS
#define VTK_TCOORDS_FROM_SCALARS
Definition: vtkTubeFilter.h:73
VTK_VARY_RADIUS_BY_SCALAR
#define VTK_VARY_RADIUS_BY_SCALAR
Definition: vtkTubeFilter.h:65
VTK_TCOORDS_FROM_LENGTH
#define VTK_TCOORDS_FROM_LENGTH
Definition: vtkTubeFilter.h:72
VTK_VARY_RADIUS_BY_VECTOR_NORM
#define VTK_VARY_RADIUS_BY_VECTOR_NORM
Definition: vtkTubeFilter.h:68
VTK_TCOORDS_FROM_NORMALIZED_LENGTH
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH
Definition: vtkTubeFilter.h:71
VTK_VARY_RADIUS_OFF
#define VTK_VARY_RADIUS_OFF
Definition: vtkTubeFilter.h:64
VTK_VARY_RADIUS_BY_VECTOR
#define VTK_VARY_RADIUS_BY_VECTOR
Definition: vtkTubeFilter.h:66
VTK_TCOORDS_OFF
#define VTK_TCOORDS_OFF
Definition: vtkTubeFilter.h:70
VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR
Definition: vtkTubeFilter.h:67
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:144